Skip to content

GH-97: fix(github): SyncAdapter correctness — paginated idem comment scan, resolveRepo write-scope consistency (post-merge review of #95)#100

Merged
alekspetrov merged 1 commit into
mainfrom
pilot/GH-97
Jul 13, 2026
Merged

GH-97: fix(github): SyncAdapter correctness — paginated idem comment scan, resolveRepo write-scope consistency (post-merge review of #95)#100
alekspetrov merged 1 commit into
mainfrom
pilot/GH-97

Conversation

@alekspetrov

Copy link
Copy Markdown
Contributor

Summary

Automated PR created by Pilot for task GH-97.

Closes #97

Changes

GitHub Issue GH-97: fix(github): SyncAdapter correctness — paginated idem comment scan, resolveRepo write-scope consistency (post-merge review of #95)

Context

PR #95 (GitHub SyncCapable, issue #91) merged with two correctness defects found in post-merge review (2026-07-13). Nothing consumes SyncCapable yet; fixes are non-breaking.

Implementation

All in sdk/integrations/github/sync.go:

  1. AddComment idempotency scan must paginate: the scan uses Client.ListIssueComments, documented single-page (GitHub default 30) — a pilot-op marker beyond the first 30 comments is invisible → duplicate repost on retry. Paginate the scan (per_page=100 + page loop, or newest-first with an explicit cap + doc comment). Multi-page test required.
  2. resolveRepo scope inconsistency (silent cross-repo write): the projectID override applies to ListUpdatedSince/ListAll/CreateIssue but NOT to GetIssue/UpdateFields/TransitionState/AddComment, which operate on the bound repo by bare issue number — listing "other/repo" then writing back hits the bound repo's same-numbered issue. Either thread the resolved repo through all write/read-by-id methods (extend NativeID to carry repo, or plumb projectID) or reject cross-repo projectIDs loudly. Malformed projectID must error, not silently fall back.
  3. (Nits, cheap while in there): since.UTC().Format(...) before embedding in the query string (non-UTC "+02:00" decodes as a space); doc-comment that the externalized Cursor loop deliberately has no maxPages cap (host's responsibility).

Acceptance

Refs

…esolveRepo write-scope consistency (GH-97)

Post-merge review of #95 found two correctness defects, both fixed in
sdk/integrations/github/sync.go:

- AddComment's idempotency scan now paginates exhaustively (per_page=100,
  no cap) instead of relying on Client.ListIssueComments' documented
  single default-sized page — a marker beyond the first page was
  previously invisible to a retry, causing a duplicate repost.
- resolveRepo now errors on a malformed projectID instead of silently
  falling back to the bound repo, and IssueSnapshot.NativeID is
  repo-qualified ("owner/repo#N") whenever a listing resolves to a repo
  other than the bound one. GetIssue/UpdateFields/TransitionState/
  AddComment decode that qualifier via parseNativeID, so a write-back
  after listing a non-bound projectID targets the correct repo instead
  of silently hitting the bound repo's same-numbered issue.

Also: since is normalized to UTC before formatting (a non-UTC "+02:00"
offset embeds a literal "+" that decodes as a space server-side), and
issuesSyncPerPage documents that the exhaustive cursor loop has no page
cap by design (host's responsibility), unlike the capped board-scale
listings elsewhere in this package.
@alekspetrov
alekspetrov merged commit 5158dad into main Jul 13, 2026
3 checks passed
@alekspetrov
alekspetrov deleted the pilot/GH-97 branch July 13, 2026 19:08
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.

fix(github): SyncAdapter correctness — paginated idem comment scan, resolveRepo write-scope consistency (post-merge review of #95)

1 participant