Skip to content

fix(#909): restore coverage for _remember_config_tracked_status with no git binary - #929

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/909
Oct 6, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/909

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

#909: _remember_config_tracked_status in scripts/lib-memory-dir.sh has a no-git-binary branch that walks the filesystem by hand when git is absent from PATH, answering could-not-tell (fail-closed) if an enclosing .git is found, or untracked if not. This branch lost its only test coverage when #899 removed the legacy-migration suite (tests/test_migration_hardening_766.py).

This is a test-only change. Added to tests/test_untrusted_project_haiku_config_726.py:

  • _path_without_git -- a PATH builder that omits git entirely (distinct from the existing _path_with_broken_git, which has git present but failing).
  • _call_tracked_status_directly -- sources lib-memory-dir.sh against a scratch, config-less PROJECT_DIR and calls _remember_config_tracked_status directly, returning its literal stdout.
  • TestNoGitBinaryTrackedCheckFailsClosed with three tests: git-absent plus .git present gives could-not-tell and fail-closed through the full config merge; git-absent with no .git anywhere gives untracked and pass-through; and a positive control with git genuinely present (a different branch of the function).

TDD: wrote the tests, watched green, mutated each pinned assertion to the wrong value and confirmed red, then reverted. Full file: 50 passed both times (python3 -m pytest tests/test_untrusted_project_haiku_config_726.py -v). Full repo pytest was not run locally; CI is this repo's gate.

Review round: an Explore reviewer (no edit grant) found that the original two tests never exercised the no-git branch's own untracked fallthrough -- a degenerate implementation that always answers could-not-tell would have passed. Fixed by adding the third test and correcting overclaiming prose in the docstring and changelog fragment. An oss:auditor pass confirmed the platform skip (pytest.mark.skipif(sys.platform == "win32"), pre-existing, inherited by the new tests) is honest rather than vacuous, and CI covers this via the repo's 12-leg matrix.

Docs: .oss.json's docs_targets is README.md only; grepped for the mechanism's terms there, zero hits -- no-change-needed, test-only fix with no user-facing behavior change.

Closes #909

[AI-generated]

fdaviddpt and others added 2 commits October 6, 2026 20:18
…tatus

#899 removed the legacy-migration suite, which was the only place this
function was exercised with no git binary on PATH at all (distinct from
the existing TestGitTrackedCheckFailsClosed, which has git present but
failing). Added a direct-call test asserting could-not-tell (fail-closed)
when git is absent and an enclosing .git is found by filesystem walk,
paired with a positive control asserting untracked when git is present
and the file is genuinely untracked -- both via a new helper that calls
_remember_config_tracked_status directly rather than through the full
haiku-config merge, which cannot distinguish the two cases (both strip
the same fields).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Self-review's Explore pass found that the first commit only tested one
of the no-git branch's two outcomes (could-not-tell when an enclosing
.git is found); the other outcome (untracked, when the filesystem walk
finds no .git anywhere) was never exercised directly, so a degenerate
no-git branch that always answers could-not-tell regardless of what the
walk finds would have passed the whole suite. Added a third test pinning
that outcome directly, and corrected the class docstring and changelog
fragment, which had overclaimed that both outcomes were already pinned.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit 62c5099 into main Oct 6, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the fix/909 branch October 6, 2026 19:02
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.

Coverage gap: _remember_config_tracked_status with no git binary lost its only tests when the legacy migration was removed

1 participant