fix(cleanup): never delete resources matched by .vapi-ignore - #73
Open
scott-lowe-vapi wants to merge 1 commit into
Open
scott-lowe-vapi wants to merge 1 commit into
scott-lowe-vapi wants to merge 1 commit into
Conversation
.vapi-ignore marks platform resources a repository must not manage, and pull never writes them to state. cleanup treats every platform resource missing from state as an orphan and didn't read .vapi-ignore, so a destructive cleanup deleted exactly the resources a team had excluded, such as another team's assistants in a shared org. Push already orphan-protects them. cleanup now loads the org's ignore patterns and keeps every orphan that matches, checking the IDs pull would give the resource (its name slug, with and without the UUID suffix). Kept resources are listed as retained in both dry and destructive runs. tests/cleanup-ignore.test.ts runs the real cleanup command against a stub API: before this change a destructive run deleted an ignored assistant and tool along with the true orphan; now only the orphan. Docs: AGENTS.md, the workflows guide and .vapi-ignore.example describe the fixed behaviour; improvements.md #36 is resolved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 3, 2026
Contributor
Author
This was referenced Oct 3, 2026
scott-lowe-vapi
marked this pull request as ready for review
October 3, 2026 07:20
This was referenced Oct 3, 2026
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: small — a behavior change in a destructive command (
npm run cleanup). Not micro: it changes what the command deletes.npm run cleanup -- <org> --force --confirm <org>deletes every platform resource that isn't in.vapi-state.<org>.json. That included resources matched byresources/<org>/.vapi-ignore, which is how users tell this repo "don't manage these".pushalready respected the ignore file; cleanup didn't. So the file you write to protect a resource was the one way to get it deleted (improvements.mdrefactor(push): extract reconcileStateKeyForResource — fold two ensure-fns into one generic helper #36)..vapi-ignoreand checks each orphan against it, using the file IDspullwould give it (<slug>-<uuid8>, and the bare slug), so a pattern written against your files matches the platform resource too.🚫 <name> retained (matched .vapi-ignore: <pattern>)and never deleted, in dry runs and destructive runs. The summary counts them.AGENTS.md, the workflows guide and.vapi-ignore.examplesay that neither push nor cleanup touches ignored resources.improvements.mdrefactor(push): extract reconcileStateKeyForResource — fold two ensure-fns into one generic helper #36 is marked resolved.Evidence of value
New
tests/cleanup-ignore.test.tsruns the realsrc/cleanup.tsagainst a stub API holding a tracked assistant, an ignored assistant (assistants/legacy-*), an ignored tool (tools/legacy-*) and one genuine orphan.The test was run against the old
cleanup.tsfirst and failed on the extra deletes, then passed with the fix.Testing plan
npm testandnpx tsc --noEmitpass.Refs TEST-141
🤖 Generated with Claude Code