Skip to content

test(bundle): drive newOctokit's api.github.com fallback through dist/index.js with an empty GITHUB_API_URL - #504

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-api-url-default
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-api-url-default

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files: __tests__/bundle/githubApiPreload.cjs (new), __tests__/bundle/githubApiUrlDefault.test.ts (new). Function: newOctokit in src/utils/octokit.ts, the GITHUB_API_URL || 'https://api.github.com' arm. No src/ or dist/ change.

Every bundle test passes apiUrl: gh.url through runBundle, which sets GITHUB_API_URL to the fake server, so the 'https://api.github.com' fallback had unit coverage (__tests__/utils/octokit.test.ts) but never ran through the packed bundle: npm run test:coverage:e2e at 1062ce7 reports src/utils/octokit.ts at 50% branches.

  • githubApiPreload.cjs is loaded with NODE_OPTIONS=--require, the same shape as catApiPreload.cjs: it rewrites requests for the https://api.github.com origin to FAKE_GITHUB_URL and fails closed when that is unset, so the child can never reach the real API from a test.
  • The test runs /remove-help with GITHUB_API_URL='' and asserts the config reads, issue read and label delete all land on the fake. A second case omits FAKE_GITHUB_URL and asserts the run fails with the preload's message before any request, which independently proves the child targeted api.github.com.

After this, the e2e run reports octokit.ts at 100/100/100/100. Lint clean.

Disjoint from the open held PRs: #497 (approve/meow arms), #498 (tide draft/files, sweep labels folds), #500/#502 (thresholds), #501 (docs YAML).

Related Issue

Refs #466 (tracker for every dist/index.js e2e-coverage finding; this lands only the octokit.ts fallback folded into it on 2026-10-17 — the other folded arms in approve.ts, approveReview.ts, handleIssueComment.ts, tide.ts and mergeQueue.ts remain open there)


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…/index.js with an empty GITHUB_API_URL

Every bundle test points GITHUB_API_URL at the fake server, so the
`|| 'https://api.github.com'` arm in src/utils/octokit.ts had unit
coverage but never ran through the packed bundle (coverage-e2e reported
the file at 50% branches). Add githubApiPreload.cjs, which redirects the
public origin to FAKE_GITHUB_URL the way catApiPreload.cjs does for the
cat api, and a test that runs /remove-help with GITHUB_API_URL='' and
asserts the requests land on the fake. A second case leaves the fake
unnamed and asserts the preload fails closed before any request.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 17, 2026 16:47
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 17, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants