Repository navigation
feat(web-platform): HSTS, wider refusals, request id header, probes, visible hidden characters (L040) - #18
Merged
Conversation
…visible hidden characters secureResponse adds Strict-Transport-Security (max-age=31536000; includeSubDomains) to the six existing headers, whose values are unchanged. problem() accepts the closed list PROBLEM_STATUSES (400, 401, 403, 404, 405, 409, 422, 429, 500, 503) and throws web.problem_invalid for any other status, at run time too. Code pattern, identifier pattern, body and content type are unchanged. createRequestHandler sets X-Request-Id, equal to the identifier validated from the application, on every response it returns (route, static asset, 404, 405, 500, fallback, HEAD included). A client X-Request-Id is never used. A route receives the identifier as a third argument. liveRoute() and readyRoute(check) are route factories: 200 ok, 200 ready, and 503 not_ready without any detail when check rejects or throws. revealHiddenCharacters(text) replaces each hidden code point by [U+XXXX] and keeps TAB and LF; the result is plain text, not HTML. Its class is the removedRanges table of the candidate served-text preparation vectors. That candidate is not merged, so nothing is imported or pinned: the 28 ranges and 55 kept neighbours are copied under fixtures/ and the test compares the literal table of the module to that copy over the whole code space, printing its counters. A missing copy fails the test. Tests, and what turns each red: - response.test.ts: HSTS header renamed (1 test, plus the liveness test); PROBLEM_STATUSES set back to the former four statuses (1 test, plus the route refusal test); run-time status check disabled (1 test). - server.test.ts: X-Request-Id not set (3 tests); a constant passed to the route instead of the identifier (1 test). - probes.test.ts: 503 replaced by 200 (1 test); check not awaited (1 test); liveness body changed (1 test). - visible-text.test.ts: replacement disabled (2 tests); one code point dropped from the last range (1 test); copy file absent (1 test). Would an equivalent refactor turn them red? No: expectations are header values, statuses and bodies taken from the lot brief, and the class is checked through the public function against the copied table, not through the shape of the literal. Signed-off-by: Constantin Jais <74049135+constantin-jais@users.noreply.github.com>
constantin-jais
marked this pull request as ready for review
November 17, 2026 20:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Door: two-way
Origin: proposal
Summary
Lot
L040of the rewrite plan: web-platform : en-têtes, enveloppe d'erreur, sondes, échappement des caractères cachés (TypeScript sur Bun).Draft pull request. Base:
migrate/recover-code.packages/web-platform/README.mdpackages/web-platform/fixtures/served-text-preparation-candidate/removed-ranges.copy.jsonpackages/web-platform/src/index.tspackages/web-platform/src/probes.test.tspackages/web-platform/src/probes.tspackages/web-platform/src/response.test.tspackages/web-platform/src/response.tspackages/web-platform/src/server.test.tspackages/web-platform/src/server.tspackages/web-platform/src/visible-text.test.tspackages/web-platform/src/visible-text.tsCommits (1, merges excluded):
2b46518feat(web-platform): HSTS, wider refusals, request id header, probes, visible hidden charactersEvidence
The tests and controls below are local runs on the workstation (Bun 1.4.4), recorded in the commit messages; they were not replayed for this pull request. The CI on this head is authoritative.
Review: read by an independent reviewer (read-only, given the code, the base and the source, never the writer report); low findings only, left uncorrected.
Commit messages, verbatim (sign-off lines omitted):
Points left to the owner
None named in the commit messages.
Work package
No commit carries a
Work-package:orExempt:trailer. This repository runs no work-package link check; the link to a PRD row, if any, is the owner's to establish.Blast radius
libre-ai/application-development-toolkitonly. While draft, nothing moves outside the branchwork/rewrite-l040; a merge reachesmigrate/recover-code.