Repository navigation
feat(match): multi-level hierarchy exclusion that still groups siblings (#800) - #883
Merged
Merged
Conversation
3 tasks
constraints.exclude_hierarchy declares which metadata key carries the parent reference; the compiler freezes a NOT EXISTS conjunct against a depth-capped recursive ancestor closure (__dedupe__hierarchy_ancestors) into every blocking rule, and the settings block that makes the engine materialize it travels with the conjunct. Ancestor chains never pair — grandparent included, which single -column exclude_when_equal cannot see — while siblings and uncle-nephew pairs still group; include_parent_child is the recorded opt-out, and declaring the hierarchy is what turns exclusion on. Covered on the dedupe, toggle and incremental-cross paths by real-engine goldens; the depth mutation was observed re-admitting the grandparent pair.
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.
Closes #800
What
constraints.exclude_hierarchy: { parent: <metadata key>, include_parent_child: false }:a declared hierarchy compiles a NOT-EXISTS conjunct into every blocking rule
against a new
__dedupe__hierarchy_ancestorsclosure (recursive, depth-capped),materialized inside the blocking funnel. Ancestor chains (parent↔child,
grandparent↔grandchild) are never candidates; siblings still group.
Why
Spec unit 1.25, the last open sub-issue of epic #513.
exclude_when_equalon aparent column sees one level and cannot both exclude the chain and keep
siblings; a closure can, and the two directions are asserted against the same
corpus (a tree-wide exclusion would flip the sibling assertion red).
Proof
make checkgreen locally (exit 0). The three real-engine goldens(
er-compile --test main hierarchy, underDEDUPE_E2E_EXTENSIONS=1): dedupe(exactly the sibling + uncle-nephew pairs survive a four-record clique),
toggle (all six pairs return), incremental cross (a new child of an EXISTING
parent is excluded; an unrelated existing record still pairs). Mutation
observed failing: capping the closure at one hop re-admits the
grandparent-grandchild pair and the golden names it. The incremental goldens
(
golden_incremental*) prove a hierarchy-free model blocks byte-identically.Risk & rollback
Additive: an undeclared hierarchy compiles byte-identically (asserted), and old
model documents parse unchanged (
hierarchyabsent → None).git revert <merge-sha>rolls back cleanly; a tenant model compiled WITH the block keepsworking, since its conjunct and closure ride in its own frozen document.
Post-merge ledger
Closed by: agent · session
93a44611-348c-4819-b503-ac48b5acd076onMac· 2026-11-08T18:00:00Zmainis green with this change on it — merge SHA2771aacf;rust,frontend,infra,devcontainer,imagesanddeployallcompleted success on that SHA itself.
imagesbuilt — completed success on2771aacf(this diff touchesrust/, so an image rebuild is correct).deployconverged — run 42506638480: the new colour's pod answereder-api-preview /readyz -> 200before the flip, thenCut overandRetire the old colourboth succeeded.deploysuccess (above);
driftandkindlatest runs success.Donethrough the automation (read backfrom the board) and feat(match): multi-level hierarchy exclusion that still groups siblings #800 closed
COMPLETEDby the merge — which alsocompletes the last open sub-issue of epic E5 — Classic matcher #513.
deferred; all three of the ticket's DoD boxes shipped in this PR.
er-matching/references/config-to-model.md(in this PR), and theCtePipeline constraint (a recursive CTE only renders standalone, never as
a second CTE) is recorded at
materialize_hierarchy_ancestors_cross.Specific to this change
Context — plan, discoveries, measurements, files
Plan
er-config:HierarchyExclusion { parent, include_parent_child }onMatchConstraints(exclude_hierarchy:), serde defaults; declaring it ISturning it on (the DataGroomr default-on maps to the SF config generator
always emitting it for Account — E1 — Salesforce commercial connector: finish onboarding and extraction reliability #511's job);
include_parent_child: trueis the opt-out toggle.
dedupe-core:SettingsJson.hierarchy: Option<HierarchyJson>(+ accessor, absent → None — the
comparator_algorithm_versionprecedent);stages/hierarchy.rswith the recursive ancestor-closure SQL over__dedupe__concat(edges:json_extract_string(metadata, '$.<parent>') = source_record_idwithin onesource_system; depth cap 10 = cycle guard);materialize it in
materialize_blocked_pairs_chunkAND the incrementalcross-blocking path, registering the handle on the pipeline so the frozen
conjunct's templated table name rewrites to the physical one.
er-compile: validate the parent key (identifier charset — it isspliced into a JSON path); emit the conjunct + the settings
hierarchyblock together (one without the other is a broken model); a note; no
COMPARATOR_ALGORITHM_VERSIONbump (comparator SQL untouched; old modelscompile byte-identically when the block is absent).
key refused; absent block compiles byte-identically); real-engine golden
hierarchy_exclusion.rs(thecross_field_groups.rsharness): parent↔childand grandparent↔grandchild never pair, siblings pair,
include_parent_child: truere-admits them — the two opposing directions the ticket demands.er-matching/references/config-to-model.mdconstraints sectionstates the default;
make checkgreen;/land-pr.Discoveries
Measurements
Files