feat(linkedin-studio): N17 — baseline-motor (median + variansbånd + minimum-N-refusal) [skip-docs]

Every reading now leads with "vs your own baseline", and no verdict is given
when N is too small to carry one.

- stats.ts: median + medianAbsoluteDeviation (robust pair; mean/stddev stay for
  the alert engine, which wants outlier sensitivity), rollingBaseline with a
  10-post positional window, median ± 1·MAD band floored at 0, and a typed
  insufficient-data refusal below MIN_BASELINE_N=5. readAgainstBaseline returns
  above/within/below-band, or no-verdict when the baseline was refused.
- baselineByGroup + buildBaselineBlock: per-format/per-pillar baselines, each
  judged on its own N; the reported period is excluded from its own baseline and
  compared on its median, not its mean.
- queue-join.ts (new): read-only date join supplying format/pillar from the post
  queue. Every ambiguity resolves to unlabelled, an entry labels at most one
  post, and a missing/broken queue degrades to no labels.
- weekly/monthly reports attach the block unconditionally (refusal included);
  optional in the types, so pre-N17 reports load unchanged.
- CLI: report output leads with the baseline; new `baseline [--by format|pillar]`
  verb with coverage reporting.
- report.md leads with baseline framing and prints the code's reading rather
  than judging the band by eye; WoW loses to the baseline on disagreement.
  analyze.md Step 2a tests whether the drop is real before diagnosing it.

TDD: 58 analytics tests written red first (144 -> 202). test-runner Section 16x,
23 unconditional checks + self-test (247 -> 270; anti-erosion floor 228 -> 251).
tsc clean. All suites green: trends 300, brain 134, editions 72,
specifics-bank 45, contract-gate 33, hooks 191, tests 35, render 60.

Also closes the OKF phase-4 scope follow-up in docs/okf-ingestion/plan.md §8
(coord round 2026-07-25): phase 4 tracks the contract, parse is in scope, and
our claim on read_concept/navigate_bundle is withdrawn as unnecessary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QxvWAjte7vPcF79QeSRvRJ
This commit is contained in:
Kjell Tore Guttormsen 2026-07-25 20:50:45 +02:00
commit e2ad190dda
15 changed files with 1723 additions and 14 deletions

View file

@ -261,10 +261,19 @@ the other's approval. The guard plan's own interop blocker (Python↔Node) is tr
when it starts?~~ **Answered 2026-07-20 (trinn E, felles §6): phase 4 delivers the layer-1 primitives,
not `materialize_bundle` parity** — no Node repo in the set runs door A (verified here: the only Python
in this repo is `hooks/scripts/compile-hooks.py`, a build-time script never on a data path). Our register
status therefore stays **`planned`**, not `blocked on phase 4 scope`. One follow-up outstanding: layer 1
grew after the question was asked (`read_concept`, `navigate_bundle`, `routeLevel`), so we asked whether
phase 4 tracks the set as it stands or as it evolves — the reader is decision-relevant for us, since our
dependency is `serialize ∘ parse = identity`, not the writer alone.
status therefore stays **`planned`**, not `blocked on phase 4 scope`. The follow-up (layer 1 grew after
the question was asked — `read_concept`, `navigate_bundle`, `routeLevel`) is now **closed, 2026-07-25**:
phase 4 tracks the **contract** (owned by the marketplace catalog), neither okr's evolving layer 1 nor a
frozen snapshot of it, so a function appearing in layer 1 does not by itself enter scope. Our dependency
is unaffected and turned out **narrower than the question implied**: `parse ∘ serialize = identity` is
asserted per FILE (`scripts/brain/tests/ingest.test.ts:102`), and bundle navigation here is our own
scaffold code, never a library call — so frontmatter emit/parse (their deliverable 4, which names parse
alongside emit) is sufficient and we withdrew any claim on `read_concept` / `navigate_bundle`. Two
requirements were filed instead, before their scope freeze: `write_index(mode="preserve-unowned")` must
leave an existing index **byte-untouched** (ours never opens the file — `scripts/brain/src/scaffold.ts:133-141`),
and an absent vocabulary must mean **"do not snap"**, not snap-to-`Dokument`. Recorded non-goal from their
side: no phase-4 deliverable targets this repo beyond the check/index tools tolerating our `brain/` hub
without complaining about `ingest/published/` — our `ingest/` grammar is never normalized (§5).
## 9. References