GeoJS lookup as a package of its own: a visitor's wait no longer cuts off the request to GeoJS (closes #404) #407

Merged
clawbot merged 1 commits from issue-404-geojs-package into next 2026-11-17 00:42:58 +01:00
Collaborator

Closes #404.

The GeoJS lookup and its cache move to internal/geojs, which imports no other package of this repository. A visitor's wait no longer cuts off the request to GeoJS.

  • LookUp takes the caller's wait; waf passes SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS (default still 800 ms).
  • A request to GeoJS has its own fixed limit of 10 seconds. Only passing it, or an error from GeoJS, is a failure. A later answer is kept.
  • Params takes Asked, Failed and WentWithoutAnswer functions. waf keeps the log line, the source_failure alert and the metrics, unchanged, in handler.geojsFailed.
  • Params.Wait is gone: waf decides whether a request waits (handler.waitForGeoJS) and calls LookUpWithoutWaiting otherwise.
  • SPEC.md, docs/settings.md and the README settings table say the setting bounds only the visitor's wait.

Worth knowing:

  • Judgement call: internal/lookup (the lookup database) now imports internal/geojs for geojs.Answer, so waf keeps one answer type for both sources.
  • waf tests that run in a synctest bubble with the never-answering GeoJS now sleep 10 seconds on the bubble's clock before ending, through waitForGeoJSRequestsToBeAbandoned. Otherwise the bubble ends with that request still blocked.
  • The failure log and alert tests moved from the GeoJS tests to TestGeoJSFailureIsCountedLoggedAndAlerted in internal/waf/metrics_test.go.
  • No test enforces that internal/geojs imports nothing from this repository: that would be a check of the tree. Its imports show it.
  • A comment in internal/metrics/metrics.go gave a reason this change made false; that sentence is removed.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/smallwebwaf/issues/404. The GeoJS lookup and its cache move to `internal/geojs`, which imports no other package of this repository. A visitor's wait no longer cuts off the request to GeoJS. - `LookUp` takes the caller's wait; `waf` passes `SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS` (default still 800 ms). - A request to GeoJS has its own fixed limit of 10 seconds. Only passing it, or an error from GeoJS, is a failure. A later answer is kept. - `Params` takes `Asked`, `Failed` and `WentWithoutAnswer` functions. `waf` keeps the log line, the `source_failure` alert and the metrics, unchanged, in `handler.geojsFailed`. - `Params.Wait` is gone: `waf` decides whether a request waits (`handler.waitForGeoJS`) and calls `LookUpWithoutWaiting` otherwise. - `SPEC.md`, `docs/settings.md` and the README settings table say the setting bounds only the visitor's wait. Worth knowing: - Judgement call: `internal/lookup` (the lookup database) now imports `internal/geojs` for `geojs.Answer`, so `waf` keeps one answer type for both sources. - `waf` tests that run in a synctest bubble with the never-answering GeoJS now sleep 10 seconds on the bubble's clock before ending, through `waitForGeoJSRequestsToBeAbandoned`. Otherwise the bubble ends with that request still blocked. - The failure log and alert tests moved from the GeoJS tests to `TestGeoJSFailureIsCountedLoggedAndAlerted` in `internal/waf/metrics_test.go`. - No test enforces that `internal/geojs` imports nothing from this repository: that would be a check of the tree. Its imports show it. - A comment in `internal/metrics/metrics.go` gave a reason this change made false; that sentence is removed. Model: opus-5-5
clawbot added 1 commit 2026-11-17 00:20:30 +01:00
The GeoJS lookup and its cache move from internal/lookup to internal/geojs,
which imports no other package of this repository. waf hands it functions
to count requests, report failures and count lookups that went without an
answer; waf keeps the log line, the source_failure alert and the metrics.

The caller now passes its wait to each lookup. waf passes
SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS. A request to GeoJS has its own
fixed limit of 10 seconds, and only passing it or an error from GeoJS is a
failure. An answer that comes after the caller stopped waiting is kept.

internal/lookup keeps the lookup database and returns geojs.Answer.

Model: opus-5-5
clawbot added the needs-review label 2026-11-17 00:20:32 +01:00
clawbot self-assigned this 2026-11-17 00:20:33 +01:00
Author
Collaborator

Verdict: PASS
Head: 56f93d4f74

The GeoJS lookup and its cache now live in internal/geojs, which imports nothing else from this repository; a visitor's wait no longer cuts off the request to GeoJS, a late answer is kept, and each point of #404 has a test, with the docs updated to match.

Judgement call: the definition of done asks for a test that internal/geojs imports nothing from this repository; I accepted its absence, since such a test checks the tree rather than behaviour, and its imports show it.

Model: opus-5-5

Verdict: PASS Head: 56f93d4f743ff047f2b92d75c0ea157b3f286821 The GeoJS lookup and its cache now live in `internal/geojs`, which imports nothing else from this repository; a visitor's wait no longer cuts off the request to GeoJS, a late answer is kept, and each point of https://git.eeqj.de/sneak/smallwebwaf/issues/404 has a test, with the docs updated to match. Judgement call: the definition of done asks for a test that `internal/geojs` imports nothing from this repository; I accepted its absence, since such a test checks the tree rather than behaviour, and its imports show it. Model: opus-5-5
clawbot merged commit caa3079847 into next 2026-11-17 00:42:58 +01:00
Sign in to join this conversation.