Skip to content

feat(reconcile): protected records are never cut by never-rules (1.3c) - #117

Merged
athvin merged 1 commit into
mainfrom
feat/protect-never-cut
Oct 16, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/protect-never-cut

Conversation

@athvin

@athvin athvin commented Oct 16, 2026

Copy link
Copy Markdown
Owner

What & why

The write-path half of record protection. PR #116 (1.3b) made a protect overlay win master election on the read path, but reconcile never looked at protect — so a never rule could still sever a protected record's cluster membership. This closes that gap: a protected record is never cut.

Design

  • Enforcement — never_cut_fixpoint/choose_cut_edge gain a protected set. An edge incident to a protected record is uncuttable, exactly like a cut_protect-probability edge. A never pair reachable only through protected records escalates instead of severing a protected record. load_protected_keys (sibling of load_suppressed_keys, kind='protect', missing-table-tolerant) threads the set in from run_reconcile.
  • Contradiction surfacing — the escalation (previously discarded) is written as an open never_unsatisfiable review-queue item. That reason code already exists in the schema and the review UI already renders it → no new table, enum, or UI.
    • Chosen over the reserved cut_edges table (its NOT-NULL match_probability + active/released lifecycle are for a different, unbuilt relational-cut feature) and over a new entity_events type (enum change touches the model-registry golden).
  • No synchronous 409 precheck — protect is a staged overlay drained at reconcile, not a cheap synchronous request like unmerge_entity, so a 409 there would be awkward. The contradiction instead surfaces at reconcile time via the review item — a more robust, source-agnostic catch.

Determinism (does not break anything)

The review write is gated on a protect overlay existing AND an escalation occurring, so the base path never touches review_queue. An empty protected set makes never-cut byte-identical to pre-1.3c. No golden fixture changed; base_10 + every *_matches_golden e2e are byte-identical. (High-confidence escalations that were possible pre-1.3c stay silent until a future rebaseline — noted in code.)

Tests

  • Two er-reconcile unit tests: a protected record escalates instead of being cut; off-path protection is a no-op; an empty set reproduces the prior cut exactly.
  • Gated DuckLake e2e protected_record_is_never_cut_and_escalates_through_ducklake (verified locally against Postgres, DEDUPE_E2E_DUCKLAKE=1): protected middle record stays co-clustered + a never_unsatisfiable review is written.
  • golden parity + the existing assertions_enforce_clustering_through_ducklake e2e unchanged; full workspace clippy/fmt clean.

🤖 Generated with Claude Code

The write-path half of protect (1.3b wired only the read-path master
override). A `protect` overlay was invisible to reconcile, so a `never`
rule could still sever a protected record's cluster membership.

Enforcement: `never_cut_fixpoint`/`choose_cut_edge` gain a `protected`
set — an edge incident to a protected record is uncuttable, exactly like
a `cut_protect`-probability edge. A never pair reachable only through
protected records escalates instead of cutting one. `load_protected_keys`
(sibling of `load_suppressed_keys`, kind='protect', missing-table-
tolerant) threads the set in from `run_reconcile`.

Surfacing: the escalation — previously discarded — is written as an open
`never_unsatisfiable` review-queue item. That reason code already exists
in the schema and the review UI already renders it, so there is no new
table, enum, or UI. Chosen over the reserved `cut_edges` relational-cut
table (its NOT-NULL match_probability/active/released lifecycle is for a
different, unbuilt feature) and over a new entity_events type (enum change
touches the model-registry golden).

No synchronous 409 precheck: `protect` is a *staged* overlay drained at
reconcile, not a cheap synchronous request like `unmerge_entity`, so a
409 there would be awkward. The contradiction instead surfaces at
reconcile time via the review item — a more robust, source-agnostic catch.

Determinism: the review write is gated on a protect overlay existing AND
an escalation occurring, so the base path never touches `review_queue`.
Empty protected set ⇒ never-cut is byte-identical to pre-1.3c. No golden
fixture changed; base_10 + all golden e2e byte-identical. (High-confidence
escalations possible pre-1.3c stay silent until a future rebaseline.)

Tests: two er-reconcile unit tests (protected record escalates; off-path
protection is a no-op; empty reproduces the prior cut) + a gated
`protected_record_is_never_cut_and_escalates_through_ducklake` DuckLake
e2e. golden parity + the existing assertions e2e unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@athvin
athvin merged commit 1a0afd9 into main Oct 16, 2026
7 checks passed
@athvin
athvin deleted the feat/protect-never-cut branch October 16, 2026 09: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