Skip to content

fix(models): report per-file checksum pins in OnnxEncoder.model_sha256 - #403

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/onnx-encoder-file-pins
Sep 15, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/onnx-encoder-file-pins

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #396 (#346). ModelConfig.file_sha256 lets every model file be pinned, and registry.pinned_checksums(cfg) merges it with the primary-file sha256 pin. verify() and pull() already use the merged pins, but OnnxEncoder.model_sha256 still read only cfg.sha256, so a model whose primary file is pinned only through file_sha256 was reported as "unverified". That value is also part of the embedding cache key and the model evidence metadata.

  • OnnxEncoder.model_sha256 now reports pinned_checksums(cfg).get(cfg.files[0]), falling back to "unverified".
  • The other cfg.sha256 readers under src/ need no change: pinned_checksums() is the merge itself, and the status() "not yet published" note already checks cfg.sha256 or cfg.file_sha256.
  • A malformed registry entry (a pin for an unknown file, or conflicting pins) now raises ModelChecksumError when the encoder is constructed rather than at load time.
  • Nothing changes for the shipped registry, where every model is still unpinned.

Tests

New tests in tests/test_models_runtime.py. They use fake model bytes and a patched registry entry; no ONNX runtime or model files are needed.

  • A model pinned only through file_sha256 reports the primary file's digest.
  • A primary pin set through sha256, alongside a tokenizer pin, still reports the primary digest.
  • An unpinned entry reports "unverified".
  • Every model in the shipped registry reports "unverified".

The file_sha256 test fails without the fix.

Verification

  • ruff check .: passed
  • mypy src/freshdata: no issues
  • pytest -m "not online and not large": Python 3.12: 5577 passed, 13 skipped; Python 3.9: 5573 passed, 17 skipped

#346 / PR #396 added ModelConfig.file_sha256 so every model file can be
pinned, and registry.pinned_checksums(cfg) merges it with the primary-file
sha256 pin. verify() and pull() use the merged pins, but
OnnxEncoder.model_sha256 still read only cfg.sha256. A model whose primary
file is pinned only through file_sha256 was reported as "unverified", and
that value also keys the embedding cache and the model evidence metadata.

model_sha256 now reports pinned_checksums(cfg).get(cfg.files[0]), falling
back to "unverified". The other cfg.sha256 readers were checked and are
already correct: pinned_checksums() is the merge itself, and the status()
note tests "cfg.sha256 or cfg.file_sha256".

Behaviour for the shipped registry, where nothing is pinned yet, is
unchanged.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0bd58a47-5be3-4c9c-98d5-e99e40dcb18a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

FreshData benchmark report — performance

  • freshdata: ?
  • python: ?
  • platform: ?
fixture n_rows n_cols p50 s p95 s peak MB repair % false-repair % preserve % trust monotonic export %

Authored-code reduction (Metric 6)

@kevincostner17
kevincostner17 merged commit c86251a into main Sep 15, 2026
21 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.

1 participant