Skip to content

feat(doop): purge route wiring and end-to-end tests (CHE-9646) [squash] - #170

Merged
congvc-dev merged 3 commits into
cheese/mainfrom
agent/tofu/che-9646-6ebb9d2e220b
Nov 30, 2026
Merged

congvc-dev merged 3 commits into
cheese/mainfrom
agent/tofu/che-9646-6ebb9d2e220b

Conversation

@congvc-bot-x99

Copy link
Copy Markdown

What

Stage 3 of CHE-9399 ("delete forever"), issue CHE-9646.

  1. POST /api/frames/:id/purge, body {deletedAt:number}, REST only (server/index.ts).
  2. server/framePurge.ts: settles the frame's writers, runs purgeTrashedFrame, and ends the lease on a known outcome only. It is the only server file that names purgeTrashedFrame and resolvePurgeOutcome.
  3. tests/framePurge.test.ts: T1–T9, T11, T12 (a, b, d, e), T14 (a–f).
  4. .context/TECHSTACK.md: soft-delete bullet names the purge route, its guards and the comment refusal (pointer to CHE-9450).

No migration, no schema change, no release, no C00 deploy. The persist.ts delete count stays 3 and frameTrashPersist ALLOWED already lists server/db/purge.ts.

Reply map

Case Reply
purged 200 {ok:true}
no canvas 404
not editor 403 (checked before a live frame's existence is shown)
frame not in Trash 409 not_in_trash
deletedAt missing / not a number 400
deletedAt differs from Trash 409 stale_confirmation + current deletedAt
comment on the frame 409 has_comments (memory and database)
another purge open 409 purge_in_progress
component main frame 409 component_main
writers still in flight 503 purge_timeout
COMMIT reply lost, probe says committed 200
COMMIT reply lost, probe says rolled back 409 purge_not_applied
COMMIT reply lost, probe unanswered after 10 s 503 purge_outcome_unknown; lease kept, probe finishes it

Every refusal and timeout leaves all rows.

Proof

Test-first: the test file was written before the route.

Red (route absent), npx vitest run tests/framePurge.test.ts:

 Test Files  1 failed (1)
      Tests  29 failed | 3 passed (32)
AssertionError: expected 404 to be 200 // Object.is equality
AssertionError: expected 404 to be 409 // Object.is equality

Green on the committed head 35dbdd76, same command (PGlite):

 Test Files  1 passed (1)
      Tests  32 passed | 4 skipped (36)

Green on real PostgreSQL (postgres:16-alpine, DOOP_TEST_PG_URL set; the 4 skipped are the lock-ordering tests e2, e3, e4, e2r that need it):

 Test Files  1 passed (1)
      Tests  36 passed (36)

Related suites on PostgreSQL (framePurgePg, framePurgeLease, framePurgeFence, frameTrashPersist, frameTrash):

 Test Files  5 passed (5)
      Tests  84 passed (84)

bun run typecheck, bun run lint, bun run build: pass (gstack-checks run).

Not run, and deviations

  1. Full bun run test did not finish in my 580 s limit locally. CI is the full-suite proof.
  2. The gstack tests lane runs files under bun test, which has no vi.hoisted; it fails on every vitest file (91 of 168). Runner mismatch, not this change.
  3. PGlite has a single connection and cannot hold a real in-flight write. A beforeSettle hook stands in for the held write (T4, T5, T11). T11's held Trash-marker write is approximated the same way.
  4. T12a/b lost-ack is simulated by wrapping purgeTrashedFrame and resolvePurgeOutcome; the transaction really commits, or never runs.
  5. "Restart agrees" (T12e) asserts the rows a restart would read, not a child-process reboot. There is no tests/framePurgeReboot.test.ts.
  6. The role check runs before the existence of a live frame is shown (stricter than plan step 4 order).
  7. T14 e2–e4 need DOOP_TEST_PG_URL; they skip without it.

Review gate

Draft. Needs a cross-lab PASS on the exact head, green required checks, and a non-author merge.

congvc-bot[bot] added 3 commits November 27, 2026 04:55
Add POST /api/frames/:id/purge (REST only, body {deletedAt}) and
server/framePurge.ts, the only caller of purgeTrashedFrame and
resolvePurgeOutcome. Every refusal and timeout leaves all rows; an outcome
the database has not confirmed keeps the lease until the probe answers.
tests/framePurge.test.ts covers T1-T9, T11, T12, T14 (PG-only lock
orderings run when DOOP_TEST_PG_URL is set). TECHSTACK soft-delete bullet
names the route, its guards and the comment refusal (CHE-9450).
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review November 27, 2026 02:40
@congvc-dev
congvc-dev merged commit c7976a5 into cheese/main Nov 30, 2026
12 checks passed
@congvc-dev
congvc-dev deleted the agent/tofu/che-9646-6ebb9d2e220b branch November 30, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant