Skip to content

feat(match): pin a model to the comparator algorithm version it was built against (#798) - #845

Merged
athvin merged 2 commits into
mainfrom
issue/798-model-algo-version
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/798-model-algo-version

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #798

🚧 Claimed by an agent session — 2026-11-08T07:49:28Z, 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

A trained/compiled model records the comparator algorithm version it was built
against (comparator_algorithm_version in the settings document), and the
control plane and models UI surface it.

Why

jaro_winkler:0.90 names a threshold, not an implementation. Change a
comparator's SQL today and every existing model silently re-groups on its next
analysis with an unchanged config_hash — nothing says why the answer moved.

Proof

make check green. make frontend green (546 passed; one unrelated
grow.spec.ts mobile-safari flake on the first run passed in isolation and in
the re-run). DuckLake e2e tier green — 58 passed including the new regression,
which runs base_10 with the committed model vs the same bytes stamped
comparator_algorithm_version: 99 and asserts identical partitions.
pg_model_registry green against local Postgres with a new assertion that an
unstamped document reads as v1.

Risk & rollback

Low: one additive, serde-defaulted field on the settings document and one
derived field on the model wire projection. git revert <merge-sha>.

Post-merge ledger

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

  • main is green with this change on it — merge SHA
    a848490c1ec9455bc9b669d4b7666d43e57dd5a8; rust run 42475263278 success,
    frontend run 42475263295 success, infra run 42475263341 success,
    devcontainer run 42475263314 success.
  • images built — run 42475263283 success (engine/control-plane
    sources changed, so the images rebuilt and pushed).
  • deploy converged — run 42475621736 success; smoke lines emitted by
    the running preview: er-api-preview /readyz -> 200,
    er-web-preview /api/healthz -> 200, the blue colour serves through its own Services.
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green — deploy above; drift and kind are
    schedule-triggered, not push-triggered, and their last runs are both
    success (verified 2026-11-08).
  • the board card reached Done through the automation rather than by
    hand, and the issue closed — feat(match): pin a model to the comparator algorithm version it was built against #798 closed by the merge at
    2026-11-08T11:19:52Z; project 2 item reads Done, P1.
  • follow-ups are open for everything deferred here — n/a, nothing was
    deferred.
  • what was learned is written down where the next session will find it
    — deferred — docs(land-pr): the rerun budget reads differently for provably-external outages #851 (land-pr's rerun budget gains the provably-external
    outage branch, from this PR's GitHub release-asset 504 incident).

Specific to this change

Nothing else owed: no backfill, no flag, no required check to add. The stamp
applies to models compiled from here on; existing registry rows derive v1 on
read, which the pg_model_registry assertion pins.

Context — plan, discoveries, measurements, files

Plan

  • dedupe-core: comparator_algorithm_version: Option<u32> on
    SettingsJson (serde-defaulted, skipped when absent) so legacy documents
    parse and re-emit byte-identically; accessor applies absent→1 with a
    comment pinning that the default is history, not the current version.
  • er-compile: pub const COMPARATOR_ALGORITHM_VERSION: u32 = 1 with the
    bump rule in its doc comment; compile_with stamps every emitted model.
    Training round-trips the field via Settings::to_settings_json —
    asserted by a new golden_settings test.
  • er-server: model_summary derives the version from the stored
    document (model_weights pattern — derived, never a column); an
    unparseable document yields null rather than a fabricated 1.
  • Frontend: ModelVersionRow carries the field (number | null); the
    models list gains an Algo column and the weights detail a Comparator
    algorithm line; mock fixture and both wire gates (wire-contract,
    mock-fabrication) updated with the derivation recorded.
  • Regression: the_recorded_comparator_version_does_not_change_the_groups
    in lake_e2e.rs — base_10, committed model vs stamped-99 model,
    identical partitions.

Discoveries

  • er-versions solves run-mode arbitration (std_version /
    survivorship_version drift), not comparator versioning — confirmed by
    reading its surface; nothing to reuse there.
  • The compile oracle (reproduces_committed_model.rs) compares STRUCTURE
    (comparisons/levels), not bytes, and parses through serde defaults — the
    committed fixture needed no edit.
  • No byte-level golden of compiled model JSON exists
    (score_scale_calibration.rs parses and bounds numbers only).
  • The wire gates have two directions: wire-contract.test.ts (UI type may not
    invent fields) needed the field declared as derived in both the row and the
    detail pair; mock-fabrication.test.ts (mock may not invent fields) needed
    an EXPLAINED entry. Both entries cite model_summary.

Measurements

  • DEDUPE_E2E_DUCKLAKE=1 cargo test -p er-cli --test main → 58 passed,
    including the_recorded_comparator_version_does_not_change_the_groups
    (14.82s in isolation).
  • make frontend → 546 passed, 117 skipped, 0 failed.

Files

  • rust/crates/dedupe-core/src/settings/json.rs — the field + the absent→1
    accessor
  • rust/crates/dedupe-core/tests/golden_settings.rs — round-trip + absent
    semantics
  • rust/crates/er-compile/src/lib.rs — the constant, the stamp, the stamp test
  • rust/crates/er-server/src/lib.rs — model_summary derivation
  • rust/crates/er-server/tests/pg_model_registry.rs — unstamped reads as v1
  • rust/crates/er-cli/tests/lake_e2e.rs — the regression
  • frontend/src/lib/query/models.ts,
    frontend/src/components/settings/models-content.tsx — the surface
  • frontend/tests/mock-erserver/server.mjs,
    frontend/tests/unit/wire-contract.test.ts,
    frontend/tests/unit/mock-fabrication.test.ts,
    frontend/tests/functional/models.spec.ts — mock + gates + functional proof

@athvin
athvin marked this pull request as ready for review November 8, 2026 08:51
A compiled model is stamped with er-compile's COMPARATOR_ALGORITHM_VERSION
in its settings document; training round-trips the stamp for free through
Settings::to_settings_json. Documents written before versioning existed
carry no stamp and read as v1 — a fact about history that deliberately
does not track the constant at bump time — and re-emit byte-identically.

The version is derived on read in er-server's model_summary (the
model_weights pattern: never a column) and rendered on the models list
and the weights detail. The load-bearing regression runs base_10 with the
committed model versus the same bytes stamped with a version that is not
the current one and asserts identical partitions: scoring executes the
SQL frozen in the model's own document, so the stamp is a record, not an
input.
@athvin
athvin force-pushed the issue/798-model-algo-version branch from 1a498c6 to 28f1bf5 Compare November 8, 2026 08:51
@athvin
athvin merged commit a848490 into main Nov 8, 2026
106 of 138 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.

feat(match): pin a model to the comparator algorithm version it was built against

2 participants