Repository navigation
knowledge: reject foreign records in a source-snapshot pack - #463
amy-why-3459 merged 1 commit into
Conversation
A pack with _provenance.json holds only generated schema-2 records. The catalog now rejects any other JSON record there, including a schema-1 record mixed into the pack and a _provenance.json copied into a subdirectory, which was previously read as an incomplete record. Packs without a snapshot keep their hand-written schema-1 records. Follows the review questions on InferMatrixLab#359. Refs InferMatrixLab#355. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
@amy-why-3459 @zengchuang-hw ready for review at
One new test covers both cases; it fails on main without the CI at this head is green: |
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base f536288 and head 9ce1227.
Verified a source-snapshot pack (_provenance.json present) now rejects any JSON file that is not schema 2, including a nested _provenance.json and a resolved schema-1 record, with an error that names the pack and path (src/inferrsi/knowledge/catalog.py). Packs without a snapshot are unchanged. tests/test_source_snapshot.py covers the load path and both rejections; docs/knowledge-contribution-workflow.md states the rule. This addresses the two non-blocking catalog.py questions from the #359 re-review (#359 (comment)).
Hosted full-check (3.10 and 3.11), installed-package, declarations, pr-references and dashboard-browser are green on this head. Accuracy and performance comparison experiments are not applicable: this is a catalog validation guard plus tests and a doc sentence, with no model-output or performance claim.
zengchuang-hw
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Independent first review for the request in #463 (comment), acting through zengchuang-hw under the account holder's standing InferRSI review/Approve delegation. Reviewed base f536288 → head 9ce1227. No previous review by this account on this PR.
Read the actual three-file diff, catalog traversal/validation, source-snapshot resolution, contribution contract and governing #355 accepted representation. The catalog rejects non-schema-2 records in snapshot-backed packs before normal validation, while retaining root-only manifest skipping, schema-2-to-public-schema-1 resolution and snapshot-free schema-1 packs. The regression exercises the valid root snapshot, a nested manifest and a resolved schema-1 record in a generated pack. No blocking defect found.
Executed in an isolated checkout at this head:
- 58 tests passed across test_source_snapshot, test_knowledge_contract, test_knowledge_tiers and test_knowledge_cli.
- git diff --check passed.
- Independently checked current-head hosted full-check and installed-package jobs for Python 3.10/3.11, dashboard-browser, declarations and pr-references: all success.
Not run locally: full suite, clean-wheel installation, browser tests, Python 3.10/3.11 matrix or Ruff (Ruff unavailable in this local environment; hosted full-check passed). No hardware/model performance or campaign acceptance claim.
Resolved items: the two catalog boundary behaviors are now explicit and regression-tested. Approval-before items: none for this bounded change. Non-blocking suggestions: none. No merge performed.
Follow-up to #359, addressing the two non-blocking questions on
catalog.pyin the re-review.Problem
inferrsi.knowledge.catalogresolves schema-2 records in a pack that has_provenance.json, but still accepts any other JSON file there. On mainf5362887:_provenance.jsoncopied into a subdirectory is read as a record and rejected only as "Incomplete knowledge record", which hides what went wrong.Change
src/inferrsi/knowledge/catalog.py: in a pack that has_provenance.json, any JSON record that is not schema 2 is rejected with a message naming the pack and path. Only the root_provenance.jsonis the snapshot. Packs without a snapshot keep their hand-written schema-1 records unchanged.tests/test_source_snapshot.py: one test builds a pack with the real snapshot and one stored record, then checks that it loads, that a nested_provenance.jsonis rejected, and that a resolved schema-1 record in the same pack is rejected. Without the catalog change, the nested case fails with the "incomplete" message and the schema-1 case is accepted.docs/knowledge-contribution-workflow.md: one sentence stating the rule.No generated record, generator or skill-library file changes, so this PR does not touch the shared snapshot or coverage view that knowledge PRs regenerate.
The re-review's other notes need no code change here: main's workflow doc already states that the declaration path lists overlap, and the manual re-pin after a squash merge is listed under its limits.
Verification
At head
9ce122749cb37fbe9b19fbe2cbc7ed13d6b3670dover mainf536288710c726a827bfa3e4357c2c911984cbc3:tests/test_source_snapshot.pyandtests/test_knowledge_tiers.py: 28 passed, exit 0 (Python 3.13, Windows).ruff check src tests toolswith ruff 0.17.5, the version CI installed for Extend VLA observation-to-action benchmark guidance #342 on the same day, andgit diff --checkpass.tools/knowledge_declaration_paths.py --base upstream/main --head HEADreports one protected path,src/inferrsi/knowledge/catalog.py, and no generated paths.Hosted Python 3.10/3.11 full and installed-package checks are the full-suite evidence.
Refs #355.
Knowledge authorship declaration