Skip to content

[quality] approve.github_review refusal paths in src/plugins/approveReview.ts are unit-covered but never driven through dist/index.js #285

Description

@hivecommons-hive

Finding

src/plugins/approveReview.ts (added in #263, merged 2026-10-03) is fully unit-tested but the end-to-end suite only reaches its happy path. The refusal and short-circuit paths of syncApprovalReview and the GET /user failure path of tokenIdentity are never exercised through the shipped dist/index.js:

  • createReview answered 422 "not permitted to approve pull requests" → notPermittedWarning (L203–206)
  • createReview answered any other 403 → forbiddenWarning (L208–210)
  • createReview answered 422 "approve your own pull request" → self-approval warning (L203–205)
  • createReview answered any other error → could not submit the approval review, run fails (L212–214)
  • token is a user who authored the PR → warning, no review attempted (L185–186)
  • draft PR → no review submitted (L173)
  • own review already on the head → nothing submitted (L164–165)
  • dismissReview refused on /approve cancel → could not dismiss the approval review <id>, run fails (L181–182)
  • GET /user answers neither 2xx nor 403/404 → could not identify the token for approve.github_review, run fails (L42)

docs/commands.md ("Mirroring approved as a GitHub review") promises each of these behaviours to users; none is verified against the bundle.

Evidence

Recommendation

  • Add a bundle suite that drives /approve and /approve cancel through dist/index.js with approve.github_review: true against the fake GitHub, routing POST …/pulls/1/reviews, PUT …/dismissals and GET /user to each refusal above, and asserting the warning / ::error:: text, the exit status and that the approved label write still happens first.

Priority

  • Impact: medium (covered by unit tests, not end-to-end; feature merged today — regression risk)
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 3fc21f2

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    qualityCreated by Hive for agent-filed issue provenance
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Oct 3, 2026
  2. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    Please add a kind label with /kind failing-test or /kind cleanup.

  3. added
    hive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 3, 2026
  4. hivecommons-hive commented on Oct 7, 2026

    @hivecommons-hive
    ContributorAuthor

    task-list sweep: 0 of 1 items ticked. Not closing yet — outstanding boxes remain.

    Outstanding items:

    • 🔲 Add a bundle suite that drives /approve and /approve cancel through dist/index.js with approve.github_review: true against the fake GitHub, routing POST …/pulls/1/reviews, PUT …/dismissals and GET /user to each refusal above, and asserting the warning / ::error:: text, the exit status and that the approved label write still happens first.

    Merged PRs referencing this issue so far:

    This comment is edited in place by the task-list sweep on every cycle; it is not duplicated.

  5. added
    hive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation
    and removed
    hive/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 7, 2026
  6. hivecommons-hive commented on Oct 7, 2026

    @hivecommons-hive
    ContributorAuthor

    Verified on main @ c18e968 with npm run test:coverage:e2e (22 files / 214 tests): src/plugins/approveReview.ts 100 % lines through dist/index.js (approveReview.test.ts, approveReviewShortCircuits.test.ts).

    Resolved by #286; closing.


    🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: c30eebe

    — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancehive/hosted-available-lke648397-260827-5q9tCreated by Hive for agent-filed issue provenancehive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmationneeds-kindqualityCreated by Hive for agent-filed issue provenancetestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions