Skip to content

test(disk-hygiene): cover least-observable engine paths (F8) - #1143

Merged
kyle-sexton merged 1 commit into
mainfrom
test/1114-dh-engine-coverage
Jul 23, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
test/1114-dh-engine-coverage

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

dh 0.7.3 — test-only release for the disk-hygiene consumer-audit item (F8). Adds LeastObservableEnginePathTests (21 tests) to test_hygiene.py, covering exactly the engine paths a consumer can least verify live. Every test mocks the OS surface, so both CI lanes exercise the same branches regardless of host platform:

  • windows_handle_state — CreateFileW error-code mapping (32/33 → open, 5/1314 → needs_elevation, unknown codes fail closed as unverified), handle closed on success, directory probes use FILE_FLAG_BACKUP_SEMANTICS while file probes use FILE_ATTRIBUTE_NORMAL. Mocked via a fake ctypes namespace patched onto the module.
  • posix_handle_state — lsof parsing: missing lsof, stderr diagnostics, unexpected exit codes, and timeouts all fail closed as unverified; +D (directory) vs -- (file) command shapes asserted. Mocked via shutil.which + subprocess.run patches (existing suite idiom).
  • windows_storage_sense_state — registry reads via a sys.modules winreg fake (works on both platforms since the function imports winreg lazily): set / zero / missing values, and missing key → all-None unknown state.
  • _decode_mountinfo_path — octal escapes (\040, \011, \134, consecutive) decoded; non-octal (\81a) and truncated-at-end (\04) sequences left verbatim.
  • non-Git VCS marker branch — nested, enclosing, and casefolded (.SVN) markers all produce the non-Git VCS state is not independently verified error and tracked_blocker fails closed with vcs-state-unverified.

No engine behavior change — hygiene.py is untouched. No latent bugs surfaced while writing the tests (per the issue's acceptance criteria, none needed fixing or filing).

Test plan

  • Suite passes locally on Windows: python -m unittest test_hygiene → 151 tests, OK (4 platform skips)
  • bash plugins/disk-hygiene/skills/clean/scripts/hygiene.test.sh → OK
  • scripts/check-changelog-parity.sh --check-bump origin/main → pass (0.7.3 bump + CHANGELOG entry)
  • CI ubuntu lane green (the Linux half of the issue's "Windows + Linux lanes" criterion)

Related

Closes #1114. Source: handoff-inbox item 20260723-021058-disk-hygiene-0-6-4-consumer-audit, finding F8.

🤖 Generated with Claude Code

dh 0.7.3 — test-only release for #1114. Adds LeastObservableEnginePathTests
(21 tests) covering the engine paths a consumer can least verify live, each
with mocked OS surfaces so both CI lanes exercise the same branches:

- windows_handle_state: CreateFileW error mapping (32/33 -> open, 5/1314 ->
  needs_elevation, unknown -> unverified), handle closed on success,
  directory probes use FILE_FLAG_BACKUP_SEMANTICS
- posix_handle_state: lsof parsing — missing lsof, stderr diagnostics,
  unexpected exit codes, and timeouts all fail closed; +D vs -- command
  shapes for directories vs files
- windows_storage_sense_state: registry reads via a sys.modules winreg fake
  (set / zero / missing values, missing key)
- _decode_mountinfo_path: octal escapes decoded; non-octal and truncated
  sequences left verbatim
- non-Git VCS marker branch: nested, enclosing, and casefolded markers all
  flag vcs-state-unverified (fail closed)

No latent engine bugs surfaced; hygiene.py is untouched. Suite: 151 tests
passing on the Windows lane locally.

Co-authored-by: Claude Fable 5 <[email protected]>
@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Automated review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

Re-running the job, or pushing a new commit, will retry the review.

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Automated security review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

Re-running the job, or pushing a new commit, will retry the review.

@kyle-sexton
kyle-sexton merged commit 50806fb into main Jul 23, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the test/1114-dh-engine-coverage branch July 23, 2026 11:55
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.

test(disk-hygiene): cover least-observable engine paths (F8)

1 participant