ReviewOS

also looking at this

stacks/buddy

test: cover the untested halves of the big integration files

#1443
Merged glennmichael123 wants to merge test/deep-integration-coverage into main
4 files +2344 -83
9 days ago

The three largest integration files were the coverage floor of the repo: registry-client.ts 56.1% lines, github-provider.ts 31.9%, buddy.ts 38.8%. This PR tests the real behavior behind those numbers — response parsing, fallback chains, gates and guards — not line-count theater.

What's here

test/registry-client-http.test.ts (34 tests) — the real npm-registry path existing suites stub out: packument→metadata mapping, the one-fetch-per-package memoization contract, 404-as-miss vs warn-on-error, shell-unsafe package-name refusal before any network call, includePrerelease filtering, bun outdated object-keyed JSON + ANSI-table fallback, release-date getters (npm/GitHub/Packagist) and the BUDDY_TOKEN→GITHUB_TOKEN→GH_TOKEN→anonymous header fallthrough.

test/github-provider-api.test.ts (52 tests) — the provider's API surface: PR create with CLI→API fallback, token redaction in failed-command errors, merge-strategy mapping + head-branch cleanup, hasWriteAccess grant/deny matrix, check-state aggregation (unreadable ⇒ pending, never success), review posting that reposts the summary alone when inline anchors are rejected, GraphQL auto-merge/review-threads/pinning error tolerance, branch + issue pagination with PR filtering and cache.

test/buddy-orchestration.test.ts (45 tests) — the orchestration layer: auto-merge eligibility (green-checks gate, dry-run, per-PR failure tolerance, nativeAutoMerge capability), the satisfied-PR close verifier incl. the empty-scan mass-closure guard, dashboard create-vs-update by body marker (never adopts a foreign title-only issue), grouping/strategy-filter/dedup rules, and the #1359 workflow-only-group skip.

Dead code deleted: getMajorVersion, getMinorVersion, findBestUpdates in registry-client.ts — private, zero call sites (the live path is findBestConstraintUpdates). −83 lines.

Observed while testing, not fixed here

  • getComposerOutdatedPackages reads composer.json from process.cwd() while its caller checks under this.projectPath — they disagree when cwd differs from the project path.
  • groupUpdatesByConfig pushes a group with an empty updates array when a per-group strategy filters out every claimed update (benign downstream, but the empty group reaches the PR loop).

Verification

Full single-process suite: 2368 pass / 0 fail across 143 files (was 2237/140). Typecheck and pickier clean. All new tests run offline — fetch stubs and injected fakes only, no mock.module, every touched global restored.

🤖 Generated with Claude Code

4 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.