Repository navigation
feat(db): write one ship event per CMS send, and note a draft published again (00425) - #1883
Merged
Merged
Conversation
…ed again (00425) Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 13 tasks
gkhngyk
previously approved these changes
Oct 31, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. One ship event per CMS send, backed by a unique index per delivery, and a draft published again is noted on it. Apply 00425 before merging.
Merged
8 of 13 tasks
gkhngyk
approved these changes
Oct 31, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.
8 of 13 tasks
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.
Summary
Migration 00425 for the impact ledger (00421, CHAT-22 §2). The W2-20 code PR is stacked on this one. Please apply 00425 on prod before deploying that code. It adds two nullable columns, so the code already on prod is unaffected.
Why: when a CMS confirms a sent page is live, the server writes a ship event. That confirmation can arrive more than once, from the webhook's callback and from a status poll, or from two servers at the same moment. Each extra confirmation would be a second shipped change on the same prompts. Two measurements on the same targets then make each other Not measurable (
overlapping_change).00425
ship_events.content_draft_delivery_id uuid:content_draft_deliveries) this ship event is the publish of; FKon delete set null; null for every other kind of ship event;ship_events_content_draft_delivery_uidxis a plain unique index, not a partial one. PostgREST'son_conflictnames columns only, and Postgres can't infer a partial index without its predicate. Nulls stay distinct, so ship events without a send never collide.on conflict do nothing).ship_events.republished_at timestamptz: the last time the same draft went live again within 90 days. No second ship event is written then; the first measurement goes on.if not exists). It has no RLS or grant changes;ship_eventskeeps 00421's policies.supabase/schema.sqlwas rebuilt withbuild-schema.sh.web/src/types/supabase.tsandweb/src/lib/chat/schema.test.tsare updated.Related issue
None. Chat Wave 2 (W2-20, CHAT-22 §2).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
00425_ship_events_delivery.sql. Re-running it changes nothing.ship_eventsrow for a send withon conflict (content_draft_delivery_id) do nothing, twice. The first returns 1 row, the second 0.bash supabase/build-schema.sh.schema.sqldoesn't change.Applied on the dev database. I ran step 2 inside a transaction and rolled it back: first 1, second 0, one row for the send.
Checklist
yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change)On the W2-20 tip (this commit + the stacked code): web
format:checkandtypecheckpass,linthas 0 errors (7 old warnings in files this PR doesn't touch), andschema.test.tspasses (44 tests).build-schema.shleavesschema.sqlunchanged.🤖 Generated with Claude Code