fix(logging): keep uncoded streamer 4xx replies on the Errors page

An uncoded 4xx comes from something in front of the streamer (body-size
limit, ingress, wrong entrypoint), so it is now streamer_unexpected_response
(502, error) rather than an info-level file_not_found. The streamer's
catch-all route gets its own code so a misrouted call logs at warn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-29 11:47:06 +00:00
1 parent 5509b30b1b
commit 0a0b579c13
5 files changed
+42 -8

No files matched your search

+21
View File
@@ -119,4 +119,25 @@ describe("streamer file failures", function () {
assert.equal(faults[0].upstreamStatus, undefined);
assert.equal(records.filter((record) => record.upstreamStatus === 502).length, 1);
});
it("reports an uncoded 4xx from in front of the streamer as a fault", async () => {
// e.g. a body-size limit or an ingress 404: nothing logged it upstream.
const proxy = await new Promise((resolve) => {
const s = require("node:http").createServer((req, res) => {
req.resume();
res.writeHead(413, { "content-type": "text/html" }).end("<h1>Payload Too Large</h1>");
}).listen(0, "127.0.0.1", () => resolve(s));
});
config.STREAMER_ENTRYPOINT = `http://127.0.0.1:${proxy.address().port}/`;
try {
const { response, records } = await request(new Error("unused"));
assert.equal(response.statusCode, 502);
assert.equal(records.length, 1, JSON.stringify(records));
assert.equal(records[0].severity, "error");
assert.equal(records[0].errorCode, "streamer_unexpected_response");
assert.equal(records[0].upstreamStatus, 413);
} finally {
await new Promise((resolve) => proxy.close(resolve));
}
});
});