Skip to content

[fix](build) Simplify TeamCity comment dispatch - #70515

Merged
morningman merged 6 commits into
apache:masterfrom
hello-stephen:codex/fix-comment-artifact-binding
Nov 12, 2026
Merged

morningman merged 6 commits into
apache:masterfrom
hello-stephen:codex/fix-comment-artifact-binding

Conversation

@hello-stephen

@hello-stephen hello-stephen commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Background

PR comments select TeamCity jobs through a shared shell helper and existing file filters. Compile publishes packages and automatically dispatches P0, CloudP0, VaultP0, External and NonConcurrent. Those pipelines handle artifact selection and validation.

What problem does this PR solve?

Issue Number: None
Related PR: #70486 (updates the Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Make run buildall select FEUT, BEUT, CloudUT, Compile and master-only Performance. Select regression jobs only for their explicit commands, leaving automatic regression fanout to Compile. Preserve the existing file filters for every command and pass the requested commit alongside PR and target-branch information.

Details

  • Frequency: The command-selection rules apply to every comment-triggered run.
  • Root cause: Selection was split between workflow conditions and shell early exits: regression steps accepted buildall but immediately exited, while Performance was excluded from buildall entirely.
  • Why existing tests missed it: Tests did not verify the complete command/target-branch selection matrix.
  • Fix: Express job selection directly in workflow conditions and add the requested head to the existing trigger parameters. Keep artifact handling in TeamCity.
  • Other paths and branches: All five regression consumers remain available through their explicit commands, subject to the original file filters. Performance runs only for master PRs. Compile retains automatic regression fanout.
  • Behavior change: Master run buildall includes Performance under its existing file filter. Regression workflow steps are not selected by buildall. File-filter skip behavior is unchanged, including for direct regression commands.

Testing

  • 27 local TeamCity helper tests passed, covering command/branch selection, existing file-filter skips and submission parameters.
  • actionlint, shellcheck -S warning, bash -n and git diff --check passed.
  • End-to-end execution through the updated comment workflow requires merging this PR.

Notes for Reviewers

Artifact dependencies and package validation are maintained separately in TeamCity. This PR changes only comment dispatch and its tests; it does not add a repository artifact helper or bypass file filters.

Release note

None

Check List (For Author)

  • Behavior changed: Yes (see Details)
  • Does this need documentation: No
  • Pre-submission status: Partially verified: local checks passed; post-merge comment workflow execution remains.

AI Disclosure

  • Tool: OpenAI Codex
  • Generated: Code, tests and this description.
  • Human review: Pending maintainer review.

…facts

### Background

PR comments submit TeamCity jobs through a shared shell helper. Compile publishes a binary/case package pair and dispatches P0, CloudP0, VaultP0, External and NonConcurrent with an immutable artifact binding.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (superseded Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Direct regression comments supplied only the PR number and target branch, leaving artifact dependencies to resolve the default `UNBOUND` build number before any runner could execute. Resolve and validate an existing successful Compile before submitting any of the five regression consumers. `run buildall` selects only FEUT, BEUT, CloudUT, Compile and master-only Performance; Compile remains responsible for regression fanout. Missing or invalid packages fail the comment workflow and the requested `TeamCity/<lane>` status without scheduling another Compile.

### Details

- **Change map:** Approximately 180 added production lines in the shared shell helper and a pure Python manifest validator, workflow condition changes, and approximately 170 added test lines. The validator preserves all 43 parameters used by the existing Compile fanout, including legacy aliases used by different regression runners.
- **Frequency:** Every direct regression request using an unbound configuration can fail before its first build step.
- **Root cause:** Artifact resolution occurs before runner-side lookup could supply the missing producer number and manifest/source pins.
- **Why existing tests missed it:** They explicitly expected regressions to enqueue with only PR parameters and did not model pre-run artifact resolution.
- **Fix:** Search successful finished Compiles for the requested PR/head, refresh producer state, validate manifest PR/head/target, package presence and sizes, expiry, source integrity and checksums, then submit only the requested consumer. Pin the compiled base and merge from that manifest; target-branch advancement does not silently substitute a different package. Recheck the live PR before each submission and verify returned parameters. Pagination, request failures, canceled producers and missing artifacts fail closed; there is no automatic Compile or latest-other-revision fallback.
- **Other paths and branches:** Apply the same binding to P0, CloudP0, VaultP0, External and NonConcurrent. Performance is independent of these artifacts and is selected by `buildall` only for master. Existing file filters remain for independent jobs and Compile; explicit regression requests check/run their artifacts instead of reporting an unrelated-file skip. Existing Compile fanout and `skip buildall` behavior remain intact.
- **Behavior change:** Direct requests without usable packages report a failure immediately, without creating an unbound TeamCity build. Repeat counts retain the same verified producer and never create a Compile dependency.

### Testing

- `python3 -m unittest discover -s regression-test/pipeline/common/tests -p test_teamcity_utils.py -q`: 36 tests passed locally. Coverage includes all command/branch combinations, all five consumers, repeat requests, missing/wrong/stale/incomplete packages, pagination, producer state changes, PR-head changes, readback mismatch, status reporting and credential tracing.
- Three new regression tests fail on the original helper/workflow and pass with this change: dispatch selection, complete artifact binding, and missing-Compile failure without enqueue.
- `actionlint .github/workflows/comment-to-trigger-teamcity.yml`, `shellcheck -S warning regression-test/pipeline/common/teamcity-utils.sh`, `bash -n regression-test/pipeline/common/teamcity-utils.sh`, and `git diff --check` passed.
- Read-only validation against an actual successful Compile selected the expected producer and generated all 43 parameters identically to its existing automatic regression fanout. All five consumer configurations currently have no static snapshot dependencies.
- No live configuration was changed and no TeamCity build was submitted for this PR. End-to-end comment-trigger validation requires the trusted workflow/helper to be merged.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Partially verified: local tests and read-only live contract checks passed; post-merge comment-trigger execution remains to be validated.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code changes, tests and this description.
- Human review: Pending maintainer review.
### Background

PR comments select TeamCity jobs. Compile publishes a binary/case package pair and automatically dispatches P0, CloudP0, VaultP0, External and NonConcurrent with an exact artifact binding.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (superseded Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Direct regression requests currently fail artifact resolution against the default `UNBOUND` build number before their first runner can execute. Keep the comment entry lightweight: submit only PR number, requested commit and target branch. Move Compile lookup, download and verification into the first TeamCity step; missing or invalid packages fail that build without starting another Compile. `run buildall` selects FEUT, BEUT, CloudUT, Compile and master-only Performance, leaving regression fanout to Compile.

### Details

- **Change map:** The comment helper changes by only a few lines. A shared TeamCity-side preflight handles producer selection, the existing 43-parameter consumer contract and verified downloads; its tests exercise failure and publication boundaries. Workflow conditions and a short installation guide complete the integration.
- **Frequency:** Direct comments for any of the five regression consumers with no artifact producer supplied.
- **Root cause:** Static artifact dependencies resolve before build steps, while direct requests do not have a Compile build number. Looking up artifacts in a later runner cannot repair that startup failure.
- **Why existing tests missed it:** They tested comment enqueue payloads without exercising TeamCity artifact resolution or runner-side preparation.
- **Fix:** Remove the static Compile artifact dependency and run the trusted preflight at the start of each consumer's first shell step. Use TeamCity's temporary build credentials and actual consumer revision to select an existing finished successful Compile. Validate PR/head/target, producer, source integrity, expiry and package presence; download binary, cases and tools and verify byte counts/SHA256. Export bindings to the current shell and subsequent steps only after all downloads verify. No new personal token or Compile trigger is introduced.
- **Other paths and branches:** All five regression consumers use the same preflight. Automatic fanout retains and validates its exact producer and pins instead of selecting a newer Compile. Performance remains independent and master-only. Existing source-head guards, rootless cluster execution, case selection and cleanup continue after preflight.
- **Behavior change:** Explicit regression comments always reach the pipeline, even if file filters would otherwise skip them. Missing packages now produce a failed TeamCity preflight step. Independent job/Compile file filters and `skip buildall` remain intact.

### Testing

- `python3 -m unittest discover -s regression-test/pipeline/common/tests -p 'test_teamcity*.py' -q`: 39 tests passed locally. Coverage includes command/branch selection, lightweight enqueue payloads, all five artifact consumers, missing/wrong/expired/incomplete packages, exact automatic-fanout pins, pagination, actual/requested revision mismatches, download hashes, failed-download cleanup and delayed parameter publication.
- `actionlint .github/workflows/comment-to-trigger-teamcity.yml`, `shellcheck -S warning regression-test/pipeline/common/teamcity-utils.sh`, Python syntax compilation and `git diff --check` passed.
- On an actual ordinary-user Agent, native build credentials successfully read Compile metadata and artifacts; the new resolver retained the current build's exact producer and verified all 43 bindings without downloading or disturbing its workload.
- The first-step integration and removal of the obsolete static artifact dependency were applied and read back on all five TeamCity configurations. Other steps and configuration fields were preserved; existing builds were not canceled or restarted.
- One External validation was queued with only PR, commit and target branch, and no Compile/artifact dependency. Its runtime preflight result is pending; full regression success is not claimed. The GitHub comment workflow itself takes effect after merge into the trusted default branch.

### Notes for Reviewers

`teamcity_artifacts.py` is trusted TeamCity runner code, not code executed from the PR checkout. See `regression-test/pipeline/common/teamcity-artifacts.md` for installation and the required dependency change. The helper uses read-only REST requests, bounded metadata responses, streaming downloads and no redirects carrying credentials.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes, the integration guide is included.
- Pre-submission status: Partially verified: local tests, native-auth resolver validation and configuration readback passed; runtime canary and post-merge comment validation remain.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code, tests, integration guide and this description.
- Human review: Pending maintainer review.
### Background

PR comments submit TeamCity jobs through a shared shell helper. Compile publishes the binary/case packages and dispatches the five regression consumers.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (updates the Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Direct regression comments left the artifact dependency pointing at the default `UNBOUND` build number. Keep comments simple: pass PR, commit and target branch, and let TeamCity select/download the artifacts. A first pipeline step checks the downloaded package identity before the existing preparation runs. Missing packages or a different commit fail the requested regression build without starting Compile.

### Details

- **Change map:** About 160 lines of pipeline binding code, small workflow/helper changes, about 140 test lines, and a short TeamCity integration guide. Most binding code maps the aliases already required by the five existing runners.
- **Frequency:** Direct regression requests with an unbound artifact dependency fail before running any steps.
- **Root cause:** Native artifact resolution happens before a runner can fill the producer build number.
- **Why existing tests missed it:** Trigger tests covered enqueueing but did not check native artifact selection and the consumer's package identity gate together.
- **Fix:** Use a native Compile artifact dependency filtered to the requested PR. The trusted first step checks the actual revision, manifest identity, producer success and existing automatic-fanout pins, then fills existing runner parameters. There is no custom artifact search, pagination or downloader. Existing package/checksum validation remains in the preparation steps. The server integration is documented in `teamcity-artifacts.md`.
- **Other paths and branches:** `run buildall` selects FEUT, BEUT, CloudUT, Compile and master-only Performance. P0, CloudP0, VaultP0, External and NonConcurrent run directly only for their explicit commands; Compile retains automatic fanout. Independent jobs retain their existing file filters.
- **Behavior change:** Direct regression commands reach TeamCity even if their file filter says unchanged. TeamCity fails when its selected Compile package is unavailable, unsuccessful or for another commit; it does not rebuild Compile or search older builds.

### Testing

- 34 local unit tests passed, covering trigger selection, existing enqueue checks, package PR/commit/producer identity, failed producers and immutable automatic-fanout bindings.
- `actionlint`, `shellcheck -S warning`, Python compilation and `git diff --check` passed.
- All five TeamCity configurations use the native dependency and plaintext binding step. No static Compile snapshot dependency was added.
- A direct External validation build was submitted with only PR/head/target parameters; live artifact-stage verification is in progress. Earlier custom-download prototypes failed on endpoint/authentication constraints and were removed.
- End-to-end execution through the comment workflow still requires merging this PR.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No user documentation; pipeline integration is included here.
- Pre-submission status: Partially verified: local checks passed; live artifact-stage validation and post-merge comment execution remain.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code, tests, integration notes and this description.
- Human review: Pending maintainer review.
@hello-stephen hello-stephen changed the title [fix](build) Bind direct regression requests to verified Compile artifacts [fix](build) Keep regression artifact binding in TeamCity Nov 12, 2026
### Background

PR comments submit TeamCity jobs through a shared shell helper. Compile publishes the binary/case packages and dispatches the five regression consumers.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (updates the Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Direct regression comments left the artifact dependency pointing at the default `UNBOUND` build number. Keep comments simple: pass PR, commit and target branch, and let TeamCity select/download the artifacts. A first pipeline step checks the downloaded package identity before the existing preparation runs. Missing packages or a different commit fail the requested regression build without starting Compile.

### Details

- **Change map:** About 160 lines of pipeline binding code, small workflow/helper changes, about 140 test lines, and a short TeamCity integration guide. Most binding code maps the aliases already required by the five existing runners.
- **Frequency:** Direct regression requests with an unbound artifact dependency fail before running any steps.
- **Root cause:** Native artifact resolution happens before a runner can fill the producer build number.
- **Why existing tests missed it:** Trigger tests covered enqueueing but did not check native artifact selection and the consumer's package identity gate together.
- **Fix:** Use a native Compile artifact dependency filtered to the requested PR. The trusted first step checks the actual revision, manifest identity, producer success and existing automatic-fanout pins, then fills existing runner parameters. There is no custom artifact search, pagination or downloader. Existing package/checksum validation remains in the preparation steps. The server integration is documented in `teamcity-artifacts.md`.
- **Other paths and branches:** `run buildall` selects FEUT, BEUT, CloudUT, Compile and master-only Performance. P0, CloudP0, VaultP0, External and NonConcurrent run directly only for their explicit commands; Compile retains automatic fanout. Independent jobs retain their existing file filters.
- **Behavior change:** Direct regression commands reach TeamCity even if their file filter says unchanged. TeamCity fails when its selected Compile package is unavailable, unsuccessful or for another commit; it does not rebuild Compile or search older builds.

### Testing

- 35 local unit tests passed, covering trigger selection, existing enqueue checks, package PR/commit/producer identity, failed producers and immutable automatic-fanout bindings.
- `actionlint`, `shellcheck -S warning`, Python compilation and `git diff --check` passed.
- All five TeamCity configurations use the native dependency and plaintext binding step. No static Compile snapshot dependency was added.
- A direct External validation build was submitted with only PR/head/target parameters; live artifact-stage verification is in progress. Earlier custom-download prototypes failed on endpoint/authentication constraints and were removed.
- End-to-end execution through the comment workflow still requires merging this PR.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No user documentation; pipeline integration is included here.
- Pre-submission status: Partially verified: local checks passed; live artifact-stage validation and post-merge comment execution remain.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code, tests, integration notes and this description.
- Human review: Pending maintainer review.
### Background

PR comments select TeamCity jobs. Compile publishes the binary/case packages and automatically dispatches P0, CloudP0, VaultP0, External and NonConcurrent. Artifact selection and package validation belong to those TeamCity pipelines.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (updates the Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Make `run buildall` select only FEUT, BEUT, CloudUT, Compile and master-only Performance. Explicit regression commands submit the requested lane with PR, commit and target branch, even when its file filter says unchanged, so TeamCity can check the corresponding Compile package and fail if it is unavailable. This PR contains only comment dispatch changes and their tests.

### Details

- **Frequency:** A direct regression command can be skipped whenever its file filter reports no relevant changes.
- **Root cause:** The comment helper used the same file-filter skip path for explicit regression reruns and independent jobs, bypassing the pipeline's package checks.
- **Why existing tests missed it:** Tests did not require explicit regression commands to enqueue when the file filter was false, or verify the full command/branch selection matrix.
- **Fix:** Give each regression workflow step an explicit-command condition, keep artifact handling in TeamCity, and pass the requested head alongside PR/target information. Preserve existing filters for independent jobs and Compile.
- **Other paths and branches:** Apply the same direct-command behavior to all five regression consumers. Performance participates in `buildall` only on master. Compile retains automatic regression fanout.
- **Behavior change:** Direct regression requests reach TeamCity instead of reporting an unrelated-file skip. Missing or mismatched packages fail there without triggering another Compile.

### Testing

- 28 local TeamCity helper tests passed, including command/branch selection and explicit requests with unchanged-file filters.
- `actionlint`, `shellcheck -S warning`, `bash -n` and `git diff --check` passed.
- Read-only inspection confirmed that all five TeamCity consumers execute inline package-validation code and do not reference a repository `teamcity_artifacts.py` file. The unused helper, its standalone tests and its installation notes have been removed from this PR.
- End-to-end execution through the updated comment workflow requires merging this PR.

### Notes for Reviewers

Native artifact dependencies and inline package validation are maintained in TeamCity. Their server configuration is separate from this PR; removing the unused repository files does not remove those checks.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Partially verified: local checks passed; post-merge comment workflow execution remains.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code, tests and this description.
- Human review: Pending maintainer review.
@hello-stephen hello-stephen changed the title [fix](build) Keep regression artifact binding in TeamCity [fix](build) Simplify TeamCity comment dispatch Nov 12, 2026
### Background

PR comments select TeamCity jobs through a shared shell helper and existing file filters. Compile publishes packages and automatically dispatches P0, CloudP0, VaultP0, External and NonConcurrent. Those pipelines handle artifact selection and validation.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#70486 (updates the Performance trigger policy)
PR Type: Bugfix

Problem Summary:

Make `run buildall` select FEUT, BEUT, CloudUT, Compile and master-only Performance. Select regression jobs only for their explicit commands, leaving automatic regression fanout to Compile. Preserve the existing file filters for every command and pass the requested commit alongside PR and target-branch information.

### Details

- **Frequency:** The command-selection rules apply to every comment-triggered run.
- **Root cause:** Selection was split between workflow conditions and shell early exits: regression steps accepted `buildall` but immediately exited, while Performance was excluded from `buildall` entirely.
- **Why existing tests missed it:** Tests did not verify the complete command/target-branch selection matrix.
- **Fix:** Express job selection directly in workflow conditions and add the requested head to the existing trigger parameters. Keep artifact handling in TeamCity.
- **Other paths and branches:** All five regression consumers remain available through their explicit commands, subject to the original file filters. Performance runs only for master PRs. Compile retains automatic regression fanout.
- **Behavior change:** Master `run buildall` includes Performance under its existing file filter. Regression workflow steps are not selected by `buildall`. File-filter skip behavior is unchanged, including for direct regression commands.

### Testing

- 27 local TeamCity helper tests passed, covering command/branch selection, existing file-filter skips and submission parameters.
- `actionlint`, `shellcheck -S warning`, `bash -n` and `git diff --check` passed.
- End-to-end execution through the updated comment workflow requires merging this PR.

### Notes for Reviewers

Artifact dependencies and package validation are maintained separately in TeamCity. This PR changes only comment dispatch and its tests; it does not add a repository artifact helper or bypass file filters.

### Release note

None

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Partially verified: local checks passed; post-merge comment workflow execution remains.

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Code, tests and this description.
- Human review: Pending maintainer review.

@shuke987 shuke987 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman
morningman merged commit 172120c into apache:master Nov 12, 2026
49 checks passed
@hello-stephen
hello-stephen deleted the codex/fix-comment-artifact-binding branch November 12, 2026 13:15
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

mrhhsg pushed a commit that referenced this pull request Nov 16, 2026
### Background

PR comment commands use a shared TeamCity helper to verify the PR before
submitting builds or writing file-filter skip statuses.

### What problem does this PR solve?

Issue Number: None
Related PR: #70459 (introduced the draft restriction), #70515 (retained
it)
PR Type: Bugfix

Problem Summary:
Authorized `run buildall` and individual commands fail on open draft
PRs, including when a lane should only write a skip status. Allow draft
PRs through the shared gate while retaining the open-state, exact head
and target-branch checks.

### Details

- **Frequency:** Every comment-triggered build or skip for a draft PR.
- **Root cause:** The common PR identity check also required `draft ==
false`.
- **Why existing tests missed it:** Existing dispatch tests replaced the
PR check with a freshness stub.
- **Fix:** Remove only the draft predicate. New tests exercise the real
PR predicate for both enqueue and skip paths.
- **Other paths and branches:** The shared helper covers all supported
comment-triggered lanes and branches. Workflow commenter authorization
and file filters are unchanged.

### Testing

- `python3
regression-test/pipeline/common/tests/test_teamcity_utils.py`: 29 tests
passed locally.
- The new draft acceptance test fails against the original predicate.
- Negative coverage verifies closed PRs, changed heads and changed
target branches cannot enqueue builds or write skip statuses.
- `bash -n regression-test/pipeline/common/teamcity-utils.sh` and `git
diff --check` passed.
- No live CI rerun performed for this change.

### Release note

None.

### Check List (For Author)

- Behavior changed: Yes (open draft PRs accept authorized comment
triggers).
- Does this need documentation: No.
- Pre-submission status: Ready.

### AI Disclosure

- Tool: OpenAI Codex.
- Generated: Code change, tests and PR description.
- Human review: Pending.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants