test: cover local binary parser success and failure paths - #45
rupayon123 wants to merge 7 commits into
Conversation
How to test: python -m pytest -q (76 passed on Python 3.11).
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml 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 |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 critical |
🟢 Metrics 31 complexity · 0 duplication
Metric Results Complexity 31 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
I checked the two Codacy annotations on this PR. Both point to No downloaded or user-supplied pickle is executed by these tests. All nine Python/OS CI test jobs passed. I have left the restricted-unpickler regression intact rather than suppressing the security check; the two annotations need maintainer review as test-fixture false positives. |
|
Additional fixes pushed to this branch:
All 98 local tests pass. Regressions cover safe PyTorch storage references, truncated GGUF fields/partial reads, and authoritative shard-index assignments. PyTorch compatibility is fixture-based; no live torch-generated checkpoint was loaded. Prepared with AI assistance. Changes are submitted for review; this is not a claim of maintainer approval. |
|
September 16 verified update: The checkpoint wrapper and additional PyTorch storage-type regressions are now covered. The final local suite has 105 passing tests. These use controlled metadata/pickle fixtures, not a production PyTorch checkpoint. Commits: Exact current head: AI-assisted with OpenAI Codex; changes and validation were inspected before submission. |
Summary
Adds 12 generated-fixture tests for local SafeTensors and PyTorch headers: valid metadata, truncated and oversized headers, malformed JSON, deduplicated and missing shards, invalid ZIPs, missing/truncated pickle metadata, and the restricted unpickler's rejection of an unapproved builtin.
Motivation & Context
Addresses #29 without downloading model weights, committing binary fixtures, or adding a PyTorch dependency. The existing fixture-based checks remain intact.
Type of Change
How Has This Been Tested?
Python 3.11:
python -m pytest -q— 76 passed, up from 64 on the unchanged base.ruff check tests/test_binary_parsers.pyandgit diff --checkpass.The PyTorch success fixture covers metadata dictionaries inside an archive, not a real torch-generated tensor checkpoint; actual storage reconstruction remains additional coverage work.
Checklist
Prepared with AI assistance; the submitted tests were executed locally.