Repository navigation
feat(match): pin a model to the comparator algorithm version it was built against (#798) - #845
Merged
Merged
Conversation
4 tasks
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
force-pushed
the
issue/798-model-algo-version
branch
from
November 8, 2026 08:51
1a498c6 to
28f1bf5
Compare
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 #798
What
A trained/compiled model records the comparator algorithm version it was built
against (
comparator_algorithm_versionin the settings document), and thecontrol plane and models UI surface it.
Why
jaro_winkler:0.90names a threshold, not an implementation. Change acomparator'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 checkgreen.make frontendgreen (546 passed; one unrelatedgrow.spec.tsmobile-safari flake on the first run passed in isolation and inthe 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: 99and asserts identical partitions.pg_model_registrygreen against local Postgres with a new assertion that anunstamped 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-17fdde0059econbrians-MacBook-Pro· 2026-11-08T11:40:04Zmainis green with this change on it — merge SHAa848490c1ec9455bc9b669d4b7666d43e57dd5a8; rust run 42475263278 success,frontend run 42475263295 success, infra run 42475263341 success,
devcontainer run 42475263314 success.
imagesbuilt — run 42475263283 success (engine/control-planesources changed, so the images rebuilt and pushed).
deployconverged — run 42475621736 success; smoke lines emitted bythe running preview:
er-api-preview /readyz -> 200,er-web-preview /api/healthz -> 200,the blue colour serves through its own Services.deploy,drift,kind's nightly leg) is green — deploy above;driftandkindareschedule-triggered, not push-triggered, and their last runs are both
success (verified 2026-11-08).
Donethrough the automation rather than byhand, 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.
deferred.
— 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>onSettingsJson(serde-defaulted, skipped when absent) so legacy documentsparse 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 = 1with thebump rule in its doc comment;
compile_withstamps every emitted model.Training round-trips the field via
Settings::to_settings_json—asserted by a new golden_settings test.
er-server:model_summaryderives the version from the storeddocument (
model_weightspattern — derived, never a column); anunparseable document yields null rather than a fabricated 1.
ModelVersionRowcarries the field (number | null); themodels 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.the_recorded_comparator_version_does_not_change_the_groupsin
lake_e2e.rs— base_10, committed model vs stamped-99 model,identical partitions.
Discoveries
er-versionssolves run-mode arbitration (std_version/survivorship_versiondrift), not comparator versioning — confirmed byreading its surface; nothing to reuse there.
reproduces_committed_model.rs) compares STRUCTURE(comparisons/levels), not bytes, and parses through serde defaults — the
committed fixture needed no edit.
(
score_scale_calibration.rsparses and bounds numbers only).wire-contract.test.ts(UI type may notinvent fields) needed the field declared as derived in both the row and the
detail pair;
mock-fabrication.test.ts(mock may not invent fields) neededan
EXPLAINEDentry. Both entries citemodel_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→1accessor
rust/crates/dedupe-core/tests/golden_settings.rs— round-trip + absentsemantics
rust/crates/er-compile/src/lib.rs— the constant, the stamp, the stamp testrust/crates/er-server/src/lib.rs—model_summaryderivationrust/crates/er-server/tests/pg_model_registry.rs— unstamped reads as v1rust/crates/er-cli/tests/lake_e2e.rs— the regressionfrontend/src/lib/query/models.ts,frontend/src/components/settings/models-content.tsx— the surfacefrontend/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