Repository navigation
ci(#9128): harden behaviour-test dispatch and jobs-listing reads - #9129
Conversation
|
🤖 Finished Review · ✅ Success · Started 4:52 PM UTC · Completed 5:01 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.96 |
Site previewPreview: https://628bb8bc-site.fullsend-ai.workers.dev Commit: |
|
Risk Assessment: moderate (2/5) DetailsPreserving moderate risk score of 2: elevated git churn and change coupling across touched forge files are balanced by strong test coverage (50% test file ratio), zero protected or security-sensitive paths, and exact scope alignment with linked issue #9128. Previous runRisk Assessment: moderate (2/5) DetailsPreserving moderate risk score of 2: high git churn and change coupling on core forge files are balanced by strong test coverage (50% test file ratio), zero protected or security-sensitive paths, and exact scope alignment with linked issue #9128. Previous run (2)Risk Assessment: moderate (2/5) DetailsModerate risk: large change size and high git churn/coupling on core forge files are balanced by strong test coverage (50% test files), zero protected or security-sensitive paths, and exact scope alignment with linked issue #9128. |
ReviewFindingsLow
Earlier findings
Labels: PR changes Go behaviour-test driver and forge CI listing code. Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOlt7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJkb2Mtc3R5bGUiLCJmaWxlIjoicGtnL2JlaGF2aW91cnRlc3QvZHJpdmVycy9jaS9naXRodWJhY3Rpb25zL2Rpc3BhdGNoX3JlYWRzX3Rlc3QuZ28iLCJpZCI6ImZfMTU3MWQ0M2VmODNhNjBmZSIsImxpbmUiOjE2NywiYWN0aW9uYWJsZSI6dHJ1ZSwiZGltZW5zaW9uIjoic3R5bGUtY29udmVudGlvbnMifSx7InNldmVyaXR5IjoibG93IiwiY2F0ZWdvcnkiOiJjb2RlLW9yZ2FuaXphdGlvbiIsImZpbGUiOiJpbnRlcm5hbC9mb3JnZS9mb3JnZS5nbyIsImlkIjoiZl8wZjE1ZDIwNjM4MWNlNTM2IiwibGluZSI6MjYyLCJhY3Rpb25hYmxlIjpmYWxzZSwiZGltZW5zaW9uIjoic3R5bGUtY29udmVudGlvbnMifV0sImRpc3Bvc2l0aW9ucyI6W3siaWQiOiJmXzE1NzFkNDNlZjgzYTYwZmUiLCJzdGF0dXMiOiJyZXNvbHZlZF9ieV9jaGFuZ2UifSx7ImlkIjoiZl8wZjE1ZDIwNjM4MWNlNTM2Iiwic3RhdHVzIjoicmVzb2x2ZWRfYnlfY2hhbmdlIn1dfQ== --> Looks good to me Earlier findings
Previous run (2)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImRvYy1zdHlsZSIsImZpbGUiOiJwa2cvYmVoYXZpb3VydGVzdC9kcml2ZXJzL2NpL2dpdGh1YmFjdGlvbnMvZGlzcGF0Y2hfcmVhZHNfdGVzdC5nbyIsImlkIjoiZl8xNTcxZDQzZWY4M2E2MGZlIiwibGluZSI6MTY3LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJzdHlsZS1jb252ZW50aW9ucyJ9LHsic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImNvZGUtb3JnYW5pemF0aW9uIiwiZmlsZSI6ImludGVybmFsL2ZvcmdlL2ZvcmdlLmdvIiwiaWQiOiJmXzBmMTVkMjA2MzgxY2U1MzYiLCJsaW5lIjoyNjIsImFjdGlvbmFibGUiOmZhbHNlLCJkaW1lbnNpb24iOiJzdHlsZS1jb252ZW50aW9ucyJ9XX0= --> ReviewFindingsLow
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 5:03 PM UTC · Completed 5:09 PM UTC Commit: Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.24 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Move the count-side test doc comment next to its test function so godoc no longer merges it with TestClassifyJobsError, and place ErrJobsListingNotFoundFirstPage after IsNotFound so the ErrNotFound sentinel/predicate pair stays adjacent. Note: pre-commit could not fetch remote hook repositories (certificate verification failure); the applicable hooks (whitespace check, gofmt, go vet) were run directly and passed. Addresses #9129 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🔧 Fix agent — iteration 1 (bot-triggered)Addressed both low-severity review findings (doc comment placement and sentinel ordering). Pure code movement, no behaviour change; affected package tests and go vet pass. Fixed (2):
Tests: passed CI inspections (5):
Conflict update: skipped; strategy
|
|
🤖 Finished Review · ✅ Success · Started 5:11 PM UTC · Completed 5:18 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.02 |
Superseded by updated review
Re-land the behaviour-test reliability slice that #9084 carried and then reverted in 7fae148 as scope drift. This commit is the inverse of that revert, which applies cleanly to main; the other differences between #9084 and main in these files belong to the trace-context work and are not included. Forge layer: - Add RunAttempt to WorkflowRun and WorkflowJob, populated by the GitHub adapter from run_attempt. - Add ErrJobsListingNotFoundFirstPage. The GitHub and GitLab ListWorkflowRunJobs adapters attach it only to a page-1 not-found (the shape tracked in #9124). GitHub errors now name the repository, run, and page. GitHub Actions behaviour driver: - settleHarnessDispatchCount and AssertNoHarnessAgentArtifact list runs through the paginated, time-bounded listing and ignore skipped runs. - Runs that have not started (queued/requested/pending) are counted as pending without reading their jobs. - classifyJobsError(status, err) maps listing errors to skip, retryLater, or fatal for both paths. The count path keeps skip and retryLater runs pending; the one-shot negative path skips only runs that have not started and fails closed otherwise. - CountHarnessDispatches caches a completed run's jobs across polls only when a decisive counted agent match exists and every job belongs to the run's known attempt. Tests: dispatch_reads_test.go and workflow_attempt_test.go come back with the original regressions. Added cases in github_test.go, methods_test.go, and githubactions_test.go cover first-page vs later-page 404s and the error context. Closes #9128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the count-side test doc comment next to its test function so godoc no longer merges it with TestClassifyJobsError, and place ErrJobsListingNotFoundFirstPage after IsNotFound so the ErrNotFound sentinel/predicate pair stays adjacent. Note: pre-commit could not fetch remote hook repositories (certificate verification failure); the applicable hooks (whitespace check, gofmt, go vet) were run directly and passed. Addresses #9129 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
76ca703 to
ae9b740
Compare
|
🤖 Finished Review · ✅ Success · Started 11:40 AM UTC · Completed 11:57 AM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.57 |
Superseded by updated review
Summary
Re-lands the behaviour-test dispatch-assertion and jobs-listing reliability work that #9084 carried and then reverted in
7fae148f7, which called it scope drift. This change is the exact inverse of that revert. It applies cleanly to currentmain. The other differences between #9084 andmainin these files are trace-context ID and Jira changes, and they are left out.Related Issue
Split from #9084. Related: #9124 (root cause of the first-page jobs 404), #8142 (earlier hardening of the
CountHarnessDispatchescallers).Changes
Forge layer (
internal/forge/)WorkflowRun.RunAttemptandWorkflowJob.RunAttempt. The GitHub adapter fills them fromrun_attemptin every workflow-run and jobs read.forge.ErrJobsListingNotFoundFirstPage. The GitHub and GitLabListWorkflowRunJobsadapters attach it only when page 1 returns not-found. A 404 on a later page never carries it. GitHub listing errors now name the repository, run ID, and page.GitHub Actions behaviour driver (
pkg/behaviourtest/drivers/ci/githubactions/)settleHarnessDispatchCountandAssertNoHarnessAgentArtifactlist runs with the paginatedlistHarnessRunsAfterPaginatedand ignore completed/skipped runs.queued/requested/pending) count as pending, and their jobs are never read.classifyJobsError(status, err)sorts listing errors into skip, retryLater, or fatal, in one place for both paths. The count path keeps skip and retryLater runs pending. The one-shot negative assertion skips only runs that have not started and fails closed in every other case.CountHarnessDispatcheskeeps a per-assertion cache of completed job listings. A listing is cached only when it has a decisive counted agent match (a non-empty conclusion that is not skipped or cancelled) and every job belongs to the run's known attempt.docs/contributing/forge-abstraction.mddocuments the workflow-attempt fields and the cache's reuse rules.Testing
go build ./...andgo vet ./...pass.go test -racepasses for./internal/forge/,./internal/forge/github/,./internal/forge/gitlab/, and./pkg/behaviourtest/drivers/ci/githubactions/.runUnstarted,classifyJobsError,settleHarnessDispatchCount,CountHarnessDispatches, and GitHubListWorkflowRunJobsare at 100%.AssertNoHarnessAgentArtifactis at 93.3%.dispatch_reads_test.go(request counts, skipped runs, jobs reads for runs that have not started,classifyJobsErrortable, waiting runs, completed-job cache, fatal errors),workflow_attempt_test.go, the GitHub and GitLab first-page and later-page 404 sentinel tests, and the pagination test for dispatch assertions.go vet ./...,lint-broken-symlinks,lint-docs-links, and lychee all passed, and the secret scan was clean.pre-commit run/make lintitself did not run.Checklist
!for breaking changes)🤖 Generated with Claude Code
Closes #9128
Post-script verification
agent/9128-dispatch-jobs-reliability)7d0eb20c443064d1f5ddb9d0ad9f191cfdd6f9cf..HEAD)