fix(drift): pass --report to Auto-fix step so it reads the pinned report#314
Merged
Conversation
FIX #F3 moved the collector's drift report to $RUNNER_TEMP (outside the repo
checkout) and pointed the Assert and Create-PR steps at the pinned copy, but the
Auto-fix step still ran fix-drift.ts with no --report. It fell back to the
repo-root drift-report.json that FIX #F3 no longer writes, so readDriftReport
threw "Drift report not found" and the fixer died with exit 3 before running —
the recurring drift-job failure (e.g. run 29634448013).
Pass --report "${PINNED_REPORT}" to the Auto-fix step, matching the Assert and
Create-PR steps, so the fixer reads the same out-of-repo pinned report the
integrity gate uses. Add regression tests locking the wiring.
commit: |
jpr5
marked this pull request as ready for review
July 18, 2026 17:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
The Auto-fix drift step in
.github/workflows/fix-drift.ymlrannpx tsx scripts/fix-drift.tswith no--reportflag, sofix-drift.tsdefaultedreportPathto the repo-rootdrift-report.json. But FIX #F3 moved the collector's report to$RUNNER_TEMP(outside the repo checkout) and pinned a copy to$RUNNER_TEMP/drift-report.pinned.json. Nothing writes the repo-root file anymore, soreadDriftReportthrew and the job died with exit 3 before the fixer ran.This is the recurring drift-job failure — e.g. run 29634448013:
The earlier steps succeeded because none of them read the repo-root file: Collect wrote to
$RUNNER_TEMP, Check for critical diffs read onlysteps.detect.outputs.exit_code, and Pincp'd within$RUNNER_TEMP. The Assert and Create PR steps already read--report "${PINNED_REPORT}"; only the Auto-fix step was missed when FIX #F3 relocated the report.The prompt's
mv-vs-cphypothesis was ruled out — the pin usescp, and both its src/dest are in$RUNNER_TEMP. The real gap was the missing--reporton the Auto-fix invocation.The fix
Pass
--report "${PINNED_REPORT}"to the Auto-fix step (withPINNED_REPORTin its env), matching the Assert and Create-PR steps. The fixer now reads the same out-of-repo pinned report the integrity gate uses — lightest correct change, consistent with the existing design.Red-green proof (real failure surface)
Replicated the workflow's exact sequence locally: collector report written to a simulated
$RUNNER_TEMP, pinned viacp, repo-rootdrift-report.jsonabsent, then ran the realscripts/fix-drift.ts.RED (pre-fix invocation, bare
fix-drift.ts, no--report):Same error, same stack frames, same exit code as CI.
GREEN (fixed invocation,
fix-drift.ts --report "$PINNED_REPORT"):The report is read (past
readDriftReport:199/main:1167) and the fixer proceeds to invoke Claude Code. No "not found", no fatal error.Unit-level red-green (
src/__tests__/fix-drift-workflow.test.ts): 3 new text-shape tests assert the Auto-fix step carries--report "${PINNED_REPORT}"and thePINNED_REPORTenv, and that no barefix-drift.tsinvocation remains. All 3 FAIL against the pre-fix workflow (stashed) and PASS against the fix.Verification
pnpm run format:checkcleanpnpm run lintcleanpnpm run test— 4625 passed, 44 skipped, 0 failedpnpm run build(tsdown) cleancommitlint --from origin/main --to HEADexit 0.github/workflows/fix-drift.ymland the test file changed.🤖 Generated with Claude Code