Repository navigation
fix(dispatch): read job.workflow_sha through the trusted expression in the startup-failure fallback - #9721
Conversation
TestWorkflowSHAUsesAreTrusted reported only the offending line's text, so a failure did not say which workflow or line to fix. The scan now lives in workflowSHAViolations, which returns "file:line: text" with a 1-based line number for each job.workflow_sha read that bypasses trustedWorkflowSHA. The test reports one error per violation. The rule itself is unchanged. TestWorkflowSHAViolationsNamesFileAndLine covers the message format with a synthetic workflow: a trusted read on line 6 and a bare read on line 7. TestWorkflowSHAUsesAreTrusted still fails until the nine bare reads in reusable-dispatch.yml and reusable-prioritize.yml use the trusted expression. Those edits are under .github/workflows/ and out of scope for this commit. With them applied in a scratch worktree, go test ./internal/scaffold/ passed. Note: pre-commit could not fetch hook repositories (TLS failure). The applicable hooks ran directly instead and passed: pre-commit-hooks v6.0.0 file checks, gofmt, go vet ./..., lint-broken-symlinks. scan-secrets covered gitleaks. Related to #9720 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/fs-fix-stop |
|
Fix agent disabled for this PR. Remove the |
|
🤖 Review · Commit: This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging. |
…in the startup-failure fallback #9206 fetches report-agent-startup-failure.sh with a bare ?ref=${{ job.workflow_sha }} in eight reusable-dispatch.yml jobs and in reusable-prioritize.yml. On a same-repo pull_request run of fullsend's own workflows that is the PR merge commit, so the reporter came from PR code, and TestWorkflowSHAUsesAreTrusted (#9230) fails on main. Use the same expression as the checkout refs, which resolves to the base sha there. Fixes #9720 Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 10:13 PM UTC · Completed 10:21 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.49 |
|
Risk Assessment: moderate (2/5) DetailsSmall 3-file PR addressing issue #9720 with high alignment, but touches protected CI workflow paths with significant historical churn and coupling, yielding a moderate composite risk. |
ReviewFindingsMedium
Labels: PR changes reusable dispatch/prioritize CI workflows and the Go scaffold test. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
This PR fixes
main, whereTestWorkflowSHAUsesAreTrustedfails after #9206. The cause is nine fallback fetches ofreport-agent-startup-failure.shthat readjob.workflow_shadirectly. They now go through the trusted expression the checkout refs already use. On a same-repopull_requestrun of fullsend's own workflows, that expression gives the PR's base commit, so the startup-failure reporter no longer comes from PR code. The test also now names the file and line of each violation.Related Issue
#9720 (follows #9206 and #9230)
Changes
.github/workflows/reusable-dispatch.yml(lines 1653, 1828, 2044, 2352, 2505, 2636, 2835, 3106) and.github/workflows/reusable-prioritize.yml(line 243):?ref=${{ job.workflow_sha }}becomes:trustedWorkflowSHAand the checkoutref:lines.internal/scaffold/pr_trigger_test.go(bot commit):workflowSHAViolations, reports each untrusted read asfile:line: text.TestWorkflowSHAViolationsNamesFileAndLine, covers that output.TestWorkflowSHAUsesAreTrustedenforces is unchanged.What the reporter fetch now resolves to:
pull_requestrun with a local reusable workflowjob.workflow_repositoryjob.workflow_sha, as beforejob.workflow_sha, as beforeA PR that adds the reporter script gets a 404 on the base sha. The step then warns and exits 0, as it already does when the fetch fails.
Follow-up, not in this PR. The predicate does not cover
pull_request_review, andreusable-poll-jira.ymlstill readsjob.workflow_shadirectly. Both predate this PR. They are tracked in #9723.Testing
go test ./internal/scaffold/... -count=1passes on this branch (ok, 99 s).maine2bf219,TestWorkflowSHAUsesAreTrustedfails (reproduced on a clean checkout).pre-commitpasses on the commit.Checklist
!for breaking changes)🤖 Generated with Claude Code
Closes #9720
Post-script verification
agent/9720-workflow-sha-test-message)e2bf21958bcb937a0c64fbeb4502519940cf66b7..HEAD)