fix(cli): sweep leftover e2e projects by logicalId instead of name [RED-740] [ship] - #1461
Merged
Conversation
…740] The untargeted sweep in deploy.spec.ts runs inside beforeAll/afterAll hooks, which get Vitest's 10s default timeout and abort from outside any catch. Before making the sweep actually delete anything (its predicate is still dead code — flipped in the next commit), make it safe to run: - Never fail the suite: the whole sweep and each individual delete are wrapped in try/catch that warns and moves on. - Bound each delete by a 60s sweep-wide budget via Promise.race: deleteProject streams an async deletion to completion with no request timeout, so a single slow delete could otherwise outlive the hook timeout. Remaining candidates are counted and reclaimed by later runs. - Log reclaimed projects and a per-sweep summary (scanned / matched / deleted), and warn on prefix-matched projects with unparseable created_at — an Invalid DateTime compares false silently, which would re-create the silent-dead-sweep failure mode this ticket is about. - Set hookTimeout: 120_000 in vitest.config.e2e.mts: every e2e hook is network-bound (the targeted afterEach delete also streams an async deletion), and the suite-level timeout option covers tests only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ED-740]
The 'e2e-test-deploy-project-' prefix is the logicalId prefix —
deploy.spec.ts generates projectLogicalId = `e2e-test-deploy-project-
${uuidv4()}` while the fixture's projectName is hardcoded 'Deploy
Project' — so matching on project.name has never been true and the
untargeted sweep has never deleted anything. Orphaned projects from
crashed e2e runs (e.g. CI timeouts between beforeEach and afterEach)
accumulated in the shared test account indefinitely; 144 were found
when this was discovered.
The 20-minute age guard is unchanged: it is what keeps the sweep safe
against concurrent CI shards, since a live test project only exists for
the duration of a single test.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Linear: RED-740
The untargeted leftover-project sweep in
deploy.spec.ts(the no-argumentcleanupProjects()run inbeforeAll/afterAll) has never deleted anything: it matchedproject.nameagainst'e2e-test-deploy-project-', but that string is the logicalId prefix — the fixture's name is always'Deploy Project', so the predicate was always false. Every e2e run that died betweenbeforeEachandafterEach(e.g. a CI timeout) leaked a project into the shared test account; 144 orphans had accumulated when this was discovered.The flip is deliberately the second of two commits, because it turns dead code into real network deletes inside hooks that run on Vitest's 10s default timeout with no failure tolerance:
test(cli): harden the sweep while its delete path is still dead code.rest/apiinterceptors, so errors stay rawAxiosErrors —deleteProject'sConflictError-based wait-for-predecessor loop (30-minute deadline) cannot engage here, and a concurrent shard's 409 fails fast into the sweep's catch.deleteProjectstreams an async deletion to completion with no request timeout, and a hook timeout aborts from outside any catch, so a backlog drain must self-limit. Remaining candidates are counted and reclaimed by later runs.scanned / matched / deletedsummary line (an empty account must be distinguishable from a silently dead sweep — silence is how this went unnoticed), and a prefix-matched project with an unparseablecreated_atwarns loudly instead of being silently skipped by an Invalid DateTime comparison.hookTimeout: 120_000invitest.config.e2e.mts: every e2e hook is network-bound (the targetedafterEachdelete also streams an async deletion), and the suite-leveltimeoutoption covers tests only.fix(cli): the one-lineproject.name→project.logicalIdpredicate flip.The 20-minute age guard is unchanged — it is what keeps the sweep safe against concurrent CI shards, since a live test project only exists for the duration of a single test (all deployed e2e projects use uuid-derived logicalIds).
The orphan backlog was purged manually when the ticket was filed, so the sweep faces only steady-state leakage (~1 project per crashed run). Its summary log line makes it observable in the e2e job output.
🤖 Generated with Claude Code