feat(dashboard): testable Living Docs poll state machine#69
Closed
silversurfer562 wants to merge 3 commits into
Closed
feat(dashboard): testable Living Docs poll state machine#69silversurfer562 wants to merge 3 commits into
silversurfer562 wants to merge 3 commits into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tomainwhen #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— pureshouldKeepPolling(rows)+POLL_INTERVAL_MS, DOM/timer-free, defensive over non-array / missingcomputed_state.static_cw/living-docs-poller.test.js— 6 cases: continue when any row regenerating, stop when none, empty list, non-array/nullinput, rows missingcomputed_state, cadence constant.living_docs.html— poller<script>→<script type="module">importing the module; inline.some(...)→shouldKeepPolling,1500→POLL_INTERVAL_MS. All other glue unchanged.Verification
/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