You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7d143c8
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cleanup): never delete resources matched by .vapi-ignore (#73)
## 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.
- **Problem:** `npm run cleanup -- <org> --force --confirm <org>` deletes every platform resource that isn't in `.vapi-state.<org>.json`. That included resources matched by `resources/<org>/.vapi-ignore`, which is how users tell this repo "don't manage these". `push` already 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.md` #36).
- **Who it affects:** anyone who runs cleanup in an org that also holds resources managed outside this repo (dashboard-owned assistants, legacy tools, another team's squad).
- **What changes:**
- Cleanup loads `.vapi-ignore` and checks each orphan against it, using the file IDs `pull` would give it (`<slug>-<uuid8>`, and the bare slug), so a pattern written against your files matches the platform resource too.
- Matched resources are listed as `🚫 <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.example` say that neither push nor cleanup touches ignored resources. `improvements.md` #36 is marked resolved.
## Evidence of value
New `tests/cleanup-ignore.test.ts` runs the real `src/cleanup.ts` against a stub API holding a tracked assistant, an ignored assistant (`assistants/legacy-*`), an ignored tool (`tools/legacy-*`) and one genuine orphan.
| Run | Before this PR | After |
| --- | --- | --- |
| Destructive cleanup: DELETE requests | 3 — the orphan **plus the ignored assistant and tool** | 1 — the orphan only |
| Dry run output | Lists the ignored resources as "would delete" | Lists them as retained, naming the matching pattern |
The test was run against the old `cleanup.ts` first and failed on the extra deletes, then passed with the fix.
## Testing plan
- `npm test` and `npx tsc --noEmit` pass.
- **Not tested:** a live cleanup against a real org. The stub mirrors the list and delete endpoints cleanup calls; no live run was needed to show the bug or the fix.
Refs TEST-141
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: improvements.md
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ you which stack PR closes the row.**
87
87
| 33 |`npm run sim` reported every run as passed | A failing suite exited 0 — false green | None | RESOLVED 2026-10-01 |
88
88
| 34 | No pre-merge simulation signal; simulations only tested what was deployed | A PR that breaks an agent merges green |#33| RESOLVED 2026-10-01 |
89
89
| 35 | A failed promotion pushed nothing, not even state | git lost track of resources already on the platform | None | RESOLVED 2026-10-01 |
90
-
| 36 |`cleanup` deletes resources excluded by `.vapi-ignore`| A destructive cleanup can delete resources another team owns | None |Open |
90
+
| 36 |`cleanup` deletes resources excluded by `.vapi-ignore`| A destructive cleanup can delete resources another team owns | None |RESOLVED 2026-10-03|
91
91
92
92
**Active backlog after cleanup:**`#2`, `#6`, `#8`, `#12`, `#20`, `#24–#26`, `#31`, and the open remainder of `#27` (wiring the listing-completeness verdict into push/delete/audit, and moving `cleanup.ts` onto the shared pager). Resolved entries stay in this file as historical incident notes per the maintenance directive; stale superseded backlog rows are not duplicated.
93
93
@@ -1888,6 +1888,8 @@ None needed once the fix below lands.
1888
1888
1889
1889
## 36. `cleanup` deletes resources excluded by `.vapi-ignore`
1890
1890
1891
+
**[RESOLVED 2026-10-03]**
1892
+
1891
1893
**Discovered:** 2026-10-03, while reviewing the agent instructions for the public release.
1892
1894
1893
1895
### Problem
@@ -1914,19 +1916,20 @@ another team deletes that team's assistants, tools or squads.
1914
1916
1915
1917
### Current mitigation
1916
1918
1917
-
The default run is a dry run, and the destructive run needs `--confirm <org>`.
1918
-
The docs and `AGENTS.md` now tell people and agents to check the dry-run list
1919
-
against `.vapi-ignore` first.
1919
+
None needed once the fix below lands.
1920
1920
1921
-
### Possible fix
1921
+
### Possible fix (landed)
1922
1922
1923
-
Load the org's ignore patterns in `cleanup.ts` and exclude matches from the
1924
-
deletion list (printing them as retained, as push does), with a test that a
1925
-
destructive cleanup keeps an ignored resource.
1923
+
`src/cleanup.ts` loads the org's ignore patterns and keeps every orphan that
1924
+
matches one, checking the IDs pull would give the resource (its name slug,
1925
+
with and without the UUID suffix). Kept resources are listed as retained.
1926
+
`tests/cleanup-ignore.test.ts` runs a destructive cleanup against a stub API:
1927
+
before the fix it deleted an ignored assistant and tool along with the true
0 commit comments