Skip to content

Evidence-key prefixes hardcoded in reader + frontend; custom-prefix models lose matched-fields #871

Done

Description

@athvin

What

Three places hardcode the evidence-key prefixes gamma_ / mw_ / mw_tf_adj_:

But the prefixes are operator-configurable: POST /v1/orgs/{org}/datasets/{ds}/models/versions accepts any loadable model_json, and dedupe_core::Settings derives gamma_prefix / mw_prefix / tf_prefix from it (settings/mod.rs). The match stage writes evidence keys with the model's real prefixes (er-cli evidence_json). er-compile always emits the defaults, so nothing in the repo's own path ever produces a custom prefix — but an admin-uploaded model can.

Symptom

With a custom-prefix model active: matched_fields comes back empty (so the matched_on filter matches nothing and the matched-on column is blank), and the frontend evidence waterfall mis-renders. Silent, not wrong — no incorrect rows are returned.

Fix

Derive the prefixes from the active model registry entry (the group read already knows its model_versions) and thread them to the reader; teach the frontend the same via the API rather than a constant. Until then the hardcoded defaults are the de-facto contract.

Surfaced by pr-review on #801.


Product context (2026-11-26)

Why this matters for the API product: this affects results, specifically their explanations. matched_fields on PersonDuplicateGroup/AccountDuplicateGroup, the matched_on filter, and evidence on /resolve and match scores are public contract. POST …/models/versions is a public admin operation, so a customer, not just an operator, can upload a model with custom prefixes and silently lose those fields.

Current state: unchanged since the ticket was filed.

  • The prefixes are still hardcoded in er-server/src/read.rs:614-628 (evidence_fields) and frontend/src/lib/domain/evidence.ts:23-25.
  • The evidence key format (gamma_*/mw_*/mw_tf_adj_*) is not documented in openapi.public.json. evidence is untyped there.
  • The frontend half is lower priority now that the app UI is pruned. The API half is what matters.

Definition of done: pick one of two options.

  • (a) Reject models whose prefixes are not the defaults at models/versions, with a 422 and a test. Then document the key format in the contract.
  • (b) Derive the prefixes from the active model version in the reader and /resolve, with a test using a custom-prefix model.

In either case, the evidence key format must appear in the OpenAPI schema description.

Dependencies / sequencing: feeds #529, which needs explainable evidence.

Open product decision: are custom evidence prefixes a supported customer capability, option (b)? Or is the default a fixed contract, option (a)? Option (a) is smaller.

Size: about 0.5 engineer-weeks for (a); about 1.5 for (b).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions