fix(models): report per-file checksum pins in OnnxEncoder.model_sha256 - #403
Merged
Merged
Conversation
#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.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
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.
Summary
Follow-up to #396 (#346).
ModelConfig.file_sha256lets every model file be pinned, andregistry.pinned_checksums(cfg)merges it with the primary-filesha256pin.verify()andpull()already use the merged pins, butOnnxEncoder.model_sha256still read onlycfg.sha256, so a model whose primary file is pinned only throughfile_sha256was reported as"unverified". That value is also part of the embedding cache key and the model evidence metadata.OnnxEncoder.model_sha256now reportspinned_checksums(cfg).get(cfg.files[0]), falling back to"unverified".cfg.sha256readers undersrc/need no change:pinned_checksums()is the merge itself, and thestatus()"not yet published" note already checkscfg.sha256 or cfg.file_sha256.ModelChecksumErrorwhen the encoder is constructed rather than at load time.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.file_sha256reports the primary file's digest.sha256, alongside a tokenizer pin, still reports the primary digest."unverified"."unverified".The
file_sha256test fails without the fix.Verification
ruff check .: passedmypy src/freshdata: no issuespytest -m "not online and not large": Python 3.12: 5577 passed, 13 skipped; Python 3.9: 5573 passed, 17 skipped