Repository navigation
Open
Description
Goal
Consolidate existing shared data/byte contracts and packaged-resource access into explicitly bounded namespaces. This is physical ownership cleanup, not a new contracts framework or a generic common/utils package. It closes root-level scattering and does not include an internal refactor of existing subpackages. Related: #387, #408 and #412.
PR checklist
- C1 — Move shared data/byte contracts and retire old root modules. Put the existing canonical JSON implementation, RunSpec and claim types under
inferrsi.contractsascontracts/json_v1.py,contracts/runspec.pyandcontracts/claim.py; replacecontracts.pywith that package, retainingfrom inferrsi.contracts import RunSpecand keepingcontracts/__init__.pylimited to that one public re-export so there is exactly oneRunSpecinitialization path. In this same PR delete root_json_v1.py,runspec.py,claim.pyandcontracts.py; update active consumers, exact-path policy declarations, docs and tests. Add the bounded exact-root inventory guard here; initialize it to this PR's real post-migration file set, then shrink it in every later removal PR (C2, R1, A1/A2, M1), rather than waiting until R1 to prevent new flat modules. - C2 — Move resource access and separate evidence rules from host I/O. Move the neutral repository-pack facade to
resources/repository_packs.py(inferrsi.resources.repository_packs); put evidence segment/path rules incontracts/evidence.py(contracts.evidence) and directory creation inapps/evidence_layout.py. In this same PR delete root_repo_pack_data.pyandevidence_paths.py; update consumers, manifest/technical-leaf rules, docs and tests. Keep path construction incontracts.evidencefree of filesystem writes;mkdirstays only inapps.evidence_layout, with a focused test proving the split. Indocs/legacy-knowledge-manifest.json, relock thetechnical_leafentry for the moved file (module, file path,file_sha256,allowed_imports,top_level_shape) and repoint thecatalog/infra.inspectioncompatibility targets frominferrsi._repo_pack_datatoinferrsi.resources.repository_packs; per the manifest'sresource_path_revisionnote this relock goes through formal architecture review. Keep thefiles("inferrsi").joinpath("harness", "data", "repo_packs", ...)anchor unchanged so the leaf still imports noinferrsimodule, and keepresources/__init__.pyimport-free.
Dependencies and boundaries
C2 uses the contracts package established by C1. These two PRs must remain independently testable; do not split a move from its consumer updates. No changes to task evaluation, format retirement, model experiments, or ownership of the K02 data files. Keep package data physically under its existing Knowledge/Harness/Benchmark/Apps owners.
Acceptance
- Canonical JSON bytes and error stages, RunSpec validation/round trips, Verdict identity and Harness re-exports retain their existing semantics.
- Contract-package initialization imports no application or core implementation and performs no filesystem I/O;
import inferrsi.contractsis safe and side-effect-free. The repository-pack facade remains a neutral read-only leaf: it must not import Harness to find data. - Preserve the one REPO_TYPES object and the bytes/access semantics of all seven repository packs; assert object identity across the remaining consumers (for example
catalog.REPO_TYPES is resources.repository_packs.REPO_TYPESwhile the root shell still exists) and verify installed-wheel access outside the checkout. - Evidence path construction stays separate from mkdir. The retirement note lists old module paths -> new paths and states the exact external pickle/class-module-path impact, rather than adding indefinite aliases.
- Root tracked-file inventory decreases from 27 to 23 after C1 and to 21 after C2, subject to refreshing the implementation base; record exact file lists, not just counts. The build-generated
_version.pyis not a tracked root business file and is allowed only as wheel metadata.
Delivery discipline
- One implementation Claude session handles only the current PR in an isolated worktree. A second Claude session may only plan the next PR in a separate planning worktree; it must not edit source.
- Move implementation, update all active consumers/docs/tests, and delete the corresponding old root modules in the same PR. Do not introduce permanent compatibility shells or module-registry aliases.
- Preserve CLI command behavior, original evidence bytes, record/format contracts and isolation/security checks. Announce retired Python import/serialization module paths; historical frozen evidence remains pinned to its original commit or wheel, not rewritten.
- Before each implementation or review handoff, refresh main and confirmed dependencies. A completed plan is not implementation or approval. No automatic merge.
Metadata
Metadata
Assignees
Labels
No labels
Activity
amy-why-3459 commentedon Nov 15, 2026
Thanks, the scope is well bounded. I checked it against current main (
1373ef8e) and found a few points to settle before C1 starts:src/inferrsi/currently has exactly 27 tracked root files. C1 removes_json_v1.py,runspec.py,claim.pyandcontracts.py(27 → 23), and C2 removes_repo_pack_data.pyandevidence_paths.py(→ 21). Files under the newcontracts/andresources/packages are not root files, so the counts in the issue hold. There is no root-inventory guard intests/test_module_boundaries.pytoday, so C1 really does introduce it.mindie_*.py,_mindie_read_worker.py), and task: A-entry — canonical Apps entrypoints and application composition #408 A1 removescli.pyandarguments.py. Since the guard pins an exact file list, could the issue say that every later removal PR (C2, R1, M1, A1/A2) has to shrink the list in the same PR? Otherwise whichever PR lands second will fail the guard or quietly leave a stale entry.contractspackage__init__. Todaycontracts.pyis only a 5-line shim re-exportingRunSpec. Keepingfrom inferrsi.contracts import RunSpecmeanscontracts/__init__.pywill eagerly import the RunSpec module, which is fine becauserunspec.pyimports only the stdlib. Could you keep the__init__limited to that one re-export, so that importingcontracts.evidence(C2) or the canonical-JSON module doesn't pull in anything else? That keeps the acceptance criterion "initialization imports no application or core implementation" checkable by a simple import-side-effect test.REPO_TYPESobject. It is defined in_repo_pack_data.py(7 entries) and reachesarguments.pythroughcatalog. After the move, please assert identity (catalog.REPO_TYPES is resources.repository_packs.REPO_TYPES), not just equality, and run the installed-wheel check from a directory outside the checkout.src/has nopickleusage, so the impact is limited to external callers holding pickledRunSpec/Verdictobjects. Stating that explicitly in the retirement note (old module paths → new ones) should be enough, without adding aliases.evidence_paths.pycurrently builds paths and callsmkdir(parents=True, exist_ok=True)in the same function (line 24). A focused test showing thatcontracts.evidenceperforms no filesystem writes would make the separation verifiable.amy-why-3459 commentedon Nov 15, 2026
Thanks, the updated C1/C2 text covers the earlier points (the
contracts/__init__.pyscope, REPO_TYPES identity, the evidence/mkdir split test, and guard shrinking across PRs). One C2 detail is still worth stating explicitly:docs/legacy-knowledge-manifest.jsonpins the leaf astechnical_leafwithmodule: inferrsi._repo_pack_data,file: src/inferrsi/_repo_pack_data.py,file_sha256,allowed_importsandtop_level_shape. Its compatibility pairs includecatalog -> inferrsi._repo_pack_dataandinfra.inspection -> inferrsi._repo_pack_data. Moving the file toresources/repository_packs.pytherefore means relocking the module, path and SHA-256 and repointing those targets. The manifest's own K02resource_path_revisionnotes that such a revision requires formal architecture review. Could C2's checklist call out that relock and review step? The resource anchorfiles("inferrsi").joinpath("harness", "data", "repo_packs", ...)can stay as-is, so the leaf still imports noinferrsimodule.resources/__init__.pyshould likewise stay import-free.