Skip to content

fix(workboard): keep attachment deletion in its SQLite owner - #147191

Merged
steipete merged 1 commit into
mainfrom
codex/sqlite-round9-workboard-landing
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sqlite-round9-workboard-landing

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Related: #146197

Deleting a Workboard card unnecessarily loads every other attachment and can remove new attachments if another connection recreates the same session card during cleanup.

User Impact

Card deletion preserves attachments added to a newly recreated card and avoids loading unrelated attachment bodies. Original attachment deletion, subscriptions and reference cleanup keep their existing owners.

Why This Change Was Made

SQLite already deletes the original attachment blobs and cascades their metadata in the card deletion transaction. Remove the obsolete later scan; it can only find unrelated attachments or newly recreated state.

Evidence

  • 160 actual-owner, lifecycle and Doctor tests passed. The original code fails the new same-card recreation regression; physical deletion and rollback are also covered.
  • Four file-backed fixtures compare full results, schema, all typed rows and attachment BLOB hashes. With 100 unrelated 128 KiB attachments, median deletion fell from 42.74 to 2.01 ms and returned BLOB bytes from 13,107,200 to zero; statements fell from 18 to 17.
  • Tiny deletion fell from 0.90 to 0.62 ms; 100 ordinary 4 KiB attachments fell from 3.41 to 2.15 ms. These are warm synthetic owner-flow measurements, not whole-Gateway claims. Separate process measurements support a large-inventory memory saving, with tiny-control memory flat.
  • The removed scan no longer decodes unrelated attachment bodies as an incidental step. Direct attachment validation, transactional deletion, subscriptions and reference cleanup retain their owners; this does not make the whole asynchronous cleanup atomic.
  • Fresh independent P0–P2 review and all selected formatting, types, lint and repository guards passed. Required exact-head CI passed. No schema, SDK or migration changes.

Native prepare, merge and cleanup completed at 8e854bc3c8013d1ad76c1ee4f8eda25648c12346. The original reviewed patch, the concurrent worker migration, and the independently landed awaited-cleanup fix were verified together on current main.

Current-worker integration: after #146976, the same 100 unrelated 128 KiB attachments produced a 55.89→2.46 ms median deletion and 17,476,400→0 returned base64 payload bytes in an idle synthetic run. These are facade payload bytes, not native BLOB or wire-byte counts. The earlier timings above use the pre-worker implementation. The 173 selected store, lifecycle and Doctor tests passed. The awaited-cleanup correction landed independently in #147203; our identical #147227 was closed as a duplicate.

@steipete
steipete marked this pull request as ready for review September 13, 2026 16:44
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 12:51 PM ET / 16:51 UTC.

ClawSweeper review

What this changes

Workboard card deletion stops rescanning attachments after SQLite cleanup and adds regression coverage for deletion, rollback, and concurrent card recreation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on reviewed main and v2026.9.4. The patch preserves transactional attachment cleanup, removes the recreation race, and has no identified blocking defect.

Priority: P2
Reviewed head: 2d0d0058a6d4a057647ce14cc089d38bc469e866

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository context identifies maintainer-authored work, so the external-contributor proof gate does not apply; the body supplies bounded SQLite owner-flow measurements and regression results, without claiming whole-Gateway proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository context identifies maintainer-authored work, so the external-contributor proof gate does not apply; the body supplies bounded SQLite owner-flow measurements and regression results, without claiming whole-Gateway proof.
Evidence reviewed 8 items Introduced patch: The pinned merge-base-to-head diff removes only the post-transaction attachment scan from production code and adds three storage regression tests.
Existing deletion owner: The SQLite card store already deletes matching attachment blobs and the card in one immediate transaction; attachment metadata has an ON DELETE CASCADE foreign key. The attachment enumeration joins metadata to blobs, so its later scan cannot repair orphaned blobs.
Production entrypoint and storage contract: The production factory constructs WorkboardStore with SQLite stores, and the write-scoped card deletion RPC calls store.delete. Documentation identifies relational SQLite as the runtime owner, with legacy migration handled by Doctor.
Findings None None.
Security None None.

How this fits together

Workboard stores task cards and their attachments in a plugin-owned SQLite database. Card deletion enters through the Workboard store, removes persisted card data, and then cleans up subscriptions and references.

flowchart TD
  A[Card deletion request] --> B[Workboard store]
  B --> C[SQLite deletion transaction]
  C --> D[Delete original attachment blobs]
  D --> E[Delete card and cascade metadata]
  E --> F[Clean subscriptions and references]
  F --> G[Return deletion result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -5, Tests +93. Total +88 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 5 -5
Tests 1 93 0 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 93 5 +88

Review metrics

None.

Technical review

Best possible solution:

Keep attachment removal inside the existing SQLite card-deletion transaction, with recreated-card preservation covered at the store boundary.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: pause after SQLite deletes a session card, recreate the same deterministic card ID on another connection, add an attachment, then resume the old cleanup. Tests were inspected but not executed during this read-only review.

Is this the best way to solve the issue?

Yes. Removing the redundant scan uses the existing transactional owner without adding a schema, migration, public API, or competing cleanup mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7bda807a35f9.

Labels

Label changes:

  • add P2: This is a focused Workboard attachment-preservation fix for concurrent card recreation, with an additional deletion-cost improvement.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository context identifies maintainer-authored work, so the external-contributor proof gate does not apply; the body supplies bounded SQLite owner-flow measurements and regression results, without claiming whole-Gateway proof.

Label justifications:

  • P2: This is a focused Workboard attachment-preservation fix for concurrent card recreation, with an additional deletion-cost improvement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository context identifies maintainer-authored work, so the external-contributor proof gate does not apply; the body supplies bounded SQLite owner-flow measurements and regression results, without claiming whole-Gateway proof.

Evidence

What I checked:

  • Introduced patch: The pinned merge-base-to-head diff removes only the post-transaction attachment scan from production code and adds three storage regression tests. (extensions/workboard/src/store-core.ts:898, 2d0d0058a6d4)
  • Existing deletion owner: The SQLite card store already deletes matching attachment blobs and the card in one immediate transaction; attachment metadata has an ON DELETE CASCADE foreign key. The attachment enumeration joins metadata to blobs, so its later scan cannot repair orphaned blobs. (extensions/workboard/src/sqlite-store.ts:1348, 2d0d0058a6d4)
  • Production entrypoint and storage contract: The production factory constructs WorkboardStore with SQLite stores, and the write-scoped card deletion RPC calls store.delete. Documentation identifies relational SQLite as the runtime owner, with legacy migration handled by Doctor. (extensions/workboard/src/store.ts:640, 2d0d0058a6d4)
  • Meaningful concurrency regression: The test uses two real SQLite connections and pauses after committed card deletion. It recreates the deterministic session card, adds an attachment, resumes cleanup, and checks that both the attachment and recreated card survive. Separate cases inspect physical rows and transaction rollback. (extensions/workboard/src/store.test.ts:4464, 2d0d0058a6d4)
  • Current-main necessity: Reviewed main still contains the redundant attachment enumeration after card deletion. (extensions/workboard/src/store-core.ts:909, 7bda807a35f9)
  • Latest-release comparison: The v2026.9.4 source also contains the redundant scan. Local release-blob inspection failed, so the same source was inspected through GitHub's contents API. (extensions/workboard/src/store-core.ts, 3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 8e854bc into main Sep 13, 2026
172 checks passed
@steipete
steipete deleted the codex/sqlite-round9-workboard-landing branch September 13, 2026 17:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: workboard rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant