Repository navigation
Conversation
…rite
Starlette infers {GET, HEAD} for every function route, so the four write
routes dispatched HEAD onto their handlers: any monitor, link checker,
prefetcher or URL unfurler that sent a metadata request created rooms and
notes under its own rate budget. WriteRoute pins methods to GET exactly;
read routes keep normal HEAD semantics. The 405 body already names the
lanes the path takes via allowed_methods(), which reads route.methods, so
Allow is correct with no further change.
Contributor
|
Thanks for this — and for the reproduction in #257, which is what made the fix concrete. Closing as superseded: #135 landed the same fix in b6f90f1. It took the same approach (drop Starlette's implicit One thing here that #135 does not have, and that I would still take as its own PR: |
This was referenced Aug 26, 2026
Jr-kenny
pushed a commit
to Jr-kenny/technocore-chat
that referenced
this pull request
Sep 9, 2026
flop-labs#135 pinned the room half of the dual-lane paths; this pins /kv/<ns>/<key>: a HEAD there must answer from the reader (200 on a stored note, 404 on an absent one) rather than fall through to the POST writer. Requested in the close-out of flop-labs#258.
Jr-kenny
pushed a commit
to Jr-kenny/technocore-chat
that referenced
this pull request
Sep 21, 2026
flop-labs#135 pinned the room half of the dual-lane paths; this pins /kv/<ns>/<key>: a HEAD there must answer from the reader (200 on a stored note, 404 on an absent one) rather than fall through to the POST writer. Requested in the close-out of flop-labs#258.
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.
Closes #257.
Problem
Starlette infers
{GET, HEAD}for every function route, so aHEADrequest to any write lane dispatched onto the write handler and performed the write: monitors, link checkers, prefetchers and URL unfurlers that sent a metadata request were creating rooms and notes under their own rate budget. A metadata request is assumed side-effect-free by every HTTP client; on this service it was an unauthenticated write.Fix
WriteRoute, a smallRoutesubclass used for the four write routes (say,say-signed,set,set-signed). It pinsmethodsto{GET}exactly — Starlette force-adds HEAD inRoute.__init__whenever GET is present, so setting the set after init is the only way to refuse HEAD while keeping the route function-based. Read routes keep normal HEAD semantics. No handler changed;allowed_methods()already readsroute.methods, so the existing 405 machinery emits the correctAllow: GET(and the shared-path cases now sayGET, POST) with no further change.Size/cap impact: +3 core code lines; sz-baseline.json bumped to 2024 total / app.py 980, per CONTRIBUTING's three-lines-over-a-primitive rule. Abuse impact: none — this removes writes from a verb, adds no surface.
Testing
One judgment call: I updated the pinned expectation in test_a_405_carries_allow_and_names_every_verb_the_path_takes rather than preserving Allow: GET, HEAD on write paths — that header advertised a verb that executed a write, which is the bug.