Skip to content

fix(core): make hard delete owner-only in ScopedStack#75

Merged
cuibonobo merged 1 commit into
mainfrom
claude/issue-59-design-review-7jgwnk
Jul 9, 2026
Merged

fix(core): make hard delete owner-only in ScopedStack#75
cuibonobo merged 1 commit into
mainfrom
claude/issue-59-design-review-7jgwnk

Conversation

@cuibonobo

Copy link
Copy Markdown
Member

Summary

Closes the first, unblocked work item from #59.

ScopedStack.delete() called requireDeletable() (checks the record-level write bit or a delete-own/delete-any grant) and then forwarded opts straight to the adapter — so a write: true holder, or a delete-any grant holder, could pass { hard: true } and permanently destroy the record and its version history. There was no test exercising this path.

Per #59's stated trust model — "anything a write-holder does, the owner can undo" — hard delete has no undo, so it doesn't belong behind any delegated-access mechanism. This PR makes hard delete owner-only:

Out of scope (tracked separately)

#59 has other work items — an undelete API, versioned/audited association changes, and the full "recoverability trust model" spec writeup — that are genuine prerequisites tracked as their own open issues (#60, #61) and don't exist in code yet. This PR only lands the carve-out that #59 itself flags as having no dependencies.

Test plan

  • Added tests: write-bit holder can soft-delete but not hard-delete; owner can hard-delete; delete-any grant holder cannot hard-delete
  • pnpm --filter @haverstack/core test — 192 tests passing
  • pnpm --filter @haverstack/core typecheck — clean
  • pnpm --filter @haverstack/core lint — clean
  • prettier --check on changed files — clean

Refs #59, #60, #61, #45


Generated by Claude Code

Closes the item-1 carve-out from #59: ScopedStack.delete() forwarded
opts straight to the adapter, so the write bit and delete-own/delete-any
grants could reach { hard: true } and permanently destroy a record and
its version history. Hard delete now requires being the stack owner;
everyone else is limited to (recoverable) soft delete.

The remaining #59 work items (undelete API, association versioning,
the full recoverability trust-model writeup) are tracked separately in
#60 and #61 and are out of scope here.
@cuibonobo cuibonobo merged commit 5e22c61 into main Jul 9, 2026
5 checks passed
@cuibonobo cuibonobo deleted the claude/issue-59-design-review-7jgwnk branch July 9, 2026 17:58
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.

2 participants