Skip to content

feat(dashboard): testable Living Docs poll state machine#69

Closed
silversurfer562 wants to merge 3 commits into
feat/dashboard-js-testingfrom
feat/living-docs-poller-testing
Closed

feat(dashboard): testable Living Docs poll state machine#69
silversurfer562 wants to merge 3 commits into
feat/dashboard-js-testingfrom
feat/living-docs-poller-testing

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

Second application of the dashboard-JS testing pattern (after the batch panel in #68). Stacks on #68 — base is feat/dashboard-js-testing; will auto-retarget to main when #68 merges. Review #68 first.

What

Extracts the Living Docs poller's one bug-prone decision — the stop condition — into a tested module; the timer/DOM/visibility glue stays inline.

  • static_cw/living-docs-poller.js — pure shouldKeepPolling(rows) + POLL_INTERVAL_MS, DOM/timer-free, defensive over non-array / missing computed_state.
  • static_cw/living-docs-poller.test.js — 6 cases: continue when any row regenerating, stop when none, empty list, non-array/null input, rows missing computed_state, cadence constant.
  • living_docs.html — poller <script><script type="module"> importing the module; inline .some(...)shouldKeepPolling, 1500POLL_INTERVAL_MS. All other glue unchanged.

Verification

  • Vitest: 113 passed (11 files) — new poller tests + batch-panel + all 9 editor suites still green.
  • Live: /cw-static/living-docs-poller.js → 200, page intact (scan/ws-form/batch-section present), both module scripts load, batch SSE still 200, zero console errors — behavior identical.

Scope

Only the poll decision. The Jinja↔JS computed_state → badge/action map duplication (a real drift risk) is explicitly deferred to its own spec — it needs an API-payload decision. Spec: specs/living-docs-poller-testing/ (Phases 1–3 approved).

🤖 Generated with Claude Code

silversurfer562 and others added 3 commits June 14, 2026 19:53
Follow-on to dashboard-js-testing. Scope: extract + Vitest-test the
Living Docs poll state machine (shouldKeepPolling / scheduling) using the
approved no-build ES-module pattern. Behavior-preserving; no API change.

The Jinja↔JS badge/action mapping duplication is noted but explicitly
deferred to its own follow-up spec (needs an API-payload decision).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Phases 1-3 approved 2026-06-14. Extract shouldKeepPolling + POLL_INTERVAL_MS
to a tested static_cw module; convert the poller block to type=module glue.
Stacks on #68 for the static_cw infra + Vitest glob.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Apply the dashboard-js-testing pattern to the Living Docs poller
(specs/living-docs-poller-testing):

- static_cw/living-docs-poller.js — pure shouldKeepPolling(rows) +
  POLL_INTERVAL_MS, DOM/timer-free; defensive over non-array / missing
  computed_state.
- static_cw/living-docs-poller.test.js — 6 cases (stop/continue/empty/
  defensive + cadence constant).
- living_docs.html — poller <script> becomes <script type="module">
  importing the module; inline .some(...) → shouldKeepPolling, 1500 →
  POLL_INTERVAL_MS. All timer/DOM/visibility glue unchanged.

Vitest: 113 passed (poller + batch-panel + editor). Verified live: module
200, page intact, batch SSE still 200, no console errors — behavior
identical. Stacks on #68.

Badge/action map de-dup remains a separate deferred spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant