Repository navigation
test(bundle): record the fake GitHub API's unmatched requests and assert on them outside the application - #569
Conversation
…ert on them outside the application The bundle fake answered every request no route matched with a 404 and left each scenario to notice: a forgotten route for tide's merge queue read was swallowed by queueState into a warning and a direct merge, so the scenario passed on traffic it never modelled. fakeGithub.ts now keeps the unmatched requests apart (unmatched), takes explicit allowances for the probes a scenario relies on missing (allowUnmatched), and fails a scenario on the rest (unexpectedRequests, assertNoUnexpectedRequests). The configuration loader's reads are always allowed: every run without a routed prow configuration makes them. fakeGithubUnexpected.test.ts pins that contract with plain fetches. ownersParseArms.test.ts and ownersProbeArms.test.ts adopt it: the merge queue read is answered "no queue" through mergeQueueFallback as the lgtm arms already do, the OWNERS probes each scenario expects to miss are allowed in that scenario, and anything else unrouted fails it. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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 Hive will keep the |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 |
The JSON reporter output was committed by mistake alongside the fake GitHub API change and fails the repository's eslint jsonc rules. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Test Improvement
Files/functions claimed:
__tests__/bundle/fakeGithub.ts(FakeGithub.unmatched,allowUnmatched,unexpectedRequests,assertNoUnexpectedRequests,reset), new__tests__/bundle/fakeGithubUnexpected.test.ts, and thebeforeEach/afterEachof__tests__/bundle/ownersParseArms.test.tsand__tests__/bundle/ownersProbeArms.test.ts. Cluster: #554 P1 harness item "record unexpected API traffic and assert on it outside application error handling".unmatched, takes explicit allowances for the misses a scenario relies on (allowUnmatched(method, pattern)), andassertNoUnexpectedRequests()throws naming the rest. The configuration loader's probes are always allowed: every run without a routed prow configuration makes them.fakeGithubUnexpected.test.tspins that contract with plain fetches (6 tests): unrouted → 404 + unexpected; routed/fallback → neither; loader probes allowed, an explicitly sourced config read is not; allowances by exact path, pattern and method;resetclears both the record and the scenario's allowances.ownersParseArmsandownersProbeArmsadopt it: tide's merge queue read is answered "no queue" throughmergeQueueFallback(aslgtmBindingArms/lgtmRemovalNoopArmsalready do) instead of a 404 thatqueueStateswallows into a warning; the OWNERS probes each scenario expects to miss (sdk%2FOWNERS, rootOWNERSon master, master's tree) are allowed in that scenario; anything else unrouted fails it. Before the allowances were added the assertion flagged exactly those probes in 10 tests, which is the mechanism working.Measured on main at e3119ad: 3,029 unmatched requests across the bundle suite, 25 of them an unrouted
POST /graphql. Wider adoption is left out on purpose: the blunderbuss files are occupied by #559/#561/#562/#567, and #568 lists the remaining files.Verified locally at 6faa951:
vitest run __tests__/bundle→ 87 files, 534 tests pass;eslintclean on the four files.git merge-treeagainst #555's head (the only open PR touchingfakeGithub.ts) merges cleanly.Related Issue
Closes #568
Refs #554 (umbrella tracker; this lands its second P1 harness checkbox, the mutation-check and assertion-policy boxes and the other sections stay open)
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 requested_by=@mrbobbytables