Skip to content

fix(match): variant_match resolves its variants column by entity type (#662) - #843

Merged
athvin merged 2 commits into
mainfrom
issue/662-variant-match-account
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/662-variant-match-account

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #662

🚧 Claimed by an agent session — 2026-11-08T06:30:27Z, codex session 01a1b861-d8a0-7400-8aae-17fdde0059ec on Mac.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Why

Proof

Risk & rollback

Post-merge ledger

Closed by: agent · codex session 01a1b861-d8a0-7400-8aae-17fdde0059ec on brians-MacBook-Pro · 2026-11-08T07:44:47Z

  • main is green with this change on it — 7fdf5b3: rust, frontend,
    infra, devcontainer, images, deploy all success on the merge SHA itself:
  • images built — the compiler ships inside the engine image, so image
    inputs changed; run 42458643027 success, deploy fired off it:
  • deploy converged — run 42458919308's smoke step logged
    er-api-preview /readyz -> 200 and er-web-preview /api/healthz -> 200
    ("the blue colour serves through its own Services") before cutover. A
    pod-level log line beyond the smoke probe was not observable from this
    session — no cluster credentials (kubectl: "the server has asked for the
    client to provide credentials"):
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: deploy success on 7fdf5b3; drift's and kind's scheduled
    legs were green this morning (b4b0b0f 06:02Z, b586498 04:40Z), both
    pre-merge as their schedules dictate:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: variant_match is person-only in er-compile — an account config that declares it publishes, then fails every run #662 CLOSED, card Done — verified:
  • follow-ups are open for everything deferred here — numbers: none
    deferred; the ticket's part 1 (a config_check refusal) is deliberately
    absent because part 2 makes it a refusal of a config that works:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: the
    Discoveries below carry the line-drift correction, the level-vs-exact
    semantics of a one-element variants list, and the grid-stability reason
    the fix's fixture is its own file:

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  1. Teach the compiler the variants column by entity type (the issue's part 2, which makes part 1's refusal unnecessary): a variants_column(entity_type) helper — person → name_variants, account → company_variants — threaded from compile_with (which has config.entity_type) through compile_comparison / compile_group into resolve_level / resolve_level_pair / resolve_group_level. The variant_match arm emits array_length(list_intersect("<col>_l", "<col>_r")) >= 1 via the same side() quoting every other level uses.
  2. Byte-parity on person. side("name_variants", …) renders exactly the string the arm hardcodes today, so the reproduces_committed_model oracle and the existing unit assertions stay byte-identical on the person path.
  3. Unit coverage in er-compile: account config with variant_match on company_name_norm compiles to the company_variants SQL (the byte string the hand-authored acct_model_v1.json already carries); the person assertion is unchanged.
  4. A new account fixture config (fixtures/static/acct_10/config_variant.yaml) declaring variant_match on company_name_norm, plus one acct_e2e test that compiles it and runs the pipeline — the issue's repro, kept green. The shared acct_10/config.yaml keeps its levels unchanged so the scale-grid assertions do not move; its stale bug comment is rewritten to point at the working config.
  5. make check; the acct e2e with DEDUPE_E2E_DUCKLAKE=1.

What this deliberately does not do

  • The config_check refusal (part 1) is the stopgap for a compiler that cannot resolve the column; with the column resolved, refusing would reject a config that now works.
  • variant_match stays non-group_capable — a cross-field group over it has no pairwise reading, unchanged.

Discoveries

  • The ticket names two hardcoding sites (lib.rs:400, :1146); current main has ONE SQL site — resolve_level_pair — plus a test assertion. The second site was line-drift.
  • company_variants is genuinely populated: er-std::sql::company_variants fills it in standardize, and acct_int_std_record declares it LIST(VARCHAR) NOT NULL.
  • The hand-authored acct_model_v1.json already carries the target level byte-for-byte: array_length(list_intersect("company_variants_l", "company_variants_r")) >= 1 — the fix's SQL is pinned by the model, not invented.
  • CompileOptions is documented as scale-only ("nothing here varies it — not even by entity_type"), so the entity type threads as its own parameter rather than riding the options struct.

Measurements

  • make check green on the branch head (b6f4bc8) — full workspace, incl. the compile-oracle and entities gates.
  • DEDUPE_E2E_DUCKLAKE=1 cargo test -p er-cli --test main acct_ → 5/5 in 26s, including the new variant_match_runs_on_an_account_config (compiles, runs, resolves acct_10 to truth at 44 bits + auto_merge 0.99).
  • PR checks: all 15 required contexts green on b6f4bc8, zero failed detect jobs.

Files

  • rust/crates/er-compile/src/lib.rs — the threading + the resolved arm + tests
  • fixtures/static/acct_10/config_variant.yaml (new), fixtures/static/acct_10/config.yaml (comment rewrite)
  • rust/crates/er-cli/tests/acct_e2e.rs — the compiles-and-runs coverage

…#662)

er-compile emitted the person lexicon's name_variants column for every
entity type, so an account config declaring variant_match compiled, passed
config_check, published, and failed every run at predict with a Binder
Error. The compiler now resolves the column from config.entity_type —
name_variants for person (byte-identical output, the compile oracle is
unmoved), company_variants for account (the byte string the hand-authored
acct_model_v1.json already pins).

The issue's part 1 — a config_check refusal — is deliberately NOT here: it
was the stopgap for a compiler that could not resolve the column, and with
the column resolved the refusal would reject a config that now works.

Coverage: the unit assertion beside the person one in
the_committed_models_level_sql_is_what_the_tokens_render, and a new acct
e2e (fixtures/static/acct_10/config_variant.yaml = the measured
config_domain_jw.yaml + the level) that compiles it and resolves the corpus
exactly at the measured scale — the issue's repro, kept green.
@athvin
athvin marked this pull request as ready for review November 8, 2026 07:08
@athvin
athvin merged commit 7fdf5b3 into main Nov 8, 2026
43 checks passed
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.

variant_match is person-only in er-compile — an account config that declares it publishes, then fails every run

2 participants