Repository navigation
fix(platform): delete task subtrees beyond depth 32 - #4226
Conversation
yannickmonney
left a comment
There was a problem hiding this comment.
ACCEPT — independent review of PR #4226
Reviewed head: e17a711b2392c5c44d6df5e3b15d48b9879aabae (base 9b7463b707c5e44349f0a8c51e764a39e3e5c4fb). Initial requested head 6656c47c919b77744ed5b34f748422cf86e6340d was verified at the start; the author advanced it before posting, so I reviewed the delta and refreshed exact-head proof. The delta only allows an exclusive file row already reclaimed by the release worker; knowledge/release.ts explicitly reaps trashed, unbound metadata after reclaim. The deletion implementation is unchanged.
Reviewer: Codex #6, agent 8c78cac9-4b65-4630-b901-0a52f2317ff3, task TALE-555, run eecf393e-bdf6-4930-a367-8ed8ba39fc77; distinct from implementation agent 7a7d20b9-15bf-4d0c-99bf-33e6e841a76c / run 72dfd794-0693-494a-a236-d147ddeb8052. The GitHub principal is shared with the author, so this is an independent ACCEPT receipt, not an attempt to bypass GitHub's self-approval restriction or native task-review gates.
No blocking correctness findings against TALE-134 / #3588:
- Stable-row recursive UNION removes the depth cutoff, terminates cycles and counts each task once. Recursive edges are scoped to the authorized organization/project; accepted parent links already enforce the same scope.
- All selected tasks still use the existing transactional retirement seam: discussions/messages, agent cancellation provenance, automation cancellation, pending review withdrawal, and durable blob-reference release. Counts/rollups/audit include done and archived descendants without promoting a surviving root.
- No new migration is needed or included. The regression is registered in the real-Postgres backend lane and manual automation register; the integration-scope guard passes.
- The traversal is SQL recursion rather than recursive JavaScript, the parent FK has an index, and retirement binds ID arrays through ANY rather than one placeholder per task. Lock acquisition remains the existing single-project retirement order with serializable retry. Local deep/wide probes found no size, timeout or count problem at 5,000 tasks; this is bounded evidence, not a claim about unlimited tree sizes.
Independent observed proof:
- Owned throwaway database
tale555_review, Postgres 15.18,127.0.0.1:55455; locally extracted binaries, no container/stack. Exact-headcheckTaskSubtreeDeletion: all 4 checks pass under Bun and the production Node loader. Proves 35 accepted tasks, count 34, no orphan, correct rollups/audit, deep resource retirement, shared-ref preservation, cycle deduplication and leaf count zero. - Negative control using the base service and the same regression: 3 failures / 1 pass. It reports count 32, leaves two descendants with a promoted root, keeps deep discussion/run/review/files, and overcounts a cyclic tree (43 rather than 3).
- Deep chains and wide trees at 1,000 and 5,000 tasks: all four delete fully with exact counts, no remaining rows, zero rollups and a 5-second per-statement ceiling. Measured deletion times: deep 1,000 = 1.447s; deep 5,000 = 2.338s; wide 1,000 = 0.624s; wide 5,000 = 3.767s. Scale probes bulk-seed valid rows; the registered regression separately uses createTask for the full 35-task chain.
- Exact-head targeted server suite: 15 files / 145 tests pass, one worker (task service suites, retirement, project deletion and integration-scope guard). Scoped formatting and oxlint on the 3 changed TS files pass; diff whitespace check passes.
Scoped TypeScript also passes with zero diagnostics: only the 3 changed TS roots, their imports and the repository's existing PDF-worker ambient declaration, with a 2304 MiB heap cap. The first scoped attempt omitted that declaration and reported TS7016; including the normal repo declaration resolves the harness omission without source changes.
Unrun/limits: no whole platform suite, whole-workspace typecheck, browser, E2E, container, production test, actual agent host, external provider or object-store-byte reclaim. Cancellation fixtures are queued/waiting; durable release enqueue and the worker's metadata behavior are proven/inspected, not live blob destruction. No high-contention concurrency stress or unbounded-tree benchmark. Hosted CI is still pending; acceptance is not a green-CI, merge, deployment or native task-completion receipt. No push, merge, card movement or CI rerun/cancellation.
|
Updated with
|
Summary
Closes #3588. Implements TALE-134.
Keep unrestricted human-created nesting: imposing a new creation limit would
not repair already-existing deep hierarchies and would change the product contract.
UNIONover stable task columns, without a depth counter, socorrupt cycles terminate and each retired task is counted once. Keep the walk
inside the authorized organization/project.
pending reviews and durable blob-reference release, plus project rollups and audit counts.
checkTaskSubtreeDeletionlane to backend integrationand document its ownership in the manual automation register.
Verification
Exact head:
e17a711b2392c5c44d6df5e3b15d48b9879aabae.Base:
9b7463b707c5e44349f0a8c51e764a39e3e5c4fb.tale134_subtreeon local Postgres 15.18 (
127.0.0.1:55434): count 32, two surviving descendants,one promoted root, deep discussion/runs/review/files untouched; 3 failing checks.
real Postgres passes all 4 checks under both Bun and the production Node loader.
It creates all 35 tasks through
createTask, includes done/archived descendants,and proves count 34, no orphan, correct rollups/audit, discussion/message removal,
agent cancellation provenance, automation cancellation, review withdrawal,
exclusive file trash/release queueing and shared-ref preservation. Cyclic branches
terminate/count once; leaf deletion reports zero children.
final-head total 31 files / 601 server tests. These cover
agent-metadata.test.ts,comments.review.test.ts,delegated-start.budget.test.tsandexternal-ref.test.ts, also with one worker.with a 2304 MiB heap cap. Type-aware oxlint on those files: exit 0. Scoped format
check, manual-layer gate (5 trees / 1442 boxes), diff/conflict and commit hooks pass.
whole-workspace typecheck. No real agent host or object-store bytes were started:
run fixtures are queued/waiting and blob reclamation is verified as a durable job.
Review handoff
The full CI harness runs the existing release worker. The file assertion
accepts both valid retirement states (trashed or already reaped), rather than
racing a post-commit transient row. Active exclusive files still fail the check,
and the durable release job plus shared-ref preservation remain required.
The production fix is unchanged by this test-only hardening commit.
Implementation run:
72dfd794-0693-494a-a236-d147ddeb8052.Independent exact-head review is requested through TALE-359; no author acceptance,
merge, task-status movement or CI rerun/cancellation is performed.