Skip to content

Round 23: split census.manifest into a package (no behaviour change); STATUS.md, CLAUDE.md, plan archive - #20

Merged
cafeTechne merged 8 commits into
defaultBranchfrom
phase23/split-manifest
Nov 16, 2026
Merged

cafeTechne merged 8 commits into
defaultBranchfrom
phase23/split-manifest

Conversation

@cafeTechne

Copy link
Copy Markdown
Owner

Splits the manifest module into focused modules without changing scientific behavior or rendered methods/validation results. The original facade docstring and every baseline public/private/imported attribute remain available.

What moved where

Module Contents
schema Constants, serialization/hash/loading, identifiers and release/formula/specification helpers
external External names, source descriptions and circularity checks
adjustments RPP/CPI validation, defaults and adjustment execution
derivations Age-standardization validation and defaults
replicates VRE validation/acquisition/derivation, completeness and digest/read helpers
datasource Declared/observed data-source provenance
validate Validation stages; validate_manifest body is 15 lines
create Manifest creation/registration
methods_text Paragraph builders; methods_section body is 30 lines
run Execution, variants, analysis dispatch, hypotheses and bundles; run_manifest remains unsplit
init Unchanged original docstring and explicit sorted compatibility re-exports only

Section 6 acceptance outputs

478 snapshots from 11 manifests -> /tmp/golden_after.json
Namespace superset preserved; MCP imports; facade imports only; all modules <=900 lines.
   318 census/manifest/__init__.py
   341 census/manifest/adjustments.py
   129 census/manifest/create.py
    74 census/manifest/datasource.py
    79 census/manifest/derivations.py
   113 census/manifest/external.py
   480 census/manifest/methods_text.py
   331 census/manifest/replicates.py
   824 census/manifest/run.py
   256 census/manifest/schema.py
   498 census/manifest/validate.py
  3443 total
cmp golden snapshots: no output
comm missing baseline names: no output
1634 passed, 37 skipped, 4 warnings, 48 subtests passed in 300.36s (0:05:00)
import mcp_server: exit 0
grep top-level def/class in the facade: no output

Baseline: 1,634 passed / 37 skipped. All 478 snapshots from 11 manifests are byte-identical. All 122 baseline names are preserved (132 after package child-module names). No production function/constant names or messages changed; moved function bodies/comments were checked verbatim apart from relative import depth before the two golden-covered extractions. No run_manifest split or feature/bug work is included.

Section 0.7 least-change exceptions: the packaging test's exact expected list had to include the required subpackage, and the full suite exposed an omitted _run_analysis spy in tests/test_manifest_multistate.py. Only that patch target and the three listed failing targets were retargeted; assertions were not weakened. Listed tests that passed unchanged were left unchanged, including the documented fault-injection coverage caveat.

Documentation changes are one exact source-path substitution in STATUS.md and the requested changelog entry. Study/audit content was not reviewed or edited. No other application modules, dependency, version, tag or release changes. All commits carry skip markers; GitHub CI was not run. No merge is requested.

Status table

Item Status Notes
Baseline suite line PASS 1634 passed, 37 skipped, 4 warnings, 48 subtests passed in 292.07s (0:04:52). Initial sandbox-only socket/MCP failures were rerun outside that restriction before code changed.
Golden snapshot count PASS 478 snapshots from 11 manifests; baseline namespace 122 names.
Unlisted definitions placed None All 68 original functions and 31 constants were listed; 23 imported compatibility names re-exported from schema.
Packaging change PASS; least-change exception (0.7) pyproject packages now ["census", "census.manifest"]. Updated only the identical expected list in tests/test_packaging.py; its old hard-coded assertion conflicted with required packaging.
Test patch targets changed Three listed failures; one omitted target (0.7) r15 latest_rpp_year -> adjustments; r12 replicates_digest -> run; r14 default_rpp_areas -> adjustments. Full suite also exposed tests/test_manifest_multistate.py::_run_analysis (omitted from section 4): retarget only its patch to run._run_analysis. Assertions unchanged.
Section 5: validate_manifest PASS 15 body lines; six private helpers; identical ordered errors and golden snapshots; checkpoint b full suite 1634 passed / 37 skipped.
Section 5: methods_section PASS 30 body lines; nine paragraph helpers; identical rendered bytes; post-commit checkpoint c full suite 1634 passed / 37 skipped.
run_manifest stages (for later) Not split Plan/extract; harmonize/aggregate/frame; fetch/derive replicates; external join; exclusions/adjustments; fit; save analysed data; corrected hypotheses; bundle.
Bugs noticed (not fixed) Fault-injection coverage caveat test_analysed_data_failure_does_not_lose_the_run passes without verifying its facade mock was called; after the move that mock is ineffective. Left unchanged per section 4. No production bug fix included.
Module line counts PASS init 318; schema 256; external 113; adjustments 341; derivations 79; replicates 331; datasource 74; validate 498; create 129; methods_text 480; run 824. Facade has only its unchanged docstring and explicit imports.
Final suite line PASS 1634 passed, 37 skipped, 4 warnings, 48 subtests passed in 300.36s (0:05:00). Same pass/skip counts as baseline and a/b/c; golden byte-identical, no lost names, MCP imports, caps satisfied.

Planner review

  • Re-ran acceptance independently: golden snapshot byte-identical to a baseline taken before the plan (478 snapshots); full suite 1,634 passed, 37 skipped.
  • The two section 0.7 exceptions (packaging test list, test_manifest_multistate spy) are correct; the plan missed them.
  • Fixed the coverage gap the agent reported, and a second one of the same kind: after the split, mock.patch on census.manifest._write_analysed_data (test_tract_harmonization) and on census.manifest.validate_manifest (test_manifest_releases) no longer reached the calls inside census/manifest/run.py, so both tests passed without injecting anything. Both now patch census.manifest.run and assert the mock was called. The two census.manifest.run_manifest patches still work (the caller looks the name up through the facade at call time).
  • This PR also carries the Round 23 plan, scripts/refactor_golden.py, STATUS.md, CLAUDE.md and the removal of PLAN_ROUND_1–22 from the tree (kept at tag v0.21.0).

@cafeTechne
cafeTechne merged commit d1e4443 into defaultBranch Nov 16, 2026
11 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant