Skip to content

fix(test): runtime file-route tests send the real file name - #484

Merged
allisonmahmood merged 1 commit into
mainfrom
t3code/8ceb7428
Oct 2, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
t3code/8ceb7428

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

Effect's typed HttpApiClient only fills :name path segments, so runtime tests that called the wildcard file routes sent a literal * and the handlers never saw the file name. The wide-events test's "no filename in any event" assertion could not fail.

The runtime test fixtures gain fileUrl, derived from RuntimeGroup.endpoints.getFile.path like the Files HTTP suite's helper, and socket, the same routes on NodeHttpServer.layerTest for raw requests. Every runtime test that hits a file route now sends the real, encoded URL. The wide-events test asserts its handlers received private-store / private-filename and then checks all five events for them (it checked three before). UndeclaredHeadersApi is gone, since a raw request already sends every header.

Closes #474

How it was verified

  • pnpm test passes locally

  • Added or updated tests covering this change

  • Putting the literal * back in fileUrl fails the wide-events test with name: "*" in the diff.

  • A throwaway check confirmed folder/a b%#?é.png reaches the handler intact over the socket.

  • pnpm verify: format, lint, typecheck, postgres-concurrency, cli-smoke, tier2-smoke and browser pass. The offline test step hit 25 timeouts in untouched packages while another worktree's verify ran right after a reboot; those 11 files pass on their own (177 tests).

Release impact

  • Breaking
  • Not breaking: tests only.

Follow-up outside this issue: the file-route contract text in packages/api/src/api.ts says to encode the whole name so slashes travel as %2F, while every real caller splits on /. Both work; the docs should probably describe what callers do.

Review

GPT 6.1 Sol (codex) reviewed twice.

  • First pass: the first version used an in-memory raw client that skipped Effect's pre-response handlers. Replaced with the repo's sanctioned NodeHttpServer.layerTest shape.
  • Second pass: no findings.

Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via codex.

@github-actions github-actions Bot added area:server Touches the server area size:m 100-500 changed lines labels Oct 2, 2026
Effect's typed client only fills `:name` path segments, so calls to the
wildcard file routes sent a literal `*` and handlers never saw the name.
The wide-events filename-privacy assertion could not fail.

The runtime fixtures gain `fileUrl`, derived from the route like the Files
HTTP suite's helper, and `socket`, the same routes on
`NodeHttpServer.layerTest` for raw requests. File-route tests use them, and
the wide-events test asserts its handlers received the real store and name
and checks all five events for it. `UndeclaredHeadersApi` is gone: a raw
request already sends every header.

Closes #474

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@allisonmahmood
allisonmahmood merged commit 918d7b6 into main Oct 2, 2026
11 checks passed
@allisonmahmood
allisonmahmood deleted the t3code/8ceb7428 branch October 2, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:server Touches the server area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(runtime): typed file-route tests never send the file name

1 participant