Repository navigation
feat: protect enforcement — protected record wins the merge-plan master (1.3b) - #116
Merged
Merged
Conversation
…-plan master (1.3b) PR 1.3 shipped the `protect` overlay as inert storage (the apply arm writes `record_overlays kind='protect'` but nothing read it). This wires the read-path enforcement the feature promised: a member record with an active `protect` overlay is elected the surviving master for its entity, overriding the survivorship policy. Why the read path (merge-plans), not golden assembly: golden records have committed byte-identical fixtures gated in CI. Enforcing there would touch the determinism contract for a steward-exception feature. merge-plans (`read::merge_plans`) has no committed fixture, so the override is determinism-trivially-safe. The never-cut guarantee + contradiction precheck (the write-path half) stay deferred to 1.3c. - read::merge_plans: a `protected` CTE (active `record_overlays kind='protect'` joined to the affected entities' members) COALESCE'd ahead of the policy election. Gated on the overlay table existing AND holding ≥1 active protect row — when nothing is protected (or the steward drain never created the table) the SQL collapses to the exact prior `masters AS (...)`, byte-exact. Mirrors load_suppressed_keys' is_missing_table graceful-absence pattern. - endpoints: POST /records/protect + /unprotect, mirroring suppress/unsuppress. suppress_record_action generalised to record_overlay_action(overlay, retract) so both overlays share one staged-action + apply_corrections drain path. - frontend: a steward Protect row action in the entity view (+ BFF routes + useProtectRecords), alongside Exclude. Viewer surfaces unchanged. - tests: pg_protect_master e2e (own binary) drives a real merge_scenario (base→incremental so reconcile emits merged/member_added — base_10 only emits `created`, so its plan is empty), protects a non-master member, and asserts it becomes the merge-plan master; unprotect reverts to the policy master. Plus a Playwright steward/viewer functional pair. No golden fixture changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
athvin
force-pushed
the
feat/protect-enforcement
branch
from
October 16, 2026 09:10
74dc324 to
9aa3caa
Compare
The Members-card action row gained a third button (Protect, alongside Unmerge and Exclude), each carrying a text label. In the CardHeader's flex-row/justify-between layout with a non-wrapping `flex gap-2` button container, three labelled buttons overflow horizontally on a ~412px mobile viewport, pushing the last button (Protect) off-screen so its click times out. This surfaced as mobile-chrome-only Playwright failures on the new protect test plus the pre-existing merge/wizard specs sharing the viewport. Stack the header on mobile (`flex-col` → `sm:flex-row`) and let the button row wrap (`flex-wrap`). The `sm:` breakpoint restores the exact original desktop row, so desktop is behaviorally unchanged; the three previously-failing specs now pass on `--project=mobile-chrome`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
10 tasks done
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.
What
PR 1.3 shipped the
protectoverlay as inert storage — the apply arm wroterecord_overlays kind='protect'but nothing read it. This wires the read-path enforcement the feature promised: a member record with an activeprotectoverlay is elected the surviving master for its entity, overriding the survivorship policy.Why the read path (merge-plans), not golden assembly
Golden records have committed, byte-identical fixtures gated in CI. Enforcing protect inside golden assembly would put a steward-exception feature on the determinism contract.
read::merge_planshas no committed fixture, so the override is determinism-trivially-safe. The never-cut guarantee + contradiction precheck (the write-path half of protect) stay deferred to 1.3c.Changes
read::merge_plans— aprotectedCTE (activerecord_overlays kind='protect'joined to the affected entities' members)COALESCE'd ahead of the policy election. Gated on the overlay table existing and holding ≥1 active protect row, so when nothing is protected (or the steward drain never created the table) the SQL collapses to the exact priormasters AS (…)— byte-exact, no behavior change. Mirrorsload_suppressed_keys'is_missing_tablegraceful-absence pattern.POST /records/protect+/unprotect, mirroring suppress/unsuppress.suppress_record_actiongeneralised torecord_overlay_action(overlay, retract)so both overlays share one staged-action →apply_correctionsdrain path.useProtectRecords), alongside Exclude. Viewer surfaces unchanged.pg_protect_mastere2e (own binary) drives a realmerge_scenario(base→incremental, so reconcile emitsmerged/member_added— base_10 only emitscreated, so its plan is empty), protects a non-master member, asserts it becomes the merge-plan master, then unprotect reverts to the policy master. Plus a Playwright steward/viewer functional pair.Verification (local)
cargo fmt/clippy -D warningsclean;pg_protect_master,pg_record_overlays(suppress, no regression),pg_golden_read,pg_drain_dispatcher, er-server lib tests, er-clilake_e2egolden byte-identity — all green against docker Postgres.pnpm check(eslint/prettier/tsc/vitest 59) + protect/records/steward-surfaces Playwright (17) — all green.🤖 Generated with Claude Code