Repository navigation
Discover nested source-package members so the alias-drift guard sees them - #338
Conversation
…them discover_source_package_dirs globbed only */*/source_package.yaml, so nested members (such as chronicle#335's rc_XX members) were invisible to find_alias_map_drift and the default-bundle coverage check: removing a nested member's alias was not reported (review of #335, finding 1). Search recursively instead. On main this finds the same 333 packages as before (none missing, none unmapped); on #335's branch the review measured 367, exactly the alias targets. Also correct the _is_missing_object_diagnostic docstring, which still said incidental mentions stay a fetch error (review r2 of #336). Tests: two new cases (nested members discovered; an unmapped nested member reported), both red under the old two-level glob via an in-memory mutant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Path.rglob does not follow directory symlinks by default, so the recursive discovery from the previous commit lost a case the old two-level glob covered: a symlinked package with no alias escaped the drift guard (review finding on #338). Discovery now walks with os.walk(followlinks=True) and reports each package under its link path. It skips only a directory whose real path is already in its own ancestry, so a cycle ends the walk while two links to one package are both reported, as under the old glob. Tests: a symlinked package and a symlinked family with a nested member are found and flagged when unaliased; a directory and a link to it are both reported; a cycle terminates. Each fails under its own in-memory mutant (plain rglob; a global visited set; no cycle check). On the real tree discovery still equals the old glob and the 333 alias targets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged by the NZ hub (session local_e407a527) at 18545cd with --merge. Gates: |
Follow-up to #335 (finding 1 of its review) and #336 (round-2 docstring nit).
The problem
discover_source_package_dirsinchronicle/source_package.pyglobbed only*/*/source_package.yaml, so it couldn't see nested package members such as #335'sstats_nz/census_2023_family_type/rc_01. Two checks rely on it:find_alias_map_drift(the alias-drift guard from #78) and the default-bundle coverage check.The review of #335 showed the effect: removing a nested member's alias left the drift test green. Only #335's own package test caught it, so a future nested package added without an alias would be dropped from the bundle silently.
The fix
os.walk(followlinks=True).Path.rglob, used in this PR's first commit, does not follow them by default._is_missing_object_diagnosticdocstring inchronicle/artifacts.pynow states the known limit: an error line that merely mentions a missing-object marker still counts as missing.Tests
tests/test_source_package_alias_drift.py, each red under an in-memory mutant:rglob);rglob, and a global visited set in place of the ancestry check);tests/test_source_package_alias_drift.py17 passed;tests/test_chronicle_verify_raw.py37 passed.ruff format --checkflagschronicle/source_package.pyfor an alias line that main already has, which this PR doesn't touch; CI doesn't run a format check.Repository tooling only: no source package, fact or bundle pin changes.
Review
An independent GPT-6.1 Sol review at
202f8211returned APPROVE_WITH_NITS, "Needs Max: no". Its runs: 14 and 37 passed; both new tests red under the old glob; ruff 0.14.10 check passes; its discovery probe matched 333 packages to aliases and showed nested, hidden and vendor manifests tripping the guard.rglobskipped directory symlinks the old glob traversed, so a symlinked package without an alias escaped the guard. No package in the repo is a symlink today. Fixed in866d9211, as above.🤖 Generated with Claude Code