Skip to content

test(cli): make the updater telemetry guard independent of the default stub #2249 - #2253

Merged
nc9 merged 1 commit into
mainfrom
fix/2249-guard-sees-every-fetch
Nov 22, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/2249-guard-sees-every-fetch

Conversation

@nc9

@nc9 nc9 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #2251, for #2249.

#2251 landed before its round 2. Its guard only checked URLs that the default fetch stub recorded, so deleting installDefaultFetchStub() still passed 112/0. That missed #2249's criterion "Removing the default stub makes it fail" (a review-lane finding).

This change:

  • At file load, globalThis.fetch is replaced with a recorder that logs the URL and throws, so it never touches the network.
  • beforeEach installs the default stub and asserts it's in place (globalThis.fetch !== originalFetch).
  • afterEach fails if anything reached the recorder. That covers a deleted stub, or a test that restores the real fetch mid-test.
  • afterAll asserts the recorder is still the global, then hands the genuine fetch back so later files in the same Bun process aren't affected.

Fail-befores (file by path):

  • (i) remove the SQUIRREL_API_SERVER line: 84 pass / 29 fail;
  • (ii) remove installDefaultFetchStub(): 0 pass / 112 fail (it was 112 / 0 before this change).

Gates: the file passes 112/0, the cli suite as CI runs it passes 4661/0, and tsgo, oxlint and oxfmt are clean. Test-only: no production code or docs change, and the agent skill needs no change.

@nc9
nc9 merged commit b125b86 into main Nov 22, 2026
10 checks passed
@nc9
nc9 deleted the fix/2249-guard-sees-every-fetch branch November 22, 2026 12:41
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.

1 participant