Skip to content

fix(#376): use -uall in git status to detect files in pre-existing untracked dirs#377

Merged
azalio merged 1 commit into
mainfrom
claude/compassionate-cerf-odtwun
Jul 19, 2026
Merged

fix(#376): use -uall in git status to detect files in pre-existing untracked dirs#377
azalio merged 1 commit into
mainfrom
claude/compassionate-cerf-odtwun

Conversation

@azalio

@azalio azalio commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #376.

validate_mutation_boundary, record_subtask_baseline, record_scope_baseline, refresh_blueprint_affected_files, and _current_subtask_changed_files all used git status --porcelain without -uall. Without that flag, git collapses an entire untracked directory to a single ?? docs/ entry rather than listing the individual files inside it.

Root cause: When a directory was already untracked before a subtask started, the per-subtask baseline captured docs/ (collapsed). The subtraction in validate_mutation_boundary then removed that one entry, making any new file added inside docs/ completely invisible to the scope check — neither flagged as unexpected nor shown as expected-satisfied.

Fix: Add -uall to all five git status invocations so files are always recorded at file granularity. Both baseline capture and actual-set construction now use the same granularity, so the subtraction correctly suppresses pre-existing files while still surfacing new additions inside a pre-existing untracked directory.

Changes

  • src/mapify_cli/templates_src/map/scripts/map_step_runner.py.jinja: switched all five git status --porcelain calls to git status --porcelain -uall, added inline comments explaining why
  • src/mapify_cli/templates/map/scripts/map_step_runner.py + .map/scripts/map_step_runner.py: rendered output (via make render-templates)
  • tests/test_map_step_runner.py: 4 new regression tests

Test plan

  • TestValidateMutationBoundary::test_new_file_in_preexisting_untracked_dir_is_visible — reproduces the exact validate_mutation_boundary: new files inside a pre-existing untracked directory are invisible (false-negative scope check) #376 scenario end-to-end
  • TestValidateMutationBoundary::test_baseline_subtraction_file_granular_not_dir_collapsed — verifies baseline uses file granularity, not dir names
  • TestRecordSubtaskBaseline::test_baseline_records_individual_files_in_untracked_dirs — verifies record_subtask_baseline records docs/a.md, not docs/
  • TestRecordScopeBaseline::test_scope_baseline_records_individual_files_in_untracked_dirs — same for branch-wide baseline

All 3816 tests pass (make check green, render check passes).


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved change tracking for untracked directories.
    • Newly created files inside existing untracked directories are now detected individually, preventing mutation checks from overlooking them.
    • Git status errors now provide more accurate command details.
  • Tests

    • Added regression coverage for baseline recording and mutation validation involving untracked directory contents.

…tracked dirs

`validate_mutation_boundary`, `record_subtask_baseline`, `record_scope_baseline`,
`refresh_blueprint_affected_files`, and `_current_subtask_changed_files` all used
`git status --porcelain` without `-uall`. Without that flag git collapses an
untracked directory to a single `?? docs/` entry rather than listing individual
files inside it.

When a directory was already untracked before a subtask started the per-subtask
baseline captured `docs/` (collapsed); the subtraction in validate_mutation_boundary
then removed that one entry and any new file added inside `docs/` became completely
invisible to the scope check — not as unexpected, not as expected-satisfied.

Fix: add `-uall` to all five git status invocations so files are always recorded
at file granularity. Both baseline capture and actual-set construction use the same
granularity, so the subtraction correctly suppresses pre-existing files while still
surfacing new additions inside a pre-existing untracked directory.

4 new regression tests cover the end-to-end scenario from the bug report and verify
that baselines record individual file paths rather than collapsed directory names.
@azalio
azalio merged commit cd00d02 into main Jul 19, 2026
1 check passed
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 087ac322-94ae-4934-8521-c999422d6c3f

📥 Commits

Reviewing files that changed from the base of the PR and between 226ed8f and e62ef22.

📒 Files selected for processing (4)
  • .map/scripts/map_step_runner.py
  • src/mapify_cli/templates/map/scripts/map_step_runner.py
  • src/mapify_cli/templates_src/map/scripts/map_step_runner.py.jinja
  • tests/test_map_step_runner.py

📝 Walkthrough

Walkthrough

The change switches Git status snapshots to --porcelain -uall across baseline and mutation-boundary checks. Regression tests verify that files added inside pre-existing untracked directories are detected individually.

Changes

Untracked file mutation tracking

Layer / File(s) Summary
File-granular status capture
.map/scripts/map_step_runner.py, src/mapify_cli/templates/map/scripts/map_step_runner.py, src/mapify_cli/templates_src/map/scripts/map_step_runner.py.jinja
Baseline, validation, and follow-up Git status calls now use --porcelain -uall, with updated comments, docstrings, and error messages.
Baseline and boundary regression coverage
tests/test_map_step_runner.py
Tests verify file-level baseline recording and detection of new files inside pre-existing untracked directories.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

A rabbit hops through status lines,
Where hidden files now show their signs.
No folder masks the files within,
New paths appear when checks begin.
“Hop hooray!” the bunny grins.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/compassionate-cerf-odtwun

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

validate_mutation_boundary: new files inside a pre-existing untracked directory are invisible (false-negative scope check)

2 participants