test(architecture): catch empty feature dirs left behind by slice renames#42
Merged
Conversation
…ames
When a slice is renamed (e.g. `enter_maintenance` ->
`enter_asset_maintenance`), the old directory survives on disk
only because `__pycache__` keeps it non-empty for `os.rmdir`.
`git ls-files` shows it gone, so `test_slice_contract.py`
(enumerates from the tracked set) cannot see it. Filesystem
listings (`ls`, module docs, slice counts) then keep quoting
the ghost.
This fitness scans `<bc>/features/` from the filesystem and
fails on any direct subdirectory that holds zero git-tracked
files. Untracked-but-in-flight slices (one staged `__init__.py`)
still pass; pure leftover cruft fails with a directed error.
First run identified 11 such ghosts across 6 BCs, all deleted in
the same change as introducing the fitness (no git footprint
since the dirs were never tracked):
agent/re_debrief_run, calibration/append_revision,
equipment/{enter_maintenance, exit_maintenance,
restore_from_maintenance, update_placement, update_frame},
federation/register_permit, operation/run_procedure,
trust/{check_in_to_visit, check_out_from_visit}
Each has an obvious live successor that the rename was moving
toward (R3 noun-LAST, preposition drop, or define-vs-register
convention).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_no_empty_feature_dirs.py: fails on any direct subdirectory of<bc>/features/that holds zero git-tracked files__pycache__keeps an old slice dir alive on disk aftergit mv, invisible to the tracked-set enumerators used bytest_slice_contract.pyWhy
__pycache__and were still being counted in module docs and slice tallies.git ls-files, so they cannot see these. Needed a filesystem-side check that the tracked set still vouches for every directory present.Ghosts cleaned up
enter_maintenance->enter_asset_maintenanceexit_maintenance->exit_asset_maintenancerestore_from_maintenance->restore_assetupdate_placement->update_frame_placement+update_mount_placementupdate_frame->update_frame_placementre_debrief_run->regenerate_run_debriefappend_revision->append_calibration_revisionregister_permit->define_permitrun_procedure->start_procedure/conduct_procedurecheck_in_to_visit->check_in_visitcheck_out_from_visit->check_out_visitTest plan
mkdir ghost_test_dirwith only__pycache__-> fails with directed message), then green after cleanup