Skip to content

[architect] converge hive-live + factory-stats fetchers onto shared lib/gh.js - #1257

Merged
castrojo merged 1 commit into
projectbluefin:mainfrom
kylerankin:fix/factory-hive-fetch-convergence
Sep 13, 2026
Merged

[architect] converge hive-live + factory-stats fetchers onto shared lib/gh.js#1257
castrojo merged 1 commit into
projectbluefin:mainfrom
kylerankin:fix/factory-hive-fetch-convergence

Conversation

@kylerankin

Copy link
Copy Markdown
Contributor

What

Fold two more hand-rolled GitHub API fetchers onto the single, adr/0003-endorsed client in scripts/lib/gh.js (resolves architect issue #1232). This is the second incremental slice — a parallel PR (#1236) converges the other two ESM sites (lib/factory-monthly-metrics.mjs, lib/tap-promotions.mjs); each is independently reviewable as #1232 recommends.

scripts/lib/gh.js:

scripts/fetch-hive-live-data.js:

  • Drop its inline GITHUB_TOKEN read, its local GH_API, and its hand-rolled v3+json header object; go through githubToken()/ghFetch().

scripts/fetch-factory-stats.js:

  • Drop its inline token + v3+json header object and local GH_API. Lane runs now come from ghPaginate() with the same per_page=100, maxPages=10, workflow_runs select and 20s timeout.

Behaviour

Neutral. Same endpoints, same pagination, same timeout, same fail-soft wrappers — only the token acquisition and header/auth construction is deduplicated. GitHub treats application/vnd.github.v3+json and application/vnd.github+json identically, so the header convergence changes no returned data.

Verified: node --test "scripts/**/*.test.js" (1079 tests) passes; eslint and prettier --check clean on the changed files.

Left for later

The remaining hand-rolled sites — the CJS fetchers behind lib/request-queue.js, the GraphQL lib/tap-promotions.mjs, the DI-based lib/factory-monthly-metrics.mjs, and the Link-pagination sites (fetch-feeds.js, fetch-hive-history.js, lib/sbom/api.js, fetch-pin-state.js) — converge onto the shared client in their own follow-up PRs.

— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K

Fold the hand-rolled GitHub API plumbing out of the fetch layer and onto
the single adr/0003-endorsed client in scripts/lib/gh.js (projectbluefin/
documentation#1232).

- gh.js: export githubHeaders() as the one header contract (Accept +
  api-version + user-agent + Bearer) and forward an optional AbortSignal
  through ghFetch/ghPaginate so a caller can pin its own timeout without
  the shared client inventing a retry policy.
- fetch-hive-live-data.js: drop its inline token + v3+json header object
  and its local GH_API; go through githubToken()/ghFetch().
- fetch-factory-stats.js: drop its inline token + v3+json header object and
  local GH_API; lane runs now come from ghPaginate() with the same
  per_page=100, maxPages=10, workflow_runs select and 20s timeout.

Both migrations are behavior-neutral: same endpoints, same pagination,
same timeout, same fail-soft wrappers — only the header/auth construction
is deduplicated. The CJS request-queue.js side and the GraphQL/DI/Link-
pagination fetchers are left for follow-up PRs.

Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
@castrojo
castrojo added this pull request to the merge queue Sep 13, 2026
Merged via the queue into projectbluefin:main with commit 8c21e56 Sep 13, 2026
2 checks passed
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.

2 participants