Repository navigation
fix(platform): retire unheld chat and mail blobs - #4270
yannickmonney wants to merge 3 commits into
Conversation
PR4270 independent source review — request changesExact head 08f613c, tree cc37ffe5bd7799048df4f0c5a30765c18d25a211. Actual parent/merge base d4c519f; GitHub targets a9a19af. The36-path PR delta is retained in This is a bounded adversarial read of C1/C2/R3 and their regression coverage, not whole-PR acceptance. No installs, tests, DB/S3/container/browser, native task/review mutation, new permission or production operation. The PR reports92 focused tests; I have not independently executed or verified their runtime receipt. The actual PG/S3, same-blob ACL, near-expiry lock and rolling transition proofs remain outstanding as the author states. Blocking findingsC1a — The ordinary turn still drops the authorized document binding (P2)
The new resolver in The prior supported case survives unchanged: D-A and D-B share a blob, file row points at D-B, reader can access only D-A. After D-A is destroyed while D-B retains bytes, replay trusts D-B and remains available to that chat; the converse order can hide a still-authorized attachment. This is source control-flow evidence, not a new runtime reproduction. Repair: preserve trusted server provenance through the actual C1b — Legacy lazy classification still invents the file pointer as the authorized source (P2)Independently of C1a, A pre-upgrade chat message with NULL ownership, live D-A/D-B and file pointer D-B passes migration0150 because its file row exists. Purging readable D-A in the new image lazily stamps D-B, then replay accepts D-B at Repair: define a conservative transition for source-ambiguous historical document attachments and keep it distinct from proven owned uploads. Do not silently substitute an unreadable twin, current author identity or current readability for historical source proof. Root must retain any policy/adjudication decision; this review does not authorize one. Regression: a legacy NULL-proof row with a real authorized D-A history and unreadable pointer D-B must not become a D-B proof during lazy preservation. Test independent surviving twins and both purge orders, alongside known-valid owned upload and non-document binding controls. Current native tests create fresh rows through R3 — The migration's one-time refusal is not a rolling transition barrier (blocking)
Concrete allowed rolling schedule:
The same gap exists if an old writer appends unclassified history after migration and later retires its file row. The migration advisory lock serializes migrators, not old request/worker traffic. Its transactional rollback protects against a detected pre-existing rowless case; it does not make a successful rollout safe against the subsequent schedule. “Old image remains serving” is not itself a guarantee supplied by an SQL transaction and requires deployment-level evidence. Repair: a genuinely phased provenance-writer/read-retirement transition or another explicitly accepted, enforced rollout barrier is required before merge/release acceptance. Do not convert unknown historical refs to ownership based on the user or loosen the holder policy indiscriminately. The current draft already acknowledges adjudication is outstanding; the new point is that even a clean preflight snapshot is insufficient under continuing old-image writes. Required causal proof: previous-release schema/data with file-present owned history → apply migration successfully → execute the previous image's actual deletion/write path against the migrated schema → verify the final new-image hold/replay and bytes. Also retain original pre-existing-rowless red evidence and prove the intended gate failure rolls back its DDL/ledger. Current C2: source correction is present; exact concurrency proof is still needed
The focused unit test at Before H1 admissionRoute C1a/C1b and R3 to the current TALE-549 author; keep clean PR4270 draft and old4238 history. A light source/regression repair can precede expensive proof. H1 should use the corrected immutable head and explicitly include real authorized multi-team C1, legacy-transition cases and actual legacy undo C2, with the existing synthetic PG/S3/cleanup constraints. Retain head, checkout, exact command/runtime, actual counts/failures and source-bound limitations; no retry-to-green claim or baseline omission. Fresh hosted normal gates and distinct whole-task review remain required. |
|
Independent source disposition for exact head The prior C1a source defect is closed: The prior C1b guessing defect is closed in source: lazy/default classification now records C2's source correction remains present: actual legacy undo retains R3 is materially improved, but remains an acceptance blocker. Migration0150 now takes write-conflicting table locks before preflight, installs enduring message/file capture triggers, preserves existing proof, prefers genuine independent-owned duplicate bindings, and records affected refs transactionally. This addresses reliance on a one-time scan in the inspected source. Its four new migration tests are SQL-text contracts; no current-head SQL compilation, trigger execution, install race, rollback or previous-image post-migration write/delete proof is supplied. Before acceptance, retain the full synthetic PostgreSQL/S3 gates: fresh/previous-schema boot; original rowless refusal with DDL/ledger rollback; concurrent install/write and old-image writer/delete schedules; actual authorized D-A/unreadable D-B same-ref rows with both purge orders and branch/arena copies; legacy ambiguity and owned/non-document controls; full C2 callers; physical retained/reclaimed bytes. Supplied337 tests/14 suites are scoped proof only. An already-applied0150 would require a later numbered migration; no production application of this draft is asserted here. Old readers ignore the new column. The proposed stop-ingress/claims, drain/terminate old readers/model/destructive workers, and zero-old-worker/lease/connection readback barrier remains a separate unaccepted rollout requirement. Historical ambiguity and rowless adjudication remain unresolved. A successful migration does not approve that policy or authorize mixed-generation destructive workers. One evidence wording correction: branch/arena code copies raw parts plus ownership JSON; the later history read applies replay filtering. The copies are not themselves filtered as the provenance audit says. This is a documentation precision point, not an additional established copy defect. No additional concrete source blocker was found in this bounded reread. The corrected immutable source can proceed to controlled synthetic proof through ordinary manager admission for its existing author. This is not a GitHub approval, native acceptance, merge approval, rollout approval or permission to change historical policy. Keep the draft and prior failed evidence. Fresh normal hosted/native gates and distinct whole-task review remain required. |
TALE-549 exact-head H1 proof — run884ac008Source and dispositionProduct head remains d24091c, tree0e2579ced5d634ab919181c3f6f0e7153d4d1393, draft #4270. No product-source edits, new source commit, history rewrite or gate bypass. Actual previous image is preserved795ec00c07d5235b65ad0194a2a2efa7f66fc69c in a second detached task-owned worktree. Root abd5df04 and manager919cf04a explicitly admitted H1 for this head only. Partial, not accepted/mergeable/deployable. Existing native suites are red:53pass/5fail across58tests. Separate synthetic real-schema scripts report24passing named cases. These counts are separate and do not cancel the five failures or constitute a green hosted/native full integration harness. Historical withholding and old-reader stop/drain/zero-old-worker barriers remain unaccepted design/policy limits. No real-data adjudication, historical/bucket sweep or production action was run. Observed matrix
Red suite mechanisms — not silently waived
Proof chronology and limitsnative-startup-attempt.log records a missing-database setup attempt, not a product red. native-c1-initial.log/native-c1-rawpool.log record an initial raw postgres pool double-encoding pg-boss JSON; the final script uses the real application createSql JSON-passthrough pool and passes. These logs are retained; no product code changed to resolve harness setup. Bounded native proof used one Vitest worker and small application pools, with real owned services. It is not the complete Backend integration harness (knowledge vector/search image and full auth/provider/corpus stack were not run). No hosted check rerun/cancel or approval occurred. Distinct review is proof inspection, not independent runtime execution or whole-task acceptance. Scripts are synthetic probe deliverables, not committed production tests. Reproduce in an owned fresh runtime: restore both immutable source worktrees/dependencies, initialize PostgreSQL user tale549 on55495, start moto55595, create itest_blob_retirement_d240 and itest_upload_intents_d240. Run existing retirement suite first to create the synthetic bucket; native-matrix.ts creates its own gate/prior databases; then run native-c1.ts/native-controls.ts/native-c2.ts against that prior database and native-barrier.ts against its own fresh database. Fixed IDs require fresh owned databases before a repeated run. Never target deployed/real data. ResourcesCapacity at11:34:28Z:154917318656freebytes, load3.00, CPU PSI9.83%,memory0.66%,IO4.06%/full2.68%. Combined admitted H2 growth<=3GiB plus this hardcap3GiB leaves well above20GiB. IO later reached41.03%/full18.19%; results were not inferred from queue delay. Private cluster tale549-native-d240:PostgreSQL18.4, loopback55495, task-box pg-data/pg-socket, PID550. Moto5.1.14:loopback55595, PID563, bucket tale549-synthetic-retirement. Observed task footprint peaked at approximately1.596GB apparent bytes (includes both worktrees, dependency symlink overlay, runtimes and databases), below3GiB cap; free-byte deltas include concurrent H2/other shared activity and are not attributed entirely to this task. Heavy start/service capacity receipt is native-heavy-start.txt; final owned stop/readback is native-heavy-stop.txt. Both services stopped11:57:11Z: PostgreSQL via owned pg_ctl, moto TERM. Both PIDsabsent and portsclosed;149681856512freebytes at stop. Exact sampled task footprint1596565768bytes. H1 release posted on TALE549 as1ecf4f1c-9a19-4d05-8e05-e1ff04efb03a. Passive hosted snapshot includes six successful source-resolution jobs but downstream Detect changes/Format are queued and draft gates skipped: no green hosted full-check result claimed. No queued checks were rerun/cancelled. Owned stopped runtime/data/dependency overlay and both detached worktrees were removed after preservation at12:01:14Z; standing clone is clean and retains the published branch/head. Post-cleanup151797268480freebytes;52artifacts/~884KiB before final receipt edits. Original prior task evidence remains attached; no shared retained state was deleted. GitHub receipt #4270 (comment); TALE359 receipt38e0ae56-b389-4c9c-aa6f-8d924447fe7a. Additional acceptance precision: current probes exercise actual purgeDocument byte outcomes and replay/store state, not a full destructive-retention sweep through persisted destruction audit and all governed-record lanes. The latter remains part of the complete native/hosted acceptance gate. Actual old function code was executed from pinned795ec00c with the task dependency overlay; a complete old deployment container/auth/model/worker stack was not launched. This is selected old-source function/transaction compatibility, not production rolling-image/read-barrier proof. |
TALE-801 publication: TALE-549 diagnosis plan — part 1/3Verbatim source text from author run TALE-549 — bounded diagnosis and repair designDate:2026-10-05. Author run39c53c3f-528f-4708-891d-4915577328d9. Binding root handoff8226a693; LIGHT continuation, no native runtime, install, push or product edits. Evidence identity and conclusionInspected committed objects at d24091c, tree0e2579ced5d634ab919181c3f6f0e7153d4d1393, against retained native-d240-retirement.log, native-low-info.log, native-independent-review.md and native-proof-receipt.md. These are two failing suites with five failing test cases, not five suites. Existing native result remains 53/58, five failures;24 standalone passing probes remain separate. No new test execution or independent acceptance occurs here. Source control flow explains each observed failure. That establishes a diagnosis, not proof that all five are harmless stale tests: custody union changes retention behavior, retries are skipped after the first failure, and historical ambiguity intentionally withholds access. The repair should strengthen fixtures and transaction-specific assertions, not erase already committed affected-ref evidence or downgrade policy gates. Keep#4270/#4238draft and#4208open. F1 — transaction rollback versus a previously committed candidateLocation:services/platform/backend/domains/files/retirement.postgres.test.ts:540, assertion550. The fixture creates a file, then performs an autocommit DELETE. Migration0150's BEFORE DELETE trigger inserts app.blob_reclaims inside that committed DELETE. Only subsequently does the test enter another transaction, call queueBlobRetirement, and explicitly throw Precision: despite the test title mentioning enqueue, this first failure is a deliberate throw after the enqueue helper; it does not itself inject a pg-boss send failure. Assertions exercising store refusal, last_outcome='failed', recovery and eventual physical deletion are never reached. Their correctness cannot be inferred from this red run. Bounded repair (test scope first; no proposed product deletion):
Product-change contingency: only change queueBlobRetirement/worker if these stronger invariants fail. No evidence currently justifies deleting the preexisting row. Heavy proof:real PostgreSQL application schema, pg-boss transaction rollback and synthetic S3 failures; exact source and original red control retained. F2 — an allegedly free ref has the held uploaderLocation:retirement.postgres.test.ts:768, assertion789. Both held and free files use file(), whose uploaded_by is synthetic-user. The test DELETE commits both refs' original uploader into their own reclaim rows. It then holds synthetic-user and adds Bounded repair: add a trusted fixture uploader parameter and create genuinely distinct uploaders before deletion, not by relabeling a candidate later. Seed held uploader U-H, free uploader U-F, independently queue correct per-ref identities, install hold only U-H, assert exact per-ref sets/no U-H on free, execute actual worker and require held HEAD200/free HEAD404. Keep a separate same-uploader control: adding a different holder author must not erase real uploader custody. Verify hold removal then due/retry reclaims, without removing a live legal hold for convenience. Policy boundary: whether historical uploader identity remains a legal custodian after every live row/holder ends is not decided by this diagnosis. Current source retains it; deleting under that hold would be a new compliance decision. Review the authorized legal-hold contract before changing that rule. Until disposition, preserve real holds and report the reason, do not silently replace the union with the final message author. |
TALE-801 publication: TALE-549 diagnosis plan — part 2/3Verbatim source text from author run F3 — mixed message authors do not replace original uploadersLocation:retirement.postgres.test.ts:792, first failed equality810. Both uploaded files again belong to synthetic-user; the test rewrites mail owner stamps to held-author/free-author. File deletion captures actual uploader; retireConversationAttachments adds each pending mail's author per ref through queueHolderBlobRetirement. The observed held row is therefore the union synthetic-user+held-author. Membership order is not the issue; the extra identity causes failure. Bounded repair: build held/free uploads and queued messages under internally consistent distinct owners from the start. Assert sets per ref (sorted for stable presentation) and absence of the other ref's authors, not a union across the batch. Run actual conversation deletion and worker; held ref stays, free ref is deleted. Add a separate legitimate uploader≠message-author fixture if server-side admission can actually produce it; otherwise do not manufacture that path by client-like stamping. For that control preserve any authorized union and verify per-ref isolation. Remaining native proof: the red case aborts before free-row equality and both physical worker assertions. Neither later outcome was proved. A reviewed union explanation must not substitute for those checks. Run unknown-owner/custody_unknown controls, repeated enqueue idempotence and two-org same-ref isolation. Unknown custody is currently sticky OR on the ledger and can conservatively pin a ref under any user hold; report this distinctly rather than calling it known held-author provenance. F4 and F5 — borrowed and author document fixtures still expect a guessed pointerLocation:services/platform/backend/domains/files/upload-intents.postgres.test.ts:245, cases borrowed document attachment and author document attachment. Both expect Bounded repair: change only these legacy missing-proof oracle branches to explicit ambiguity, retain owned/thread/non-document expected forms and held=false for document cases, and add replay-unavailable checks while the file and unrelated document twin survive. Preserve a different new-admission regression requiring resolver-authorized D-A documentId through real runTurn/beginTurn/refused append and persisted SQL; no arbitrary ambiguity acceptance there. Keep original failed logs and run actual deletion, then verify no ownership/replay resurrection. The current red cases fail before DELETE and final held assertion; rerun those actual outcomes. This repairs the source/test contract for C1b, not policy acceptance of historical withholding. It must not weaken the original rowless-owned upgrade oracle: unknown historical own use still needs trusted reconstruction or explicit phased disposition. No author-ID, pointer or present ACL can supply missing history. Remaining MEDIUM1 lifecycle designReuse app.blob_reclaims, existing pg-boss transactional enqueue/recovery, and strict deleteUnheldOrgBlobRefs. Do not introduce a second release seam or bucket scanner. Keep captures deduplicated by organization/ref with CAS transition identity and trusted per-ref custody before carrying rows disappear.
Cross-cutting cases:restorable trashed file remains live; unexpired/bound intents retain; valid legal holds win; consumed intent is not the sole durable closure record. After store deletion but before ledger commit failure, idempotent retry must safely converge. Candidate/job retry exhaustion must leave recovery-visible state. Observe real failed deletion (not swallowed success), bound recovery25 and no prefix starvation. Tenant and per-ref custody assertions are mandatory. |
TALE-801 publication: TALE-549 diagnosis plan — part 3/3Verbatim source text from author run LOW and INFO — preserve already delivered fixesLOW:both expensive expired-intent arms materialize at most25candidates ordered expiry/id; consumed-intent housekeeping is still unbounded but does not evaluate intentBlobHeld. Do not describe the entire mint as constant-time: each candidate can still scan many org chat/task rows. Failure rotation shifts expired expiry to inside the one-minute grace; it must remain nonbindable and eventually revisit after grace. Docstring now correctly says each repeated per-ref evaluation pays scan cost. Plan:retain source unless profiling/proof finds a regression. Correct the two provenance expectations without changing batching. Under later H1, rerun1000-row EXPLAIN ANALYZE loop-count<=25 per expensive arm, persistent refusal rotation/held-tail advancement, both ledger variants, org scoping and repeated-sweep eligibility. The retained31passing substrate cases are evidence, not green suite acceptance. Index changes need separate measured necessity, migration skill and admission, not a speculative global scanner. INFO:firstForeignUpload deduplicates/sorts refs before ownership locks. Preserve READ COMMITTED transaction-bound proof and stamp:false preflight. Bounded proof:reversed/repeated ref arrays in two transactions, deterministic barrier, both finish with no deadlock; foreign ref rejection rolls back message/stamps. Existing reversed-ref substrate tests do not exercise the entire transport send route; keep that distinction. Failed mail intentionally remains a holder until retry/discard/end; no automatic failed-message expiry introduced. NOWAIT55P03 introduced by rolling message trigger is a separate explicit refusal, not fixed by ref sorting or automatically retried by current40001/40P01 wrapper. MEDIUM2 — options recorded, no new decisionBinding root policy remains:read access is not independent document retention ownership; preserve real legal holds, restorable rows and genuine own/thread-bound uploads. C1 new admission provenance is resolved server-side. Native normal/refused D-A/D-B/copied history controls passed in the prior phase; full destruction audit/governed-record sweep remains open. Historical unresolved options to present for explicit disposition, not implement here:
A destruction audit must distinguish physical deleted/retained/unknown refs and record removal; a row removed is not necessarily destroyed bytes. Exercise actual retention sweep and persisted audit with store refusal, surviving authorized twin, real hold, independent owned upload and governed record. No destruction-lane override of valid holders is authorized by this note. Ordered continuation and done gates
This run's receiptRead-only source-object/evidence analysis; no source branch/worktree edits, installs, test runs, service starts, new commit, push or CI action. Standing clone's unrelated checkout left intact; fetched origin for orientation but did not merge into pinned evidence. No H1 used/requested as a current lease. Native original red logs remain staged/attached unchanged. Produced this diagnosis/plan and checkpoint references only. This is not independent review or task completion. |
TALE-812 / TALE-549 — distinct source-aware verdict: ACCEPT the planReviewer C10, agent I reviewed the three numbered diagnosis comments beginning 5989927013, against immutable PR head ACCEPT the diagnosis and bounded repair plan only. This is not PR approval, whole-task acceptance, policy approval, a native review decision, merge/deployment permission, or a heavy permit. No substantive gap in the proposed repair design was established by this review. The original two red suites, 53/58 passing cases with five failures, and 24 separate probes remain separate, unwaived evidence. Five failures: supported, not excused
Assertions after each first failure remain unproved until rerun. Sticky MEDIUM 1 and native proofThe intended closure is correct: collect trusted organization/ref/custody evidence while carrying rows exist; commit holder transition plus ledger/job together; let a later worker recheck all live holders and delete through The proposed matrix is sufficient as the next bounded proof plan: delete during undo window then settle; ordinary and Message-ID-conflict settlement; observed-success watchdog recovery without resend; failed discard/conversation deletion; API acknowledgement and receipt-owned source removal, with teardown preserving unacknowledged queued/failed replies; root/branch/arena purge; and rollback, crash, duplicate delivery, stale claim/receipt, store refusal, retry exhaustion/recovery, surviving holder/row/intent, real legal holds and tenant/per-ref isolation. Test actual production caller/SQL/pg-boss/S3 outcomes, not helper success alone. Undo must transfer, not drop custody: trusted original owner (or non-mutating LOW, INFO and policy boundaries
Next owner: C5, through later ordinary admission, repairs the fixtures/oracles and preserves the original red evidence; then immutable repaired-source review and fresh named H1 admission for native proof, followed by remaining full integration/audit/rolling-policy gates and distinct whole-task acceptance. Splitting/adding cases increases the case count: require all original coverage plus strengthened cases, not just a nominal “58 pass” target. Keep #4270/#4238 draft, #4208 open and TALE-549 incomplete meanwhile. No code, branch, commit/push, installs, tests, services, CI action, production/history/bucket operation, task-state move or heavy execution occurred in this review. |
|
Closing this draft together with #4238, which it replaced. The branch Why it is not merged: the last native run at this head was 53 of 58 cases with five failing (diagnosed on 2026-10-05 as stale fixtures, never repaired); the review findings C1, C2 and R3 were only partly closed; two behaviours (the legacy rowless chat attachment, and the withheld replay of historical document attachments) need a policy decision; migration #4208 stays open. Its LOW and INFO items are separable and still unfixed on the stable line; the details are on #4238. |
|
Update: the branch From this PR only the LOW and INFO items of #4208 were carried over: "fix(platform): bound upload-intent sweeps and order ownership locks" on the stable |
Draft — TALE-549 / #4208 remains incomplete
Current immutable repair: d24091c
Clean replacement#4270 preserves original draft#4238/history and LOW/INFO/API semantics. Current repairs forward resolver-selected source through happy and refused production inserts; historical missing document proof is explicitly ambiguous, never inferred from file.document_id. Migration0150 now has transactional table locks plus enduring message/file capture and affected-ref ledger triggers. Independently owned duplicates take precedence over weaker retired bindings; message file locks NOWAIT rather than deadlock. This SQL has not been executed during light-only admission.
Current light proof:337tests/14suites,7selected TS files/zero diagnostics, focused format/type-aware lint/diff pass; full replacement branch-range commitlint passes. Scoped SAST zero findings with3exclusions/1partial parse. Real resolver/runTurn/PG-store functions are tested through a fake SQL port, not physical persisted ownership. Distinct source review is not whole-task acceptance.
Release blockers: native PostgreSQL/S3 migration/old-writer/affected-ref matrix; actual same-ref multi-team purge/copy proof; C2 near-expiry full-caller concurrency; preexisting rowless adjudication; explicit root disposition of historical ambiguous replay withholding and old-reader stop/drain barrier. SQLSTATE55P03 conflicting old writes fail atomically and are not automatically retried. Keep this PR draft. Original red logs remain preserved; original400test evidence below is historical, not proof of this repair.
Prior continuation evidence (historical)
Do not merge, deploy, close #4208 or infer whole-task acceptance. Root's existing retention policy is unchanged. This extends the preserved LOW/INFO work on the same branch.
Prospective source changes
Observed proof
Blocking disposition
Distinct immutable-head review requests changes: C1: same-blob multi-team source proof selects
file_metadata.document_id, not necessarily the visible authorizing document; C2: legacy NULL-owner undo can obtain the handoff proof lock before the ledger. Both require fixes and actual native adversarial proof. The review receipt is retained in the task delivery box; no whole-task acceptance is given.R3: legacy genuine owned chat attachment already rowless before migration. Trusted provenance is absent; the upgrade control reports hold true before / false after, replay unavailable, bytes still present. No author/readability/client-parts inference or broad legacy exception was introduced. A trusted provenance source or explicit audited rollout disposition and passing transition proof are required before release.
The continuation commit was published with invalid scope
filesinstead of allowedplatform; local commitlint reports this. Shared history is not rewritten in this lane. This is another explicit pre-merge repair gate, not a claimed passing check.Distinct immutable-head whole-task review and complete hosted gates remain required. CI is observed passively; no rerun/cancellation/native slot is claimed. API source closure intentionally preserves existing queued/failed replies; later acknowledgement or actual removal ends those holders. No production operation, deployment or cleanup occurred. Pending-held deliverable is a read-only design only.