Repository navigation
test(bundle): drive /meow through dist/index.js against a stubbed cat api - #244
Conversation
|
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. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
The stubbing approach works and makes no network calls (I verified this in an isolated network namespace). Three things:
- Quote the path:
NODE_OPTIONS: `--require "${preload}"`. Unquoted, it fails withCannot find modulewhen the checkout path contains a space, and all 17 tests fail. - Make
catApiPreload.cjsfail closed: throw on a cat-API request whenCAT_API_URLis unset, instead of sending it to the real API. - Cut the URL-validation (5), not-a-command (4) and s3 cases down to one each;
meow.test.tsalready covers these pure functions. Keep the retry, 4xx, redirect, key/mask and write-failure cases.
0d74553 to
13b3917
Compare
|
Addressed all three: 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
Your three earlier fixes are in: the quoted --require path works from a path containing a space, and the preload fails closed. Two things left:
- Import
repo,tokenandcommentfrom./helpers, and getcallsfromhelpersFor(() => gh), instead of the local copies atmeow.test.tsL13–14, L56–60 and L93–95. - In the write-failure test (L205), check for the cause,
errors.some(e => e.includes('could not add comment')), instead of the/error handling issue comment/prefix.
… api Adds __tests__/bundle/meow.test.ts and the --require preload __tests__/bundle/catApiPreload.cjs, which rewrites only the https://api.thecatapi.com origin to a local stub so the shipped bundle's fetch, retry, redirect, key-masking and url validation run unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
…e /meow suite Signed-off-by: quality <quality@hive.kubestellar.io>
13b3917 to
98a1a04
Compare
|
Addressed both: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
CI triage for the red The bundle 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
Your asks are addressed and it passes on main. Optional: postedComments() (L82–84) is the same as comments() in triggerTestAndLgtmCancel.test.ts, so it could move into helpersFor.
|
/kind cleanup |
🔒 Hold-gate integrity: branch changed while hold-gated — fresh review requiredThis PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was Commits not present in the hold-time snapshot (3):
A human should review the FULL diff at the current head — a rebase or force-push renames every commit, so everything above needs eyes even if it looks familiar. Removing the hold label after that review is the fresh approval: the guard has re-pinned its snapshot to the current head, so a clean lift re-opens the merge lanes. |
|
/lgtm |
…tion retry through dist/index.js (#372) * test(bundle): drive /meow's parseCatImage refusals and dropped-connection retry through dist/index.js #244 drove the foreign-host row of parseCatImage only. Add the other five refusals (empty list, record without url, excessively long url, unparsable url, http:/credentialed url) as a table, and teach the cat api stub to drop the connection so the TypeError retry arm runs: one drop then an image is retried, three drops degrade to the note. Closes #243 Signed-off-by: quality <quality@hive.kubestellar.io> * test(bundle): keep one unusable-url row and drop the three-drops give-up case Review on #372: the http: and credentials rows both reach the same throw at meow.ts:141, so only the http: row stays; the three-dropped-connections case adds no line the single-retry and 5xx give-up cases do not already reach. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io> --------- Signed-off-by: quality <quality@hive.kubestellar.io> Co-authored-by: quality <quality@hive.kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Test Improvement
New files only —
__tests__/bundle/meow.test.tsand__tests__/bundle/catApiPreload.cjs. No production code, no workflow change, no edit to any existing test file.Drives the committed
dist/index.json anissue_commentevent withprow-commands: /meow(src/issueComment/meow.ts) againstfakeGithub.tsplus a local stand-in forapi.thecatapi.com. The cat api url is hardcoded inmeow.ts, so the child is started withNODE_OPTIONS=--require catApiPreload.cjs: the preload wrapsglobalThis.fetchand rewrites only thehttps://api.thecatapi.comorigin toCAT_API_URL, passing headers,redirect: 'manual'and the timeout signal through unchanged. The bundle's own retry loop, redirect refusal,core.setSecretmasking and url validation are what run.17 cases:
/meow→POST issues/1/commentsis the only GitHub call: no membership/collaborator read, no post-command sweep; the provider seesaccept: application/jsonand nox-api-keycat-api-key: live_secret→ reaches the provider asx-api-keyand the log carries::add-mask::live_secret::warning::Could not fetch a cat image: Error: cat api responded with 500, commentThe cat API is unavailable right now., exit 0Locationon the stub → exactly one request, the redirect is never followed, fallbackhttps://evil.exampleimage url →::warning::… unexpected host, fallback, exit 0 (one row; the other url checks are unit-tested inmeow.test.ts)/meowin a fenced block → zero requests to either api, exit 0 (one row; the matcher is unit-tested)::error::error handling issue commentVerified on
main@ c48bd6d, Node v26.10.0:npx vitest run __tests__/bundle/meow.test.ts→ 9 passed, also from a checkout path containing a space (/tmp/pga q)npx eslint __tests__/bundle/meow.test.ts __tests__/bundle/catApiPreload.cjs→ clean;npx tsc --noEmit→ cleanAll files 99.83 | 98.35 | 100 | 99.82); e2e hits are not captured in the report ([quality] the bundle e2e suite's coverage of src/ is never captured — runBundle.ts drops NODE_V8_COVERAGE and dist/ has no source map #235)Disjoint from every open hold-gated PR (#217, #219, #221, #223, #225, #227, #229, #230, #232, #234, #236, #238, #240, #242): #236 edits one line of
bundle.test.ts; #238, #240, #242 each add their own new bundle file (collaborationCommands,triggerTestAndLgtmCancel,cronJobsInput); none touch/meowor add a preload.catApiPreload.cjsfails closed: a cat-api request withCAT_API_URLunset throws instead of reaching the real api. The--requirepath is quoted inNODE_OPTIONS.Related Issue
Closes #243
Filed by quality agent (hold-gated mode). Human review required.