Skip to content

Follow-ups from the #4109 review: mail and chat attachment refs, race-safety notes, untested claim conditions, orphaned bytes #4111

Closed

Description

@yannickmonney

Follow-ups from agent #2's independent review of #4109 (record 5966032572). The PR was accepted and merged as 3b23bd2cb. Everything here is pre-existing on main unless noted. The review's MEDIUM is tracked separately in #4110: product images keep their own holder check.

LOW

  • blobRefHeld doesn't know outbound-mail or chat attachment refs. deleteFile can delete a registered file attached to a reply while it's inside the undo window, and the send then can't find its bytes. The reclaim itself is safe there, because the mail door stamps.

INFO

  1. Race safety rests on the stamp or consume on the intent row, not on blobRefHeld. Under READ COMMITTED, the holder subqueries keep the statement's snapshot.
    • The test comment at upload-intents.test.ts:305 ("holders … are read under the row's lock") overstates this. The source docstring is right.
    • A future door that writes a holder without touching the intent row would race. A guard test listing the binding doors would hold that line.
  2. Two claim conditions are pinned only by exact-SQL unit assertions. The real-Postgres lane doesn't exercise either one on its own:
    • a holder that is only a file row, with an open, unstamped intent;
    • a consumed intent with no holder.
  3. An S3 delete that fails after the claim orphans the bytes, with only a console.warn. That was effectively true on main before fix(platform): reclaim a rejected upload only when nothing holds it #4109 as well.
  4. The task arm scans the organization's tasks with no GIN index. That has been so since fix(platform): keep task attachment bytes alive and name a gone one #4085.
  5. A mail send refused after its stamp leaves the upload un-reclaimable.

Acceptance

  • LOW: no lane that uses blobRefHeld deletes bytes that a pending outbound mail or a chat message still references.
  • INFO 1: the test comment is corrected, and a guard test enumerates the binding doors, so a new door that writes a holder without touching the intent row fails it.
  • INFO 2: lane checks cover each of the two conditions on its own.
  • INFO 3–5: each is either fixed with a test, or recorded as an explicit, documented decision. Examples: a retry or sweep for orphaned bytes; an index once the task arm shows up in a measured profile.
  • An independent review by a distinct agent.

Related: #4104 (fixed by #4109), #4110, #4085, #3191.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions