feat: snapshot-on-push + npm run rollback#21
Merged
dhruva-reddy merged 1 commit intomainfrom May 5, 2026
Merged
Conversation
This was referenced May 1, 2026
Contributor
Author
This was referenced May 1, 2026
fdf7bfb to
c916a21
Compare
05675a0 to
c1d9632
Compare
c916a21 to
34ae2cb
Compare
c1d9632 to
09af67e
Compare
34ae2cb to
9667011
Compare
09af67e to
4b8d8b8
Compare
9667011 to
866b910
Compare
Contributor
Author
Merge activity
|
4b8d8b8 to
2eaf382
Compare
866b910 to
83242f3
Compare
## ELI5 **Problem.** The README documented "rollback" as `git revert + push`. That restores local *content* to a previous git state, but it does **not** restore a known *platform* snapshot — the subsequent push has all the same drift problems, so a "rollback" can clobber unrelated dashboard edits made since the bad deploy. There's also no engine- level record of *what was on the dashboard before the push*, so even in principle you can't put the platform back exactly the way it was. **What this fix does.** Before each PATCH, the engine writes both: - the *outgoing* payload (what we're about to send), AND - the *current platform* payload (what's there right now) to a per-push directory: ``` .vapi-state.<env>.snapshots/<ISO-timestamp>/<resource-type>/<id>.json ``` Snapshots are operator-local (gitignored) and recreated each push. A single timestamped directory pins one push run, so rollback can target an entire push, not individual PATCHes. `npm run rollback -- <env> --to <ISO-timestamp>` re-applies each `platform` payload from the snapshot as a PATCH. `--list` prints all available timestamps. **Outcome you'll notice.** Real undo. After a bad push, run `npm run rollback -- <env> --list` to see your snapshots, pick the one from before the bad push, and `--to <timestamp>` puts the dashboard back to that state. No more "I hope `git revert` does what I want." --- Real undo. Before each PATCH, write the *outgoing* (local) payload AND the *current platform* payload to a per-push directory. `npm run rollback -- <env> --to <ISO-timestamp>` re-applies each platform payload as a PATCH, restoring the dashboard to its state at the moment of the snapshot. Snapshots are operator-local state (.vapi-state.<env>.snapshots/), gitignored, and recreated on every push. Each push pins one timestamped directory so rollback can target an entire push, not individual PATCHes. Files: - src/snapshot.ts (NEW): writeSnapshot, listSnapshotTimestamps, loadSnapshot. Pins a single timestamp per push run (getRunSnapshotDir is idempotent within the process). Reuses sortedKeysReplacer so snapshot files have deterministic key order too. - src/rollback-cmd.ts (NEW): npm run rollback -- <env> --to <timestamp> re-applies each platform payload as a PATCH. --list prints available snapshots. - src/push.ts: writeSnapshot call after drift check passes. Costs one extra GET per resource (acceptable for the safety guarantee — follow- up: plumb drift's GET result through to avoid the duplicate fetch). Snapshot failures don't block the push. - package.json: rollback script. - .gitignore: .vapi-state.*.snapshots/ already covered. - AGENTS.md: document npm run rollback / --list. - tests/snapshot.test.ts: writeSnapshot creates the right path, multi-resource snapshots share a timestamp, listSnapshotTimestamps sorted, loadSnapshot round-trips. Closes improvements.md #3. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
83242f3 to
1672ec0
Compare
dhruva-reddy
added a commit
that referenced
this pull request
May 8, 2026
…ree, name 40-char cap, PATCH semantics, ElevenLabs phoneme model compatibility
Six wiki additions + AGENTS.md and CLAUDE.md routing fix to surface them:
- yaml-conventions.md: 'Working with .vapi-ignore' — recovery flow
('was that not in the .vapi-ignore?'), cardinal rule against
silent edits, anti-pattern of editing .vapi-ignore to suppress
unexpected drift instead of resolving the cause.
- assistants.md: 'Choosing the right pronunciation layer' — symptom
-> layer decision tree (word misheard = transcriber, word
mispronounced = TTS), with diagnostic question and forward/back
cross-links from Transcriber Configuration and Pronunciation
dictionaries (TTS-level) sections.
- assistants.md: 'Assistant top-level name is limited to 1-40
characters' — separate enforcement site from structuredOutput.name,
not surfaced in the public schema reference.
- assistants.md: 'PATCH /assistant/:id semantics: shallow replacement
at the top-level field' — wholesale replacement of object/array
subtrees; safe-append pattern is GET -> mutate -> PATCH; explicit
contrast with assistantOverrides which deep-merges per multilingual.md.
- voice-providers.md: 'Pronunciation dictionary support: per-provider
field shapes' — Cartesia (pronunciationDictId, sonic-3 only),
ElevenLabs (pronunciationDictionaryLocators, dictionaryName upstream
field NOT name), Vapi voices (schema-level support; dashboard UI in
active PRISM-474 rollout; runtime needs call-test verification).
Public-docs out-of-date callout.
- voice-providers.md: 'ElevenLabs phoneme rule model compatibility' —
alias rules universal; phoneme rules silently no-op'd on the default
eleven_turbo_v2_5 and other current models. Customer impact: zero
benefit, zero signal. Workarounds: alias-only authoring or pin to
eleven_flash_v2.
- AGENTS.md + CLAUDE.md: add yaml-conventions.md to the Learnings &
recipes routing table (was missing, making any yaml-conventions.md
content invisible to agents).
Cross-checks performed:
- multilingual.md:148-160 deep-merge claim verified to be about
assistantOverrides, NOT PATCH. No wiki contradiction.
- Customer-name + UUID scrubs clean against all additions.
- Engine state re-verified: candidates that were superseded by recent
main commits (vapi sync scoping by org-scoping/dry-run/drift; non-
transactional pushes by snapshot-on-push #21 + validate #17) were
dropped. Active platform bug PRISM-641 dropped per user instruction.
Skipping code-reviewer per docs-only carve-out in the always-apply
rule. All cross-references manually verified; anchor slugs match
GitHub heading-to-slug conventions.
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.

ELI5
Problem. The README documented "rollback" as
git revert + push.That restores local content to a previous git state, but it does
not restore a known platform snapshot — the subsequent push has
all the same drift problems, so a "rollback" can clobber unrelated
dashboard edits made since the bad deploy. There's also no engine-
level record of what was on the dashboard before the push, so even
in principle you can't put the platform back exactly the way it was.
What this fix does. Before each PATCH, the engine writes both:
to a per-push directory:
Snapshots are operator-local (gitignored) and recreated each push.
A single timestamped directory pins one push run, so rollback can
target an entire push, not individual PATCHes.
npm run rollback -- <env> --to <ISO-timestamp>re-applies eachplatformpayload from the snapshot as a PATCH.--listprints allavailable timestamps.
Outcome you'll notice. Real undo. After a bad push, run
npm run rollback -- <env> --listto see your snapshots, pick theone from before the bad push, and
--to <timestamp>puts thedashboard back to that state. No more "I hope
git revertdoeswhat I want."
Real undo. Before each PATCH, write the outgoing (local) payload AND
the current platform payload to a per-push directory.
npm run rollback -- <env> --to <ISO-timestamp>re-applies each platform payload as aPATCH, restoring the dashboard to its state at the moment of the
snapshot.
Snapshots are operator-local state (.vapi-state..snapshots/),
gitignored, and recreated on every push. Each push pins one timestamped
directory so rollback can target an entire push, not individual PATCHes.
Files:
loadSnapshot. Pins a single timestamp per push run (getRunSnapshotDir
is idempotent within the process). Reuses sortedKeysReplacer so
snapshot files have deterministic key order too.
re-applies each platform payload as a PATCH. --list prints available
snapshots.
extra GET per resource (acceptable for the safety guarantee — follow-
up: plumb drift's GET result through to avoid the duplicate fetch).
Snapshot failures don't block the push.
multi-resource snapshots share a timestamp, listSnapshotTimestamps
sorted, loadSnapshot round-trips.
Closes improvements.md #3.
🤖 Generated with Claude Code