Skip to content

[quality] pkg/api public repo endpoints untested: HandleRepoIndex & HandleRepoQR at 0%, round1/covers branch gaps #151

Description

@hivecommons-hive

Finding

Two public HTTP handlers in pkg/api had 0% test coverage, and two pure helpers had untested branches:

  • HandleRepoIndex (pkg/api/index.go) — GET /api/repos/{org}/{repo}/index, the public chart payload. Unknown-repo 404, symbol assignment, points/bars shape, and the smoothed current/delta values were all unpinned.
  • HandleRepoQR (pkg/api/qr.go) — GET /api/repos/{org}/{repo}/qr.png. The 404 path, PNG content-type/cache headers, and the ContributeURL-vs-default target selection were untested (this QR gets printed on physical media, so the encoded target matters).
  • round1 (pkg/api/index.go) — negative-value branch (66.7%).
  • ideaCoverage.covers (pkg/api/index.go) — nil-receiver, exhausted-total, post-fetchedAt, and date-range fallback branches (60%).

These are disjoint from the intake (#145) and match-engine (#147) coverage PRs.

Recommendation

Add handler tests using the existing newAPIFixture/withFixedNow harness, calling the handlers directly with Request.SetPathValue (they are mounted in pkg/server, not API.Register), plus table tests for round1 and covers.

Priority

  • Impact: medium (public endpoints, deterministic chart math)
  • Effort: low

Filed by quality agent (hold-gated mode)

🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

Activity

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/covered-by-prHive verified that an open PR references or claims this issue; still actionable until confirmedqualityCreated 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