test(hygiene): cover check-github-settings-drift parseArgs (B-0156 AC#2)#4068
Conversation
Adds tools/hygiene/check-github-settings-drift.test.ts (7 tests, 15 expects) and exports parseArgs from the drift checker so its argv parsing paths are testable. B-0156 Acceptance Criterion #2 requires each TS sibling to have at least one bun test covering its primary entry path. Audit on 2026-05-17 found 3 of 6 ports still missing tests: - tools/hygiene/check-github-settings-drift.ts (this slice) - tools/peer-call/amara.ts (follow-up) - tools/peer-call/ani.ts (follow-up) This slice closes one of the three gaps. Mirrors the sibling test convention in tools/hygiene/snapshot-github-settings.test.ts (beforeEach/afterEach GH_REPO preservation, parseArgs path coverage, no gh CLI dependency). Coverage: - --repo OWNER/NAME with default expected path - --expected PATH override - --repo / --expected without value (error paths) - unknown flag error path - GH_REPO env var fallback - argv > env precedence Substrate-drift note: B-0156 row body still claims 3 .sh ports remaining (tools/profile.sh, tools/peer-call/amara.sh, tools/peer-call/ani.sh) but all 3 are already ported AND their .sh siblings deleted on disk. The remaining work for B-0156 is the AC#2 test-coverage gap, not porting. A follow-up row update is appropriate but outside this slice's bounded scope. Test outcome: bun test tools/hygiene/check-github-settings-drift.test.ts 7 pass, 0 fail, 15 expect() calls bun test tools/hygiene/snapshot-github-settings.test.ts 14 pass, 0 fail (regression check, unchanged) operative-authorization: aaron 2026-05-14: "- **Devil-pole** (edge-runner drive): keep pushing, discover, go hard, never-be-idle" Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds unit test coverage for tools/hygiene/check-github-settings-drift.ts argument parsing to close one of the B-0156 AC#2 gaps, without changing the CLI’s runtime behavior.
Changes:
- Exported
parseArgsfromcheck-github-settings-drift.tsto make argv parsing testable. - Added
check-github-settings-drift.test.tswith focusedparseArgscoverage (argv/env precedence and error paths).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/hygiene/check-github-settings-drift.ts | Exports parseArgs so it can be imported by tests (no behavior change). |
| tools/hygiene/check-github-settings-drift.test.ts | New Bun test suite covering parseArgs success/error cases and GH_REPO fallback/precedence. |
|
CI classification for the failing This is not transient and does not appear caused by this PRs parseArgs test slice. The job fails during snapshot collection before drift comparison:
That is the same admin-only GitHub settings token-scope failure already handled in draft PR #4066. Because #4068 is based on Next safe action: wait for #4066 to land and rebase this PR, or explicitly bring the #4066 sentinelization fix into this branch if #4068 needs to go first. |
Summary
Closes one of three B-0156 Acceptance Criterion #2 gaps by adding
tools/hygiene/check-github-settings-drift.test.ts(7 tests, 15 expects). ExportsparseArgsfrom the drift checker so its argv parsing paths are testable; no behavior change to the CLI.B-0156 AC#2 requires each non-install
.sh→.tsport to have at least onebun testcovering its primary entry path. Audit on 2026-05-17 found:tools/hygiene/snapshot-github-settings.tstools/hygiene/check-github-settings-drift.tstools/hygiene/check-tick-history-shard-schema.tstools/peer-call/amara.tstools/peer-call/ani.tstools/profile.tsCoverage
Mirrors
tools/hygiene/snapshot-github-settings.test.tsconventions (sibling-portparseArgstests, hermeticGH_REPOsave/restore, noghCLI dependency).--repo OWNER/NAMEwith default expected path--expected PATHoverride--repo/--expectedwithout value (error paths)GH_REPOenv var fallbackThe
gh repo viewfallback path (last-resort default resolution) is intentionally not covered here — the sibling test takes the same approach, and a hermetic CLI mock is outside the bounded scope of this slice.Substrate-drift note (B-0156 row body)
B-0156's row body claims 3
.shports remaining:tools/profile.shtools/peer-call/amara.shtools/peer-call/ani.shAll 3 are already ported AND their
.shsiblings deleted on disk. The remaining real work on B-0156 is the AC#2 test-coverage gap (3 of 6 ports lack tests), not porting. A follow-up row update is appropriate but outside this slice's bounded scope per the "exactly one bounded step" discipline.Test plan
bun test tools/hygiene/check-github-settings-drift.test.ts→ 7 pass / 0 fail / 15 expectsbun test tools/hygiene/snapshot-github-settings.test.tsregression check → 14 pass / 0 fail (unchanged; export was additive)bun tools/hygiene/check-github-settings-drift.ts --bogusexits 2 with "unknown arg" (expected)git ls-tree HEAD | wc -l = 53(matches expected; no commit-tree corruption per.claude/rules/codeql-no-source-on-docs-only-pr-is-broken-commit-canary.md)operative-authorization: aaron 2026-05-14: "- Devil-pole (edge-runner drive): keep pushing, discover, go hard, never-be-idle"
🤖 Generated with Claude Code