Skip to content

test(architecture): catch empty feature dirs left behind by slice renames#42

Merged
xmap merged 1 commit into
mainfrom
arch-fitness/no-empty-feature-dirs
Jun 5, 2026
Merged

test(architecture): catch empty feature dirs left behind by slice renames#42
xmap merged 1 commit into
mainfrom
arch-fitness/no-empty-feature-dirs

Conversation

@xmap
Copy link
Copy Markdown
Owner

@xmap xmap commented Jun 5, 2026

Summary

  • New fitness test_no_empty_feature_dirs.py: fails on any direct subdirectory of <bc>/features/ that holds zero git-tracked files
  • Catches rename leftovers where __pycache__ keeps an old slice dir alive on disk after git mv, invisible to the tracked-set enumerators used by test_slice_contract.py
  • 11 such ghosts (filesystem only, never tracked) were deleted as part of arriving at green; no git footprint from the deletions

Why

  • After the recent equipment-ladder + naming sweep, multiple slices were renamed (R3 noun-LAST, preposition drop, define-vs-register). The old directories quietly survived because of __pycache__ and were still being counted in module docs and slice tallies.
  • Existing fitnesses enumerate from 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

BC Ghost -> likely successor
equipment enter_maintenance -> enter_asset_maintenance
equipment exit_maintenance -> exit_asset_maintenance
equipment restore_from_maintenance -> restore_asset
equipment update_placement -> update_frame_placement + update_mount_placement
equipment update_frame -> update_frame_placement
agent re_debrief_run -> regenerate_run_debrief
calibration append_revision -> append_calibration_revision
federation register_permit -> define_permit
operation run_procedure -> start_procedure / conduct_procedure
trust check_in_to_visit -> check_in_visit
trust check_out_from_visit -> check_out_visit

Test plan

  • Fitness green on cleaned tree (223 dirs / 223 pass)
  • Verified red on injected ghost (mkdir ghost_test_dir with only __pycache__ -> fails with directed message), then green after cleanup
  • Pre-commit + arch-fitness suite green locally

…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).
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Coverage report

This PR does not seem to contain any modification to coverable code.

@xmap xmap merged commit 595c5db into main Jun 5, 2026
4 checks passed
@xmap xmap deleted the arch-fitness/no-empty-feature-dirs branch June 5, 2026 12:54
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