fix(coverage): review fixes for the coverage proxy and page (#78) #81

Merged
maximus merged 1 commit from fix/78-coverage-review into deploy 2026-11-06 17:42:12 +00:00
Member

Follow-up to #79, which already landed in deploy via merge train #80 (abc536cc) before the review fixes were pushed. These are the review fixes on top of deploy (one commit, c78be3de; it is the same tree as 116ed430 on the old branch).

  1. Origin check: a cookie-authenticated POST now needs Origin equal to ours, or Sec-Fetch-Site: same-origin when the browser sends no Origin. A missing Origin alone gets 403. wanderer_key API-token requests (hooks.server.ts authenticates Authorization: Bearer wanderer_key… and then ignores the cookie) need neither. There are tests for each case: no headers, cross-site, same-site, Origin: null, a sibling origin, a foreign Origin with same-origin Sec-Fetch-Site, a non-token Authorization header, and the accepted cases.
  2. Stale runs: only the service's active flag (unfinished Jobs) drives polling and disables Build/Probe/Rollback. A run.json stuck at running with nothing active shows a "stale" badge and an explanation, and the page does not poll. After a 201, polling continues for a 15 s grace period in case the new Job is not listed yet. Stale steps no longer count their timer up to now.
  3. Served regions only: the editor hint and overlay use only regions with state: "served". The service sets "planned" when coverage.json has no regions and it falls back to plan.json. With no served regions, no hint is shown.
  4. Titles: one rule (validRegionTitle) is shared by the proxy and the page, matching the service's 1 <= len(title) <= 120 and title.isprintable(). Length is counted in code points, so an emoji counts once. Emoji and flags pass; ZWJ sequences (U+200D is Cf), NBSP, tabs and line separators are refused, as in Python. I cross-checked the cases with Python 3.13. The title input dropped maxlength, which counts UTF-16 units.

Results: vitest has 103 files / 1384 tests passing (13 skipped). npm run check has 0 errors and the same 2 warnings as before (the editor <tbody>).

The homelab-flux wiring checklist in #79's body still applies unchanged.

Refs #78

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP

Follow-up to #79, which already landed in deploy via merge train #80 (abc536cc) before the review fixes were pushed. These are the review fixes on top of deploy (one commit, c78be3de; it is the same tree as 116ed430 on the old branch). 1. **Origin check:** a cookie-authenticated POST now needs `Origin` equal to ours, or `Sec-Fetch-Site: same-origin` when the browser sends no Origin. A missing Origin alone gets 403. `wanderer_key` API-token requests (hooks.server.ts authenticates `Authorization: Bearer wanderer_key…` and then ignores the cookie) need neither. There are tests for each case: no headers, cross-site, same-site, `Origin: null`, a sibling origin, a foreign Origin with same-origin Sec-Fetch-Site, a non-token Authorization header, and the accepted cases. 2. **Stale runs:** only the service's `active` flag (unfinished Jobs) drives polling and disables Build/Probe/Rollback. A run.json stuck at `running` with nothing active shows a "stale" badge and an explanation, and the page does not poll. After a 201, polling continues for a 15 s grace period in case the new Job is not listed yet. Stale steps no longer count their timer up to now. 3. **Served regions only:** the editor hint and overlay use only regions with `state: "served"`. The service sets `"planned"` when coverage.json has no regions and it falls back to plan.json. With no served regions, no hint is shown. 4. **Titles:** one rule (`validRegionTitle`) is shared by the proxy and the page, matching the service's `1 <= len(title) <= 120 and title.isprintable()`. Length is counted in code points, so an emoji counts once. Emoji and flags pass; ZWJ sequences (U+200D is Cf), NBSP, tabs and line separators are refused, as in Python. I cross-checked the cases with Python 3.13. The title input dropped `maxlength`, which counts UTF-16 units. Results: vitest has 103 files / 1384 tests passing (13 skipped). `npm run check` has 0 errors and the same 2 warnings as before (the editor `<tbody>`). The homelab-flux wiring checklist in #79's body still applies unchanged. Refs #78 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
fix(coverage): review fixes for the coverage proxy and page (#78)
All checks were successful
CI / web (push) Successful in 2m4s
CI / go (push) Successful in 13m12s
c78be3de02
- Cookie-authenticated POSTs must prove they are same-origin: an Origin
  equal to ours, or Sec-Fetch-Site: same-origin when a browser sends no
  Origin. A missing Origin is no longer enough. wanderer_key API-token
  clients (never sent cross-site by a browser) need neither.
- Runs: the service's `active` flag (unfinished Jobs) alone drives
  polling and disables the buttons. A run.json stuck at "running" after
  the orchestrator died shows as stale (badge + explanation) instead of
  polling forever. A short grace period after a 201 covers a Job that
  is not listed yet.
- The editor hint and overlay use served regions only; planned regions
  (nothing built yet) are not coverage, so there is no hint until
  something is built.
- Titles follow the service's rule, shared by the proxy and the page:
  Python len() (code points, an emoji counts once) <= 120 and
  str.isprintable(). Emoji pass, but ZWJ sequences, NBSP and other
  non-printables do not. The title input no longer uses maxlength
  (UTF-16 units).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
maximus merged commit c78be3de02 into deploy 2026-11-06 17:42:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/wanderer!81
No description provided.