refactor(email): one owner table, one lookupAtOwner; tombstone-safe saveScopedRow - #96
Merged
Merged
Conversation
agreenspan
force-pushed
the
claude/email-nested-pass-through-rfu4ic
branch
from
September 10, 2026 03:09
252d8cd to
3fc870e
Compare
agreenspan
force-pushed
the
refactor/email-lookup-owner-table
branch
from
September 10, 2026 03:10
e18b0f8 to
acf6bf5
Compare
agreenspan
force-pushed
the
claude/email-nested-pass-through-rfu4ic
branch
from
September 10, 2026 14:38
3fc870e to
213f196
Compare
agreenspan
force-pushed
the
refactor/email-lookup-owner-table
branch
from
September 10, 2026 14:40
acf6bf5 to
79b3fb1
Compare
agreenspan
force-pushed
the
claude/email-nested-pass-through-rfu4ic
branch
from
September 10, 2026 16:07
213f196 to
00ad124
Compare
lookup.ts was the same query written seven times, once per owner tier, and the cascade order was hand-written three more times across lookupTemplate, lookupCascade, and compose.parentOwner. owner.ts now holds the chain (parentOwner, ownerCascade) and the per-tier where (ownerWhere — the Space→Organization edge carries inheritToSpaces), and lookupAtOwner takes the tier. 368 lines become 161; the per-tier predicates are unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uyo2oHpjDz4zjRyqRWH6bP
agreenspan
force-pushed
the
refactor/email-lookup-owner-table
branch
from
September 10, 2026 16:09
79b3fb1 to
8aac782
Compare
agreenspan
changed the base branch from
claude/email-nested-pass-through-rfu4ic
to
main
September 10, 2026 16:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #91.
One owner table, one lookup
lookup.tswas the same query written seven times, once per owner tier, and the cascade order was hand-written three more times (lookupTemplate ×2, lookupCascade) plusparentOwnerin compose.owner.tsnow holds the chain (parentOwner,ownerCascade) and the per-tier where (ownerWhere— the Space→Organization edge carriesinheritToSpaces), andlookupAtOwner(templateSlug, componentSlugs, ctx, tier)is the single query. Per-tier predicates are byte-identical to before. 368 lines → 161. Same shape as Zealot'sowner.ts+lookupAtOwner, fitted to template's two chains and seven tiers.saveScopedRow: a re-saved slug must not land on its tombstone
The natural-key read had no live filter, so re-creating a slug whose row had been soft-deleted updated the tombstone in place and returned it: the save reported success, the row stayed deleted, and the new body overwrote the old snapshot's source. Same defect as Zealot #1930; here the partial uniques already scope to live rows, so the read just has to match them. Pinned by a save test.
Validation
packages/email370/370; api email suites (emailVersioning, deliverEmail, sendEmail, lib/email) 53/53; typecheck + biome clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Uyo2oHpjDz4zjRyqRWH6bP