Skip to content

test(bundle): record the fake GitHub API's unmatched requests and assert on them outside the application - #569

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-fake-unexpected-traffic
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-fake-unexpected-traffic

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files/functions claimed: __tests__/bundle/fakeGithub.ts (FakeGithub.unmatched, allowUnmatched, unexpectedRequests, assertNoUnexpectedRequests, reset), new __tests__/bundle/fakeGithubUnexpected.test.ts, and the beforeEach/afterEach of __tests__/bundle/ownersParseArms.test.ts and __tests__/bundle/ownersProbeArms.test.ts. Cluster: #554 P1 harness item "record unexpected API traffic and assert on it outside application error handling".

  • The fake keeps the requests no route or fallback answered in unmatched, takes explicit allowances for the misses a scenario relies on (allowUnmatched(method, pattern)), and assertNoUnexpectedRequests() throws naming the rest. The configuration loader's probes are always allowed: every run without a routed prow configuration makes them.
  • fakeGithubUnexpected.test.ts pins 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; reset clears both the record and the scenario's allowances.
  • ownersParseArms and ownersProbeArms adopt it: tide's merge queue read is answered "no queue" through mergeQueueFallback (as lgtmBindingArms/lgtmRemovalNoopArms already do) instead of a 404 that queueState swallows into a warning; the OWNERS probes each scenario expects to miss (sdk%2FOWNERS, root OWNERS on 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; eslint clean on the four files. git merge-tree against #555's head (the only open PR touching fakeGithub.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

…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>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 22, 2026 16:30
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 22, 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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: e3119ad

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

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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] bundle fake answers unrouted requests with a plain 404; the harness should assert on unexpected traffic outside application fallbacks

0 participants