Skip to content

fix(api): evidence prefixes are a fixed contract — a model with others is refused, and the key format is documented (#871) - #1439

Merged
athvin merged 1 commit into
mainfrom
fix/871-evidence-prefixes
Nov 29, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/871-evidence-prefixes

Conversation

@athvin

@athvin athvin commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #871

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

What

Option (a): the default evidence prefixes are the contract.

  • POST …/models/versions refuses a model whose comparison_vector_value / match_weight / term_frequency_adjustment column prefixes are not gamma_ / mw_ / tf_. It returns 422 and names each offending key.
  • The evidence fields on UncertainPair, ScoredPair and ResolveCandidate document the key format (gamma_<c>, mw_<c>, mw_tf_adj_<c>, match_weight), so it reaches openapi.public.json.

Why

A customer admin could upload a custom-prefix model and silently lose matched_fields, matched_on and every evidence explanation. Choice: (a) over (b). Nothing needs custom prefixes, every fixture uses the defaults, and a fixed documented contract is what a public integrator can rely on. (b) stays possible later as an additive change.

Proof

make check exit 0. Lib test a_model_with_custom_evidence_prefixes_is_refused: match_weight_column_prefix: weight_ gets a 422 naming the key, and the stock model passes the check. Grepped every fixture model: all 20 use the defaults.

Risk & rollback

An existing custom-prefix model in a registry is not touched; only new uploads are checked. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on brians-MacBook-Pro · 2026-11-29T13:57:27Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

🤖 Generated with Claude Code

…s is refused, and the key format is documented (#871)

matched_fields, the matched_on filter and the evidence blobs are derived
by stripping the hardcoded gamma_ / mw_ / mw_tf_adj_ prefixes. Since
POST …/models/versions is a public admin operation, a customer could
upload a model with custom *_column_prefix values and silently lose
every explanation.

Option (a) of the ticket: the defaults are the contract.
create_model_version refuses a model whose comparison_vector_value /
match_weight / term_frequency_adjustment prefixes are not gamma_ / mw_ /
tf_, with a 422 naming each offending key. It does this before any
Postgres work. The evidence fields on UncertainPair, ScoredPair and
ResolveCandidate now document the key format, so it reaches
openapi.public.json. Every fixture model already uses the defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

@athvin
athvin merged commit 42dbb34 into main Nov 29, 2026
48 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 29, 2026 12:31 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — dbd9b427 Deployed Nov 29, 2026 by athvin via remove closed PR previews #167
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.

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

2 participants