fix(promotion): commit the files of transitions that applied when a later one fails - #65
Draft
scott-lowe-vapi wants to merge 1 commit into
Draft
scott-lowe-vapi wants to merge 1 commit into
scott-lowe-vapi wants to merge 1 commit into
Conversation
…ater one fails When a promotion failed partway, the workflow's commit step staged only the UUID state, but the failing transition had already rewritten tracked files in its target org, so `git pull --rebase` refused and nothing was pushed — not the state, and not the files of transitions that had already reached the platform. - promote-cmd truncates tmp/promotion-applied.txt at the start of each --apply run and, after each successful apply.ts, appends the paths git reports changed under resources/<target>/ (from git, not the plan: apply's own pull and push can rewrite other files). - On a non-success outcome, the commit step adds the state files plus exactly those paths, commits, then resets and cleans resources/ so the failed transition's rewrites can't block the rebase. - promotionCommandRun(args, deps) takes an injectable child runner, used by the new tests/promote-cmd.test.ts. Refs TEST-141 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.

Value
V.A.L.U.E. tier: project — PR 9 of 10 for inline simulation PR checks (TEST-141). This is a fix to promotion, independent of the check stack (cut from
main), and the promotion gate (PR 10) depends on it..vapi-state.*.json, but the failed transition'spromotionPlanApplyhas already rewritten tracked files in its target org, sogit pull --rebaserefuses with "You have unstaged changes".promotion.ymlwith two or more transitions (dev → staging → prod), and anyone who adds the promotion gate in PR 10, where a failing gate is exactly a mid-run failure.src/promote-cmd.ts:--applyrun truncatestmp/promotion-applied.txt(gitignored);apply.ts, it appends the pathsgit status --porcelain -z --untracked-files=all -- resources/<target>reports (new, modified, deleted and renamed files, by current path). These are read from git, not the plan, because apply's own pull and push can rewrite files the plan didn't name;promotionCommandRun(args, deps = { childRun })gains a test seam..github/workflows/promotion.yml: on a non-success outcome, the commit step::(literal)pathspecs), and commits;git reset --hard HEAD && git clean -fd -- resources, so the failed transition's rewrites are discarded;On success it's unchanged: it commits all of
resources.improvements.md: refactor(engine): extract shared slug + folder helpers into slug-utils #35, RESOLVED. It's numbered after refactor(engine): extract shared slug + folder helpers into slug-utils #33/refactor(push): extract reconcileStateKeyForResource — fold two ensure-fns into one generic helper #34 from the check stack to avoid a collision; renumber if this merges first.Evidence of value
Red/green in a scratch repo.
a → b → c, andcstarts with a trackedassistants/intake.yml.promote --all --applyruns this branch'spromote-cmdwith a fake child runner. Apply intobsucceeds (writing state and one extra file, as apply's pull can). Apply intocwrites state, then fails.promotion.yml, runs withPROMOTION_OUTCOME=failure.main(69c7e83)error: cannot pull with rebase: You have unstaged changes.exit 128origin/mainbase)chore: record promoted Vapi state [skip promotion].vapi-state.b.json/.c.jsonon origin{}/{}(state lost)uuid-b/uuid-c(both recorded)resources/b/assistants/intake.yml,pulled-by-apply.ymlresources/c/assistants/intake.ymlresources/c/assistants/pulled-by-apply.ymlgit cleantmp/promotion-applied.txtafter the run held exactly the tworesources/b/...paths.Tests:
npm testgoes from 355 to 358 passing.Testing plan
tests/promote-cmd.test.ts(3 tests, a real temp git repo, injected child runner):--applyrun starts a fresh record, and a plan-only run leaves it alone;tests/promotion.test.ts(including its end-to-endpromote-cmdspawn) still passes.--allrun.This conflicts with #59 in
src/promote-cmd.ts(#59 moves the connection helpers out). Whichever merges second rebases.Refs TEST-141
🤖 Generated with Claude Code