feat(dashboard): testable Living Docs poll state machine#71
Merged
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.
Extracts the Living Docs poll decision into a tested ES module (
living-docs-poller.js+ Vitest), with theliving_docs.htmltemplate wired to it.Rebased onto current main (the batch-panel work from #68 is already merged). Supersedes #69, which entered a broken head-ref state after the rebase force-push (GitHub failed to reconcile the rewritten head and refused reopen).
Spec:
specs/living-docs-poller-testing/.Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com