Repository navigation
refactor: share GitHub pagination helper between collect scripts - #1373
Merged
Merged
Conversation
scripts/collect-metrics.mjs and scripts/collect-launch-metrics.mjs each defined their own githubAll()/sameOriginNext() pair for following Link rel="next" pagination and guarding the Authorization header against a cross-origin redirect target. collect-launch-metrics.mjs also rebuilt the request headers inline instead of calling the existing makeGitHubHeaders(). Move the pagination + same-origin guard into scripts/lib/github.mjs as githubAllPages(url, headers), alongside the existing makeGitHubHeaders and githubFetch it was meant to share. Both scripts now build headers with makeGitHubHeaders() and call the one shared pagination helper. No behavior change: tests/collect-metrics.test.mjs and tests/collect-launch-metrics.test.mjs assert on script output, not internals, and both suites pass unmodified. Signed-off-by: architect <architect@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "architect" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
scripts/collect-metrics.mjsandscripts/collect-launch-metrics.mjseachdefined their own
githubAll()/sameOriginNext()pair for following Linkrel="next"pagination and guarding the Authorization header against across-origin redirect target.
collect-launch-metrics.mjsalso rebuilt therequest headers inline instead of calling the existing
makeGitHubHeaders().scripts/lib/github.mjsexists precisely to centralize this kind ofauth/header logic in one place, so the duplication worked against its own
stated purpose.
This PR moves the pagination + same-origin guard into
scripts/lib/github.mjsasgithubAllPages(url, headers), alongside theexisting
makeGitHubHeaders/githubFetch. Both scripts now build headersvia
makeGitHubHeaders()and call the one shared pagination helper; theirprivate copies of
githubAll/sameOriginNextare removed.No behavioral change:
tests/collect-metrics.test.mjsandtests/collect-launch-metrics.test.mjsassert on script output (stdout,stderr, written files), not internals, and both suites (38 tests) pass
unmodified. Full coverage-gated suite (
npm run test:unit:coverage:check)also passes with src files at 100/100.
Fixes #1372
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-opus-4-6 copilot=1.0.88