Skip to content

refactor(C2): relocate resource facade and split evidence layout - #458

Merged
Dong1017 merged 2 commits into
mainfrom
impl/c2-resources-t376
Nov 15, 2026
Merged

Dong1017 merged 2 commits into
mainfrom
impl/c2-resources-t376

Conversation

@Dong1017

Copy link
Copy Markdown
Collaborator

Scope

Refs #451 — C2 in the accepted eight-PR sequence; this does not close the issue.

  • Move the byte-identical neutral pack reader to resources/repository_packs.py, with an import-free parent, one shared seven-entry REPO_TYPES object, and the unchanged files("inferrsi").joinpath("harness", "data", "repo_packs", ...) anchor. Pack data stays with its current owner; no Harness/core import or new mandatory dependency.
  • Split pure evidence paths into contracts/evidence.py and directory creation into apps/evidence_layout.py, preserving signatures, order, errors, and mkdir behaviour. Retire both old root modules in this PR, without shells or aliases; update active consumers and negative import/pickle checks.
  • Shrink the exact tracked-root guard from 23 to 21 and retain its negative controls and wheel-only generated-version allowance. Preserve C1's single RunSpec initialization/identity and no-IO invariants.
  • Relock the manifest's exact relocated leaf/module/file/SHA/import/shape/parent constraints and two importer targets; retain all nine staged compatibility pairs. The manifest description, base/revision provenance and canonical-route notes are updated too. Formal architecture review of this relock is required and has not been obtained or self-approved.
  • Independently update CHANGELOG.md, docs/architecture.md, docs/module-layout.md, and docs/contracts/current-design.md, including the retirement/pickle notice and staged/final-boundary distinction. Historical/frozen evidence is not rewritten.

R1's eleven old-entry retirements and permanent exact inspection rule are not implemented here; neither are A/M or later loader work. Existing staged isolation blockers remain, rather than prematurely asserting the final gate is clear. The older architecture data block and SVG were not expanded into a separate cleanup.

Independent validation

The tested source checkpoint is 23fc2a2ad21d4d9600780aa20daed2ebc9fb7eba; the final commit is documentation-only, and all 20 tested source/test/manifest path bytes were independently verified unchanged after documentation completion.

  • Ten focused pytest modules: 199 passed + 108 subtests, exit 0 (test_contracts_package, test_evidence_paths, test_first_wave_isolation_policy, test_knowledge_compatibility_shells, test_module_boundaries, test_package_root_inventory, test_repository_packs_facade, test_resource_migration, test_smoke, test_target_module_import_gate).
  • Changed Python files: Ruff zero findings, exit 0. This is not a claim that the full repository suite or repository-wide lint is green; the four existing run_store.py F811 diagnostics are outside this change.
  • Separate semantic checks: 65 vectors, seven packs, 954 source-owned resource files byte-compared, consumer tuple identity, cold facade no-core/no-business-IO with positive controls, path/error/IO split, retired imports and old function-pickle negatives, canonical pickle roundtrips, exact root21, precise manifest/closure rules. PASS.
  • Real SCM sdist -> wheel -> standard installation in a fresh venv, executed outside the checkout: unchanged full tests/check_installed.py, installed C2 semantics and distribution/version-origin checks all exit 0. 929 applicable installed resource files match the baseline bytes; all seven packs, identity/no-core/no-IO/path vectors pass.
  • Wheel tested: 0.1.11.dev18+g23fc2a2ad; SHA-256 74cb649250138a580ee90205b6792990f6dacaf6ca4930f7f1037eeccf2b32e3. This artifact belongs to the source checkpoint above, not a rebuild of the later docs-only head.

Preserved environment failures: the first coordinator helper used the Windows default GBK decoder for UTF-8 JSON; only the outside-repository helper encoding was corrected. The first fresh no-deps venv full installed check lacked the project's already-declared optional [skills] dependency PyYAML>=6.0; installing that dependency in that venv made the unchanged checker pass. Original failed receipts remain. No checker bypass, global configuration change, dependency-policy change or repeated broad build/test run was used.

Git/main and authorship

Base main is cd8fcb452bd2c7969a7a6e2544aa1cb5f8ad5332 (merged PR453, with #450 already in its ancestry), freshly fetched before delivery and unchanged. This branch contains the normal source checkpoint plus one normal documentation commit; no history rewrite or additional merge was necessary.

All material changed product/source/test/manifest and documentation content is from the original Claude Code Fable session. Local provenance review replayed successful tool mutations for all 20 source/test/manifest paths from the base (ordinary Git LF/CRLF normalization only). The final four documents were independently written by that same session using Read/Edit only and replay-verified against their saved originals. An unused coordinator documentation draft stayed outside the checkout and was never supplied to the session or applied. The coordinator scoped the task, independently validated/read the results, and performed Git/PR metadata operations; it did not rewrite the product/docs content. No governance exception is sought.

The following model/effort values are the explicitly requested/reported client settings, not independent backend attestation.

{"schema_version":1,"head_sha":"def0557ff99ddc804a7084710003eb5a80b7e04b","human_only":false,"material_ai_authors":[{"tool":"Claude Code","model_id":"claude-fable-5-2","effort":"max","role":"author"}]}

Formal architecture/content review and the normal CI/review gates remain pending. No auto-merge or issue closure is requested.

Agent-assisted-by: Claude Code (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
Agent-assisted-by: Claude Code (author)
Signed-off-by: GUOGUO <xwdong1998@163.com>
@Dong1017 Dong1017 added the kind:task Bounded delivery task with a delegated slice label Nov 15, 2026

@amy-why-3459 amy-why-3459 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

PR review verdict — PASS
Reviewed base cd8fcb452bd2c7969a7a6e2544aa1cb5f8ad5332 and head def0557ff99ddc804a7084710003eb5a80b7e04b (source checkpoint 23fc2a2ad21d4d9600780aa20daed2ebc9fb7eba, then the docs-only commit).

This also covers the formal architecture review of the docs/legacy-knowledge-manifest.json C2 relock requested in #451:

  • src/inferrsi/resources/repository_packs.py is byte-identical to the retired root _repo_pack_data.py. SHA-256 751d7bf663318962a2e73cf9d75369e0f8f8c2bda27964c56e44021b9f86c992 matches technical_leaf.file_sha256 and both sides of module_path_revision.
  • The leaf module/file, neutral_leaf_export, and the catalog / infra.inspection pair targets all point at inferrsi.resources.repository_packs. The nine-pair count is unchanged, and no pair remains on inferrsi._repo_pack_data.
  • The importlib anchor, allowed imports, two symbols, and REPO_TYPES object identity across catalog, knowledge.catalog, and arguments are preserved. resources/__init__.py is import-free. contracts.evidence only builds paths; ensure_evidence_layout lives in apps.evidence_layout with the same mkdir(parents=True, exist_ok=True) call. The two old root modules are gone with no alias, and the exact root inventory shrinks 23 → 21.
  • Hosted CI on this head is green, including full-check and installed-package on 3.10 and 3.11. I did not independently re-run the author's outside-checkout wheel install.

No blocking findings. The issue stays open, as this PR does not close #451.

@Dong1017
Dong1017 enabled auto-merge (squash) November 15, 2026 16:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

PR review verdict — PASS
Reviewed base cd8fcb452bd2c7969a7a6e2544aa1cb5f8ad5332 and head def0557ff99ddc804a7084710003eb5a80b7e04b (source checkpoint 23fc2a2ad21d4d9600780aa20daed2ebc9fb7eba, then docs-only).

Acting reviewer: cursor[bot] via standing InferRSI steward delegation (independent of author Dong1017). Binding formal review to current head.

Verified against #451 C2 acceptance:

  • resources/repository_packs.py SHA-256 751d7bf663318962a2e73cf9d75369e0f8f8c2bda27964c56e44021b9f86c992; old root _repo_pack_data.py and evidence_paths.py removed with no alias; resources/__init__.py import-free; tracked root .py inventory is 21.
  • contracts.evidence has no mkdir/filesystem writes; apps.evidence_layout.ensure_evidence_layout retains mkdir(parents=True, exist_ok=True).
  • Manifest technical_leaf / catalog / infra.inspection targets point at inferrsi.resources.repository_packs; remaining _repo_pack_data strings are revision-history / path-revision provenance only; nine compatibility pairs retained.
  • Focused local pytest on the ten claimed modules: all green; ruff clean on changed Python leaves. Hosted CI on this head green (lint-and-smoke, full-check 3.10/3.11, installed-package 3.10/3.11, declarations, pr-references, dashboard-browser, knowledge-model-policy).
  • Formal architecture review of the C2 manifest relock: accepted on this head (aligns with amy-why-3459's prior Approve covering the same points).

No blocking findings. Refs #451 only; does not close the issue.

Copy link
Copy Markdown
Collaborator Author

@amy-why-3459 @zengchuang-hw Please review C2, tracked by Issue451. This PR relocates the neutral repository-pack facade, separates pure evidence paths from Apps I/O, retires the two old root modules, and updates consumers and the exact root21/leaf guards. The manifest relock requires formal architecture review; validation and baseline limitations are documented in the PR body.

@Dong1017
Dong1017 merged commit 5db1bc9 into main Nov 15, 2026
9 checks passed

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-merge independent review — C2 scoped code/architecture checks PASS; this is a COMMENT, not an approval or retrospective merge authorization.

Responding to #458 (comment) under the account owner's standing delegation to independently review InferRSI changes as zengchuang-hw. The PR was already merged by Dong1017 before this examination (2026-11-15 16:13:29 UTC); I did not merge it. This assessment does not establish that the required reviews existed before merge.

Range: base cd8fcb4 → exact head def0557. First review of this PR by this account; no previous review link or prior findings to resolve. I read the actual changes, Issue #451, AGENTS and applicable review/contribution guidance independently, without reading other reviewers' opinions.

Architecture/content findings:

  • The relocated repository-pack reader is byte-identical to the base root file (SHA-256 751d7bf663318962a2e73cf9d75369e0f8f8c2bda27964c56e44021b9f86c992). The root-package resource anchor and seven pack semantics remain intact; the new parent initializer is docstring-only. Consumer identity remains shared, with no new Harness import.
  • All three evidence function ASTs match their base implementations. Pure path construction is in contracts.evidence; mkdir remains exclusively in the moved Apps helper, preserving ordering, errors and partial-failure behavior.
  • I examined the manifest relock: exact module/file and the two compatibility targets move together; the nine pairs, locked leaf bytes, exact imports and bounded parent rule remain. The closure checks do not exempt arbitrary resources siblings. This scoped C2 architecture review finds no blocking defect in that relock.
  • Old module imports/function pickles are intentionally retired, documented and tested; root inventory is the exact 21-file stage, not an assertion that R1 or the final isolation boundary is complete. Packaged resource owner paths were not changed.

Independently executed at this head:

  • Ten focused modules: 199 passed, 108 subtests passed (contracts package, evidence paths, first-wave isolation, compatibility shells, module boundaries, root inventory, repository packs, resource migration, smoke and import gate).
  • Changed Python paths: Ruff passed; git diff --check passed.
  • Base-byte / function-AST comparisons and active-source retired-import scan passed.
  • Built a real SCM sdist, then wheel from that sdist at this exact head; installed the wheel into a separate fresh Python 3.12 venv. Ran unchanged tests/check_installed.py outside the checkout with isolated Python and INFERRSI_CHECKOUT_RESOURCES set: 128 records and all 923 applicable installed resource files verified, including byte-for-byte checkout comparison, seven-pack reads, canonical imports and cold no-core facade probe.
  • GitHub reported 9 completed successful checks for this exact head (including both installed-package and full-check versions); those hosted runs are separately reported evidence, not a substitute for the independent checks above.

Retained execution limitations: the initial runtime lacked pytest. After provisioning an isolated test venv, the first focused run had 198 passes and one subprocess import failure because PYTHONPATH was not propagated; rerunning with explicit PYTHONPATH yielded the result above, without editing tests. The first installed check omitted the resource-comparison environment key; the subsequent run used the correct key and passed. I did not independently run the entire repository suite, Windows execution, GPU/service/campaign acceptance, or attest the author's backend/model provenance. No performance or final Issue #451 completion claim is made.

Blocking findings in the examined C2 slice: none. Additional pre-approval actions: not applicable to this already-merged PR; this COMMENT does not grant approval. Non-blocking follow-up: keep the remaining R1/final-boundary work and its separate review gates explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants