Skip to content

test(hygiene): cover check-github-settings-drift parseArgs (B-0156 AC#2)#4068

Merged
AceHack merged 1 commit into
mainfrom
slice/b0156-test-check-github-settings-drift-2026-05-17
May 17, 2026
Merged

test(hygiene): cover check-github-settings-drift parseArgs (B-0156 AC#2)#4068
AceHack merged 1 commit into
mainfrom
slice/b0156-test-check-github-settings-drift-2026-05-17

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 17, 2026

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). Exports parseArgs from 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→.ts port to have at least one bun test covering its primary entry path. Audit on 2026-05-17 found:

Port Test status
tools/hygiene/snapshot-github-settings.ts ✓ has test
tools/hygiene/check-github-settings-drift.ts this PR
tools/hygiene/check-tick-history-shard-schema.ts ✓ has test
tools/peer-call/amara.ts follow-up
tools/peer-call/ani.ts follow-up
tools/profile.ts ✓ has test

Coverage

Mirrors tools/hygiene/snapshot-github-settings.test.ts conventions (sibling-port parseArgs tests, hermetic GH_REPO save/restore, no gh CLI dependency).

  • --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

The gh repo view fallback 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 .sh ports remaining:

  • tools/profile.sh
  • tools/peer-call/amara.sh
  • tools/peer-call/ani.sh

All 3 are already ported AND their .sh siblings 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 expects
  • bun test tools/hygiene/snapshot-github-settings.test.ts regression check → 14 pass / 0 fail (unchanged; export was additive)
  • CLI smoke: bun tools/hygiene/check-github-settings-drift.ts --bogus exits 2 with "unknown arg" (expected)
  • Worktree freshness canary: 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)
  • CI gate

operative-authorization: aaron 2026-05-14: "- Devil-pole (edge-runner drive): keep pushing, discover, go hard, never-be-idle"

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 17, 2026 12:04
@AceHack AceHack enabled auto-merge (squash) May 17, 2026 12:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parseArgs from check-github-settings-drift.ts to make argv parsing testable.
  • Added check-github-settings-drift.test.ts with focused parseArgs coverage (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.

@AceHack AceHack merged commit aa56dad into main May 17, 2026
34 of 35 checks passed
@AceHack AceHack deleted the slice/b0156-test-check-github-settings-drift-2026-05-17 branch May 17, 2026 12:07
@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 17, 2026

CI classification for the failing check drift job:

This is not transient and does not appear caused by this PRs parseArgs test slice. The job fails during snapshot collection before drift comparison:

gh api /repos/Lucent-Financial-Group/Zeta/keys failed ... Resource not accessible by integration (HTTP 403)

That is the same admin-only GitHub settings token-scope failure already handled in draft PR #4066. Because #4068 is based on origin/main without #4066, rerunning this job will very likely fail the same way.

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.

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.

2 participants