panel unlock: call the browser's fetch as a plain function — as the port's method it throws "Illegal invocation" before the request leaves (GOTCHAS #379) #2019

Merged
ben merged 1 commit from session/unbound-fetch into main 2026-09-30 04:45:19 +00:00
Owner

Third live steward-unlock walk (Ben, Whakatōhea Demo, 2026-09-30 04:33Z, with #2015 live). Refs #1936.

What Ben saw

Members: "Your community's sign-in site couldn't be reached", naming id.whakatohea-demo.idss.nz.

What the log showed

The capability read (admin GET /api/v1/panel/handover 200 size=60), the identity module loaded, and no request to the sign-in site at all, not even the CORS preflight. Sent by hand, the preflight answers 204 with Access-Control-Allow-Origin: *, so the door and CORS are fine.

Cause (GOTCHAS #379)

HttpHandoverPort stored the browser's fetch and called it as this.fetchImpl(url, …). Browsers refuse fetch with a this that isn't the window. Reproduced in headless Chrome:

TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation

The throw was caught as "the door did not answer". Node's fetch and every test fake accept any this, so the unit seam never saw it.

Fix

  • The port holds fetch as a plain function.
  • The composition root (served.ts) hands every client (input, init) => fetch(input, init). That also repairs the same latent shape in backupsClient, destroyClient and idipCredentialsClient.uploadImage.
  • New test: a fake fetch that refuses a wrong this exactly as the browser does. It fails on main.
Check Result
dashboard vitest 166 files, 2216 passed, 2 skipped
vue-tsc clean
eslint clean

Needs a testing release after merge; no app release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WgMdPvssS1d7W1v2dL7bcH

Third live steward-unlock walk (Ben, Whakatōhea Demo, 2026-09-30 04:33Z, with #2015 live). Refs #1936. ## What Ben saw Members: *"Your community's sign-in site couldn't be reached"*, naming `id.whakatohea-demo.idss.nz`. ## What the log showed The capability read (`admin GET /api/v1/panel/handover 200 size=60`), the identity module loaded, and **no request to the sign-in site at all**, not even the CORS preflight. Sent by hand, the preflight answers `204` with `Access-Control-Allow-Origin: *`, so the door and CORS are fine. ## Cause (GOTCHAS #379) `HttpHandoverPort` stored the browser's `fetch` and called it as `this.fetchImpl(url, …)`. Browsers refuse `fetch` with a `this` that isn't the window. Reproduced in headless Chrome: ``` TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation ``` The throw was caught as "the door did not answer". Node's `fetch` and every test fake accept any `this`, so the unit seam never saw it. ## Fix - The port holds fetch as a plain function. - The composition root (`served.ts`) hands every client `(input, init) => fetch(input, init)`. That also repairs the same latent shape in `backupsClient`, `destroyClient` and `idipCredentialsClient.uploadImage`. - New test: a fake fetch that refuses a wrong `this` exactly as the browser does. It fails on main. | Check | Result | |---|---| | dashboard vitest | 166 files, 2216 passed, 2 skipped | | vue-tsc | clean | | eslint | clean | Needs a `testing` release after merge; no app release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WgMdPvssS1d7W1v2dL7bcH
panel unlock: call the browser's fetch as a plain function — stored and called as the port's method it throws "Illegal invocation" before the request leaves (GOTCHAS #379)
Some checks failed
ci / seam (pull_request) Has been cancelled
ci / publish (pull_request) Has been cancelled
ci / publish-broker (pull_request) Has been cancelled
ci / deploy-broker (pull_request) Has been cancelled
7670c4ce3a
Third live walk, Whakatōhea Demo, 2026-09-30 04:33Z, #2015 live: Members
said the sign-in site couldn't be reached, and the access log shows no
request to it at all, not even the preflight. HttpHandoverPort called
this.fetchImpl(...) with the browser's own fetch, which browsers refuse
unless 'this' is the window (reproduced in headless Chrome); every fake
accepts any 'this', so the unit seam never saw it.

The port holds fetch as a plain function, and the composition root hands
every client (input, init) => fetch(input, init), repairing the same
latent shape in the backups, destroy and credential-image clients.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgMdPvssS1d7W1v2dL7bcH
ben force-pushed session/unbound-fetch from 7670c4ce3a
Some checks failed
ci / seam (pull_request) Has been cancelled
ci / publish (pull_request) Has been cancelled
ci / publish-broker (pull_request) Has been cancelled
ci / deploy-broker (pull_request) Has been cancelled
to 7ddebad81e
All checks were successful
ci / seam (pull_request) Successful in 11m24s
ci / publish (pull_request) Has been skipped
ci / publish-broker (pull_request) Has been skipped
ci / deploy-broker (pull_request) Has been skipped
2026-09-30 04:43:47 +00:00
Compare
ben merged commit 655ac1fa26 into main 2026-09-30 04:45:19 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss!2019
No description provided.