Files
skills/docs/requirements/059-hub-poll-cost.md
T
Kevin Veen-BirkenbachandClaude Opus 5.5 0fad1bfae3 feat: hub and skills requirements 032 to 063
Hub: send in the field (032), coherent speak box (033), stream head band (034), Match at full width with its pile (035, 036), Home without the outer box (037), badge to Match (038), rejects that survive a changed or withdrawn card (039), the release card (040), code marks in the review diff (041), why Deny is off (042), the undo window clock (043), widgets without inner boxes (044), the Artifacts head on one line (045), accepting a red gate's risk (046), one code box (047), done rows greyed and folded (048), one control height (049), menus that stay open (050), radio settings in the Device card (051), bubbles beside the modes (052), agent settings on every face and name (053), pin only by menu (054), WASD in Match (055), the flowing card edge (056), Schedules in Controls (057) and the hub poll cost (059).

Skills: the coach leaves for its own repository kevinveenbirkenbach/coach (058; test_install pins its four skills in skills-lock.json and stays red until that repository is published and pinned), hooks and timers start fewer processes (060), council files on hot paths stay bounded and mirror by marker instead of mtime (061), scripts and hooks hand agents less output (062), and block.py builds the commit table and message block in one run (063). Requirement documents 032 to 063 with their implementation amendments.

MEDUSA false positives accepted after kvb-think-criticize (36 lines): MM-SCAN-058 (pla inside replace or plan), JB-SCAN-616/641 (the local clip helper), CODEGEN-SCAN-001 (drop-in paths), CGS-SCAN-029 (systemctl argv from constants), CGS-SCAN-040 (runner poll loop), FLA-SCAN-055 (feedback), WM-SCAN-354, AI-BACKDOOR-006, GENAI-SCAN-1270, B604 (runner shell path for passkey-verified commands), TC004, EXA002, EXA006, EXA010 and WEB-SSRF.

🎯 Fix: 92 %
💥 Break: 8 %
💸 Tokens: 89 %
⏱️ Velocity: –
🛡️ Security: ~100 %
🏆 Score: 95
🚦 Gate: ⛔ break 8 % > 5

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 08:44:15 +00:00

4.1 KiB

059 - Hub Poll Cost

User Story

As the operator, I want the hub to rebuild and send only what changed, so that an open page costs little CPU, memory and bandwidth.

Decisions (operator-confirmed 2026-11-25; do not re-litigate)

  1. Register cache (operator): read_register keeps the parsed rasci.json keyed by its (inode, size, mtime_ns), as History.rows does; one shared, read-only dict serves the state, the events, the rates and the runner's previews.
  2. Unused fields go (operator): the state drops register, which no page module reads, and the radio rows' speech, which word and rest already carry.
  3. Cached polls (operator): /api/state without to shares live_state by from rounded to the cache TTL and caches the encoded bytes with the dict; /api/events answers 304 to an If-None-Match that matches the window's digest; drawStream keeps its rows when the shown ids are unchanged. Amended 2026-11-25 in the implementation: the kept rows also need unchanged content and inbox items, since a review or decision changes its status under the same id; only the polls skip, every other redraw (a diff, a grant, a filter) still draws.
  4. Hidden tab (operator): the sky, relayout and radio-sync intervals skip while document.hidden and run once on visibilitychange; the music graph stops while musicLevel() is 0 and restarts when it rises. Amended 2026-11-25 in the implementation: the radio sync keeps switching a playing station on its schedule in a hidden tab and skips only the station drawing, since a station is mostly heard with the tab in the background; the sky draws once on visibilitychange through the state load the event already starts.
  5. Measured: one state build and one events build are timed before and after on the same council (kvb-check-efficiency velocity); the numbers go into the hand-over. The skeptic's figures were estimates from file sizes. Measured 2026-11-25 on a copy of the live council (3.4 MB rasci.json, 185 KB news.jsonl), HubCase with TTL 0, median of 10 polls: /api/state 155.0 → 72.9 ms and 1,248,250 → 828,740 bytes, /api/events 65.7 → 10.7 ms at 201,454 bytes. The run also found a 057 field shadowing the cron rows of /api/events (057 decision 2).

Approach

flowchart TD
    subgraph P["🧭 0 · Preparation"]
        P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
        P2 -- "✏️ corrections" --> P1
    end
    P2 -- "🤖 yes" --> A1
    subgraph A["🖥️ A · Server"]
        A1["⏱️ Time state and events builds"] --> A2["🗃️ Register cache"]
        A2 --> A3["✂️ Drop register and speech"] --> A4["♻️ Shared builds and 304"]
    end
    A4 --> B1
    subgraph B["🌙 B · Page"]
        B1["🙈 Hidden-tab intervals"] --> B2["🔇 Music off at level 0"]
        B2 --> B3["📜 Stream keeps unchanged rows"] --> B4["✍️ Tests written, not run"]
    end
    B4 --> C1
    subgraph C["🧪 C · Verification"]
        C1["🧪 Unit, then e2e once"] --> C2{"🟢 Green?"}
        C2 -- "🔴 no: fix" --> C1
        C2 -- "🟢 yes" --> CF{"💬 Operator feedback on screenshots?"}
        CF -- "✏️ changes" --> A1
    end
    CF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]

Acceptance Criteria

Server

  • Two /api/state calls on an unchanged rasci.json parse it once.
  • The state holds no register key and no radio row holds speech.
  • Two polls within the TTL share one build and one encoding.
  • /api/events with the current ETag answers 304 without a body.

Page

  • A hidden tab draws no sky for 60 s; visibilitychange draws once.
  • Music level 0 stops the audio graph; a rise restarts it.
  • drawStream replaces no row when the shown ids are unchanged.

Tests

  • Unit: the parse counter, the absent fields, the ETag and fake-timer page probes.
  • Integration: a HubCase state and events with and without changes.
  • E2E: Chromium at three widths: Stream keeps its rows across polls, a hidden tab stops the sky, the music stops at level 0.