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]): remove from PLAN.md and log to changelog
[._.]/ Adam Eivy51777533b4b4
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6b714b5b2e..36385c78a9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,6 +2,8 @@## 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`), kind-routing through `matchCharactersInText` / `matchPlacesInText` / `matchObjectsInText`, the corpus-skip path for empty/whitespace issues + the `issueCount` "total scanned" contract, the multi-stage corpus aggregation (idea / comicScript / teleplay), and the `Array.isArray(universe[kind])` guard for undefined kinds. 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 — the multi-stage corpus test seeds 3 of the 6 fields `corpusForIssue` aggregates (`idea.output`, `comicScript.output`, `teleplay.output` + the implicit `prose.output` from sibling tests); a regression that drops `prose.input` or `idea.input` 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).- **[med-importer-server-services-importer-test-js-no] Pin `existingCanonBlock` dedupe wiring in importer service tests.** `server/services/importer.test.js` had no coverage for the `existingCanonBlock` argument that `analyzeImport` passes into the `importer-canon-extract` LLM call at `importer.js:472-479` — a refactor that dropped the arg or wired it to `null`/`''` would leave the canon-extract LLM blind to already-seeded characters / places / objects, and every second-pass import would silently re-extract duplicates. New `'wires existingCanonBlock into the canon-extract prompt for dedup on a second-pass import'` test in `analyzeImport`'s describe block seeds a universe with one character via `universeSvc.createUniverse` + `updateUniverse`, runs `analyzeImport` against the seeded universe name, looks up the `importer-canon-extract` call by stage name (defensive against future `Promise.all` scheduling changes vs. the brittle `calls[0]` shape from the PLAN ask), and asserts the seeded character name reaches `existingCanonBlock`. The lookup-by-stage-name is the only deviation from the PLAN ask's literal `calls[0][1]` shape — `analyzeImport` fires canon + arc via `Promise.all` and any future deferral / reorder would silently break the test. 46/46 importer tests pass.diff --git a/PLAN.md b/PLAN.mdindex 78e2c4da99..5de249bb12 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)-- [ ] [med-canon-server-services-canonusage-js-zero-test] **[MED][CANON]** `server/services/canonUsage.js` — zero test coverage for `getUniverseCanonUsage`. The "Appears-in sort: issueCount desc + alpha tiebreaker" invariant lives at line ~101 with no test. Add a `canonUsage.test.js`.+- [ ] [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.### Better-audit residue