agent-orchestrator/backend/internal/adapters/tracker/github
harshitsinghbhandari a0020e06be refactor(tracker): address code-review findings
Six fixes from the second code review pass — none load-bearing but all
improve the contract honesty or prevent future churn. Tests pass with
-race (49 in package, 299 across the backend).

1. Preflight: atomic.Bool fast-path before the mutex so cached-success
   calls don't contend on the lock. Double-checked locking on the
   mutex side so concurrent first-callers still serialize the single
   GET /user request.

2. Preflight godoc: tighten to say it verifies token validity, not
   repo authorization — Get/List against a specific repo may still
   return ErrAuthFailed after a green Preflight if the token lacks
   the scope or the repo isn't visible.

3. domain.ListFilter.Limit godoc: explicitly note that exceeding the
   provider per-page max is SILENTLY capped (no error, no truncation
   signal) and that auto-pagination is deferred to #35.

4. Extract issueFromGH helper. Get and List were duplicating the
   identical ghIssue -> domain.Issue projection; consolidating now
   prevents a 3-way merge when #40 (Comment/Transition) lands.

5. parseGitHubRepo: reject whitespace and # in both owner and repo
   segments. Leading dots stay legal (the "owner/.github" repo
   convention). New test cases cover the rejections plus a positive
   guard for the leading-dot case.

6. fakeGH test helper: lock the handlers map on both read and write,
   so future tests registering handlers from goroutines won't trip
   -race.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 22:32:45 +05:30
..
auth.go feat(tracker): Tracker port + GitHub adapter 2026-05-30 13:11:15 +05:30
doc.go feat(tracker): add List + Preflight to the port and GitHub adapter 2026-05-30 22:04:58 +05:30
tracker.go refactor(tracker): address code-review findings 2026-05-30 22:32:45 +05:30
tracker_test.go refactor(tracker): address code-review findings 2026-05-30 22:32:45 +05:30