Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs([med-canon-server-services-canonusage-js-zero-test]): un-drift changelog sort example + PLAN.md follow-up text per codex iter-2
[._.]/ Adam Eivy7266ddcf6c86
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 91a6d7bc3b..bc6fcd46c7 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,7 +2,7 @@## Changed-- **[med-canon-server-services-canonusage-js-zero-test] `getUniverseCanonUsage` heavy-endpoint contract now pinned.** `server/services/canonUsage.test.js` previously only covered `seriesNameMap`/`seriesCount` and the thin `listLinkedSeriesNames` variant. The per-entry usage rows the comic-panel / canon-card UI consumes — produced by the multi-stage corpus scan + per-(kind, entryId, seriesId) tally + sort at `canonUsage.js:99-132` — had no tests, so the JSDoc-pinned "Appears-in sort: issueCount desc + alpha tiebreaker on seriesName" invariant could regress silently. New `getUniverseCanonUsage entry rows` describe block adds six tests: 404 on missing universe (separate from `listLinkedSeriesNames`' 404 because that variant only translates `ERR_NOT_FOUND` while `getUniverseCanonUsage` re-throws any `getUniverse` error as 404), sort by `issueCount` desc with alpha tiebreaker (`Zeta Tales (1)` < `Alpha Tales (1)` < `Beta Tales (2)` → output order `Beta, Alpha, Zeta`), bucket wiring for the three kinds (matches for `characters` / `places` / `objects` each land under their canonically-named `usage[kind]` key — does not pin matcher *behavior*, which lives in `scenePrompt.test.js`), the empty/whitespace-corpus contract (issues still count toward `issueCount` but produce no entry rows), the multi-stage corpus aggregation (idea / comicScript / teleplay), and the empty-bucket return for kinds the universe defines no entries for (also exercises the `Array.isArray(universe[kind])` guard). 11/11 tests in the file pass; 6169/6169 server tests pass. `[cover-prose-input-idea-input-in-canonusage-corpus]` captured as a follow-up — across the new block + sibling tests, 4 of the 6 fields `corpusForIssue` aggregates are covered (`prose.output` via sibling tests; `idea.output` / `comicScript.output` / `teleplay.output` via the multi-stage corpus test). `prose.input` and `idea.input` aren't seeded by any test, so a regression that drops either from the corpus list would still slip past the suite.+- **[med-canon-server-services-canonusage-js-zero-test] `getUniverseCanonUsage` heavy-endpoint contract now pinned.** `server/services/canonUsage.test.js` previously only covered `seriesNameMap`/`seriesCount` and the thin `listLinkedSeriesNames` variant. The per-entry usage rows the comic-panel / canon-card UI consumes — produced by the multi-stage corpus scan + per-(kind, entryId, seriesId) tally + sort at `canonUsage.js:99-132` — had no tests, so the JSDoc-pinned "Appears-in sort: issueCount desc + alpha tiebreaker on seriesName" invariant could regress silently. New `getUniverseCanonUsage entry rows` describe block adds six tests: 404 on missing universe (separate from `listLinkedSeriesNames`' 404 because that variant only translates `ERR_NOT_FOUND` while `getUniverseCanonUsage` re-throws any `getUniverse` error as 404), sort by `issueCount` desc with alpha tiebreaker (seeded as Zeta Tales (1) / Alpha Tales (1) / Beta Tales (2); expected output Beta → Alpha → Zeta — the equal-count pair Alpha/Zeta exercises the alpha-ascending tiebreaker, the Beta/(Alpha|Zeta) pair exercises issueCount-desc), bucket wiring for the three kinds (matches for `characters` / `places` / `objects` each land under their canonically-named `usage[kind]` key — does not pin matcher *behavior*, which lives in `scenePrompt.test.js`), the empty/whitespace-corpus contract (issues still count toward `issueCount` but produce no entry rows), the multi-stage corpus aggregation (idea / comicScript / teleplay), and the empty-bucket return for kinds the universe defines no entries for (also exercises the `Array.isArray(universe[kind])` guard). 11/11 tests in the file pass; 6169/6169 server tests pass. `[cover-prose-input-idea-input-in-canonusage-corpus]` captured as a follow-up — across the new block + sibling tests, 4 of the 6 fields `corpusForIssue` aggregates are covered (`prose.output` via sibling tests; `idea.output` / `comicScript.output` / `teleplay.output` via the multi-stage corpus test). `prose.input` and `idea.input` aren't seeded by any test, so a regression that drops either from the corpus list would still slip past the suite.- **[add-emitrunstarted-hook-shape-test-to-runner] Pin `emitRunStarted` payload-flattening contract in `server/services/runner.test.js`.** The `provider?.name || provider?.id` and `model ?? provider?.defaultModel` fallbacks in `runner.js:198-204` previously had zero direct coverage — `tuiPromptRunner.js`'s PTY tests mock `emitRunStarted` itself, so a regression that dropped the `name` preference or flipped the model fallback from `??` to `||` (silently rewriting an intentionally-empty model to `defaultModel`) would have slipped past every test. New `describe('emitRunStarted — payload-flattening contract')` block in `runner.test.js` exports `emitRunStarted` from the module under test, registers a `runnerConfig.hooks.onRunStarted` mock via `setAIToolkit(fakeToolkit(), { hooks })`, and asserts the hook payload across 8 cases: `name`-preferred-over-`id`, `id` fallback when `name` is absent, explicit `model` overriding `defaultModel`, `defaultModel` fallback when `model` is `undefined`, `defaultModel` fallback when `model` is `null` (`??` semantics), empty-string `model` preserved (guards against a `||` regression), `provider: undefined` → both fields `undefined`, and the no-op path when no hook is registered. 43/43 runner tests pass (35 prior + 8 new).diff --git a/PLAN.md b/PLAN.mdindex 5de249bb12..9128d3728e 100644--- a/PLAN.md+++ b/PLAN.md@@ -14,7 +14,7 @@ _Nothing currently parked — pick the next item from the Backlog._### v2.1.0 pre-release review residue (deferred from main→release multi-agent review, 2026-05-16)-- [ ] [cover-prose-input-idea-input-in-canonusage-corpus] **[LOW][TESTS]** **Cover `prose.input` + `idea.input` in canonUsage corpus aggregation test.** `server/services/canonUsage.js#corpusForIssue` (lines 25–36) aggregates 6 stage fields into the matcher corpus: `prose.output`, `prose.input`, `idea.output`, `idea.input`, `comicScript.output`, `teleplay.output`. The "aggregates corpus across prose / idea / comicScript / teleplay stages" test in `canonUsage.test.js` only seeds 4 of those (`idea.output`, `comicScript.output`, `teleplay.output`, plus existing `prose.output` coverage elsewhere) — `prose.input` and `idea.input` aren't pinned. A regression that drops one of those two fields from the corpus list would slip past the suite silently. Extend the existing test or add a sibling test that seeds an issue with a unique character name in each of those two `input` fields. Surfaced by /simplify reuse-agent during `[med-canon-server-services-canonusage-js-zero-test]`; deferred to keep that PR scoped to the sort invariant + heavy-endpoint shape.+- [ ] [cover-prose-input-idea-input-in-canonusage-corpus] **[LOW][TESTS]** **Cover `prose.input` + `idea.input` in canonUsage corpus aggregation test.** `server/services/canonUsage.js#corpusForIssue` (lines 25–36) aggregates 6 stage fields into the matcher corpus: `prose.output`, `prose.input`, `idea.output`, `idea.input`, `comicScript.output`, `teleplay.output`. Across the new describe block, 4 of those 6 fields are covered: the "aggregates corpus across idea / comicScript / teleplay stages" test seeds 3 (`idea.output`, `comicScript.output`, `teleplay.output`), and `prose.output` is covered by the sort / empty-corpus / bucket-wiring tests in the same block. `prose.input` and `idea.input` aren't pinned by any test. A regression that drops one of those two fields from the corpus list would slip past the suite silently. Extend the existing test or add a sibling test that seeds an issue with a unique character name in each of those two `input` fields. Surfaced by /simplify reuse-agent during `[med-canon-server-services-canonusage-js-zero-test]`; deferred to keep that PR scoped to the sort invariant + heavy-endpoint shape.### Better-audit residue