Skip to content

test(disk-hygiene): mock sys.argv in run_guard* helpers to seal the kill-switch argv seam #970

Description

@kyle-sexton

Lane: work-2. Source: #968 security-review SUGGESTION (medium confidence, non-blocking).

Triggering example: in plugins/disk-hygiene/skills/clean/scripts/test_hygiene.py, the helpers run_guard, run_guard_disabled, and run_guard_powershell_disabled patch os.environ but NOT sys.argv.

Observed: after #382, resolve_disk_hygiene_enabled() reads sys.argv[1:] before the env fallback. If a test runner's argv happened to contain --disk-hygiene-enabled true, it would override the env-var mock and a run_guard_powershell_disabled-based test would see ask instead of the expected deny. Standard invocations (python -m unittest, pytest) never produce such argv, so CI is unaffected today — this is latent fragility, not a live failure.

Expected: apply the pattern the new run_guard_enabled_argv helper already demonstrates — mock sys.argv alongside os.environ in the three older helpers — to fully isolate the argv seam.

Category: test-coverage (improvement). Not fail-open; the underlying fix is correct and security-reviewed clean.

Metadata

Metadata

Assignees

Labels

priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions