Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+3 -12
View File
@@ -124,8 +124,7 @@ def test_ndjson_frames_one_json_object_per_line():
def test_ndjson_omits_none_fields():
# The reader treats an absent key as null, so exclude_none is part of the
# contract rather than only a size optimisation.
# The reader treats absent as null, so exclude_none is contract.
body = read_lines(main._ndjson(iter([main.HotelSearchEvent(event="error", detail="boom")])))
payload = json.loads(body.strip())
assert payload == {"event": "error", "cached": False, "detail": "boom"}
@@ -134,8 +133,6 @@ def test_ndjson_omits_none_fields():
def test_ndjson_headers_defeat_proxy_buffering():
response = main._ndjson(iter([]))
assert response.media_type == "application/x-ndjson"
# Without X-Accel-Buffering an nginx-style proxy holds the whole response
# and the stream is pointless. (Caddy streams it regardless.)
assert response.headers["x-accel-buffering"] == "no"
assert response.headers["cache-control"] == "no-cache"
@@ -240,8 +237,6 @@ def test_a_cached_result_replays_as_the_opening_event_plus_done():
assert len(calls) == 1 # the upstream generator was not run again
assert [e.event for e in replay] == ["hotels", "done"]
assert all(e.cached for e in replay)
# The replay carries the finished rows on both lines, so a streaming reader
# needs no special case for a cache hit.
assert replay[0].rows == replay[1].rows
@@ -267,8 +262,7 @@ def test_search_and_scan_caches_cannot_collide():
def test_an_unfinished_stream_is_not_cached():
# Only "done" writes the cache, so a stream that errored part-way must be
# re-run rather than replayed as if it had completed.
# Only "done" writes the cache.
def gen():
yield "hotels", search_summary(), []
raise travelodge.UpstreamError("Travelodge search failed")
@@ -301,8 +295,6 @@ def test_upstream_failures_become_a_final_error_event(exc, want_detail):
def test_a_failure_while_binding_the_generator_is_also_an_error_event():
# make_gen is called inside the guard precisely so this is a stream event
# rather than a 500 from the endpoint.
def gen():
raise ValueError("bad request")
@@ -333,8 +325,7 @@ def test_the_search_slot_is_released_after_a_failure():
def test_an_abandoned_stream_releases_the_search_slot():
# The frontend closes the connection when the user navigates away, so the
# generator is closed part-way; the finally in _guarded must still run.
# The frontend aborts on navigation; the guard's finally must still run.
def gen():
yield "hotels", search_summary(), []
yield "done", search_summary(), []