Document codebase: comments, per-area READMEs, deployment guide
Readability pass across all four areas of the stack. Comments explain why rather than what, concentrated at the points where behaviour is non-obvious: concurrency, caching, auth, scraping and nginx templating. Backend: doc comments on every exported declaration across handlers, services, models and resolvers. Resolver commentary lives inside function bodies so gqlgen does not strip it on regeneration; schema files use # comments rather than description blocks so introspection output is unchanged. Extracted the duplicated auth-cookie blocks into helpers. Frontend: header comments on every component, store and view, including STATUS: notes marking which of the parallel/legacy views are still live. Documented the non-reactive animation-state pattern, the homeData hub and the WebSocket stale-socket guard. Removed a few dead imports and named the reconnect-backoff and poll-interval constants. Python: module and function docstrings covering the Travelodge scraping contract, the deadline threading, the two-executor concurrency and the NDJSON streaming protocol. Infra: header blocks on every compose file, nginx template, Dockerfile and entrypoint, covering the config selection, envsubst allow-lists, rate-limit semantics and volume persistence. Hoisted the duplicated envsubst variable list in nginx/entrypoint.sh. New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example, backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which stated a 24h access token where main.go sets 7 days. No behaviour change. go build/vet, vite build, py_compile and docker compose config all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
<script setup>
|
||||
/**
|
||||
* "Single stay" tab of /hotels: cheapest hotels for one specific check-in date.
|
||||
*
|
||||
* Results stream in: the backend sends a `hotels` event with room prices first,
|
||||
* then a `transport` event per hotel as each route is priced, then `done`. Rows
|
||||
* are patched in place by hotel `code` so the table fills in rather than
|
||||
* reloading, and PENDING_ROUTE marks the not-yet-priced ones.
|
||||
*
|
||||
* An AbortController cancels an in-flight stream; a 1s ticker drives the elapsed
|
||||
* counter. Both are torn down in the `finally` and on unmount.
|
||||
*/
|
||||
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
||||
import SharedFields from "./SharedFields.vue";
|
||||
import HotelRows from "./HotelRows.vue";
|
||||
@@ -157,6 +168,15 @@ function buildRequest() {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply one NDJSON event from the search stream.
|
||||
*
|
||||
* Order is `hotels` (room prices for all candidates) -> many `transport`
|
||||
* (one per hotel as its route is priced) -> `done`. Transport events patch the
|
||||
* existing row in place, matched on hotel `code`, so the table fills in
|
||||
* column-by-column instead of being rebuilt — that is what keeps scroll
|
||||
* position and sort order stable while results arrive.
|
||||
*/
|
||||
function applyEvent(ev) {
|
||||
switch (ev.event) {
|
||||
case "hotels":
|
||||
@@ -194,6 +214,8 @@ async function onSearch() {
|
||||
searching.value = true;
|
||||
elapsed.value = 0;
|
||||
saveConfig();
|
||||
// 1s elapsed counter plus an AbortController to cancel the stream; both
|
||||
// are torn down in the finally below and on unmount.
|
||||
ticker = setInterval(() => elapsed.value++, 1000);
|
||||
aborter = new AbortController();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user