Skip to content

fix: 3 more Windows glob sites survive #517's sweep (#524, #525, #526) - #530

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/524
Sep 4, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/524

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Same class as #517/#519: bash's own glob only recognises / as a path separator, and REMEMBER_DIR arrives backslash-separated on Git Bash/MSYS2 (per resolve-paths.sh's own _remember_normalize_win_path). The gate-3 release audit ahead of v0.26.0 found three more sites in the same two files #517 already normalized, still calling the raw variable before the glob.

All three now route through the shared _remember_forward_slash helper (scripts/resolve-paths.sh) the same way the other sites in these files already do, rather than inventing a new mechanism.

Regression tests (tests/test_windows_glob_backslash_524_525_526.py) use the same extracted-block technique as tests/test_windows_glob_backslash_517.py: real bash pulled verbatim out of the owning script and run standalone with a synthetic backslash-laden REMEMBER_DIR/staging_path and $OSTYPE shadowed via a local, since a real Git Bash/MSYS2 host was not available to verify this directly (the cross-platform mechanism is reasoned, not observed -- though CI's own windows-latest leg runs real Git Bash and will observe the $OSTYPE=msys branch these tests exercise). Each of the three new fixes was manually confirmed red against the pre-fix code (_SESSION_END_FIRED read 0 instead of 1 with a real log present; the memory count read 0:0 instead of 1:5 with a real file present; the stray .tail-* sibling survived the sweep) before the corresponding test was written, then green after.

The #525 site's loop sits inside an if [ -d "$REMEMBER_DIR" ]; then ... fi guard that the sibling #517 sites (_STAGING_BYTES, $_RT_PENDING) do not have; that guard is a real syscall check that resolves a backslash path fine on actual Windows but cannot be faked on this POSIX test host, so its own test extracts only the loop body (seeding the two counters via setup) rather than the whole if/fi wrapper -- the wrapper itself is untouched and untested here, same as it was before this PR.

Below the bar, recorded rather than fixed: while updating the README paragraph documenting these normalization sites, found the pre-existing "10 _remember_forward_slash call sites in total" claim there already undercounts reality (actually 12, before this PR's own 3 additions) -- plausibly because the storage-mode [[ == ]] comparison calls the helper twice per occurrence and appears twice in the file. Left as-is rather than silently rewritten (logged in trap.d/524.readme-call-site-count-stale.md); this PR's own added sentence deliberately does not restate a new absolute total, to avoid compounding a wrong base number into a wrong new one.

Closes #524. Closes #525. Closes #526.

Same class as #517/#519: bash's own glob only recognises "/" as a path
separator, and REMEMBER_DIR arrives backslash-separated on Git Bash/MSYS2.
The gate-3 release audit ahead of v0.26.0 found three more sites in the
same two files #517 already normalized, still calling the raw variable
before the glob:

- doctor.sh's _SESSION_END_FIRED glob (~line 469) silently stayed 0,
  misreporting SessionEnd as never having fired for a project that
  genuinely has a session-end-*.log. A second, independent path to the
  same misreport was also found and recorded in the changelog fragment:
  eced1f3's age-keyed retention sweep reclaims these same log files after
  thresholds.autonomous_log_retention_days -- that sweep is unrelated
  behaviour and is left untouched here.
- doctor.sh's operator-facing memory-file count (~line 617), the third
  counter of this shape in the file, undercounted to 0.
- run-consolidation.sh's .tail-*/.prefix-* stray-sibling cleanup
  (~line 242) globbed a staging_path that inherits REMEMBER_DIR's
  backslashes, leaking one inert temp file per failed consolidation
  split.

All three now route through _remember_forward_slash the same way the
other sites in these files already do. Regression tests use the same
extracted-block technique as tests/test_windows_glob_backslash_517.py,
with a synthetic backslash-laden REMEMBER_DIR/staging_path and $OSTYPE
shadowed via `local` -- real Git Bash was not available to verify this
directly, so the cross-platform mechanism is reasoned, not observed.

Renamed doctor.sh's new _remember_memory_files_glob_dir to
_remember_memory_glob_dir so its own extraction marker ("fi") does not
collide with the substring "files".

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit 8bd5434 into main Sep 4, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/524 branch September 4, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant