Skip to content

refactor: ponytail audit cleanup — plan_credits, _copilot_api, install-hooks, test boilerplate#43

Merged
locus313 merged 1 commit into
mainfrom
refactor/ponytail-audit-cleanup
Jun 27, 2026
Merged

refactor: ponytail audit cleanup — plan_credits, _copilot_api, install-hooks, test boilerplate#43
locus313 merged 1 commit into
mainfrom
refactor/ponytail-audit-cleanup

Conversation

@locus313

Copy link
Copy Markdown
Owner

What

Four over-engineering removals from the ponytail audit:

1. Collapse plan_credits() double case block

Two identical case blocks (promo / standard) differing only in 4 values → one case with an inline promo check. Saves ~16 lines.

2. Inline _copilot_api() wrapper

A 2-line function that just called gh_api with --api-version 2026-03-10 was called exactly twice. Inlined at both call sites, wrapper deleted.

3. Source lib in install-hooks.sh

Dropped the redeclared RED/GREEN/YELLOW/NC color vars — they're already in lib/github-common.sh. The [HOOKS]-labelled print functions are kept since their prefix differs from the lib's [SUCCESS]/[WARNING]/[ERROR].

4. _run_script test helper

Added a helper to test_script_validation.bats and replaced all 59 single-line run bash -c "export PATH='${MOCK_BIN}:${PATH}'; ..." invocations. The repeated PATH-prepend boilerplate is now in one place.

Verification

All 91 bats tests pass.

…nd test boilerplate

- Collapse plan_credits() from two identical case blocks (promo/standard)
  into one case keyed by plan type with inline promo check — saves ~16 lines
- Inline gh_api --api-version 2026-03-10 at both call sites and delete the
  _copilot_api() 2-line wrapper that only existed to fix that flag
- Source lib/github-common.sh in install-hooks.sh to reuse color vars
  (RED/GREEN/YELLOW/NC) instead of redeclaring them; keep the [HOOKS]-labelled
  print functions since they differ from the lib's [SUCCESS]/[WARNING]/[ERROR]
- Add _run_script() helper to test_script_validation.bats and replace all 59
  single-line run bash -c invocations — removes the repeated
  "export PATH='${MOCK_BIN}:${PATH}';" boilerplate from every test body

All 91 bats tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@locus313 locus313 merged commit 16fe695 into main Jun 27, 2026
2 checks passed
@locus313 locus313 deleted the refactor/ponytail-audit-cleanup branch June 27, 2026 22:30
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.

1 participant