CXP-383 Support audit log pagination for both GHEC and GHES - #192
Conversation
| // numeric "page=N" Link headers parse into Response.NextPage (int) instead, | ||
| // leaving NextPageToken empty. Checking only NextPageToken silently truncates | ||
| // GHES audit logs to a single page. | ||
| func nextAuditLogPage(resp *github.Response) string { |
There was a problem hiding this comment.
🟡 Suggestion: The new GHES numeric-page branch has no test coverage. TestUsageEventFeed_ListEvents_ContinuesPastAnAllFilteredPage only exercises the GHEC path (Link: <...?page=cursor2>; rel="next"), so the resp.NextPage fallback this PR adds would still pass if it regressed. Consider adding a sibling test whose mocked handler emits a numeric Link: <...?page=2>; rel="next" header and asserting the second request is issued with page=2. (confidence: high)
Connector PR Review: CXP-383 Support audit log pagination for both GHEC and GHESBlocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0 Review SummaryScanned the full PR diff (one file, Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agents |
…ngs (#193) * fix: correct audit-log pagination cursor and sample skip-org warnings - nextAuditLogPage now checks resp.After first (the cursor GHEC and GHES actually return for the org audit-log endpoint's rel="next" Link), falling back to NextPageToken/NextPage for any page-style Link header GHES may still emit. The prior fix (#192) only checked NextPageToken/NextPage, so it silently truncated every GHEC org - and most GHES orgs - to a single page. - Request side now sends the cursor via After or Page depending on which shape was received (usageEventPageToken.AuditLogCursorIsPage), instead of always sending Page. - Orgs that permanently lack audit-log access are now warned via a sampled logger (1st, 10th, 100th, then every 1000th occurrence, with total_occurrences) instead of on every poll pass forever. The counter is intentionally shared across all orgs on the feed, not keyed per org. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: key skipped-org warning sampling per org, not shared A single shared counter meant one permanently-inaccessible org could drive the sampling budget high enough that another org's first failure landed on a non-sampled occurrence and was never logged, hiding it from operators entirely (PR #193 review). perKeySampledWarn keys the sampler by org name so every distinct org gets its own guaranteed 1st/10th/100th/every-1000th occurrence, independent of how noisy any other org is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
The pagination token on GHEC and GHES is different for each. So this PR adds support to both of them