feat(linkedin-studio): N16 — out-of-network-andel + patterns-oppdatering + boundary-map [skip-docs]

Reach-splitten (in/out-of-network) er native i LinkedIns post-analytics siden juni
2026, men vises som PROSENT og finnes ikke i CSV-eksporten. Planen antok to
manuelle antall; verifiseringen viste prosent, så modellen er ett felt —
outOfNetworkPct — og in-network er komplementet.

- parseOptionalPercent: egen parser, ikke parseOptionalCount. Komma er desimal
  (36,5 -> 36.5, aldri 365), og verdi >100 avvises: i én kolonne kan ikke et
  absolutt antall skilles fra en andel, så svaret er unknown, ikke en gjetning.
  Blank/ikke-numerisk/negativ -> unknown; ekte 0 beholdes.
- Ett lagret halvpart, kryssjekket: In-network godtas og lagres som komplement;
  et transkribert par som ikke summerer til ~100 (±1 avrunding) forkastes som
  unknown i stedet for å bli halvveis trodd.
- weightedOutOfNetworkPct: impressions-vektet roll-up (avgOutOfNetworkPct, uke +
  måned). Flatt snitt lar en 50-visnings-post slå en på 10 000; poster uten
  avlesning ekskluderes, og null vekt gir undefined — aldri 0, aldri NaN.
- Reach inngår ALDRI i engagementRate (distribusjon != engasjement). Rapporten
  leser den som akvisisjon (ut) vs resonans (inn), og sier «ikke ført for denne
  perioden» framfor å estimere. En reach-innsikt går inn i N15s do-next-kanal.
- Step 7c (A2-F11): rapporten tilbyr diff mot brukerens engagement-patterns.md
  med eksplisitt go — aldri stille skriving, aldri inn i den shippede malen.
- Boundary-map (E#9): dwell eksplisitt umålbar, saves partner-gated, reach
  native men CSV-eksport uverifisert.
- Reach-frie importer er byte-identiske med før, på skjerm og på disk.

TDD: rødt bevist først (10 feilende), analytics 119 -> 144 tester, tsc ren.
test-runner 232 -> 247 (Section 16w, gulv 213 -> 228). Alle suiter grønne.
CHANGELOG: N15-oppføringen manglet og er backfilt sammen med N16.

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 15:56:04 +02:00
commit 63506f7d5c
21 changed files with 841 additions and 13 deletions

View file

@ -23,11 +23,17 @@ You are a LinkedIn analytics data import assistant. Guide the user through impor
For data format details and directory structure, see `assets/analytics/README.md`.
> **Why CSV (as of 2026-05).** Post-level analytics via LinkedIn's API is
> **Why CSV (as of 2026-07).** Post-level analytics via LinkedIn's API is
> partner-gated (vetted Community Management app + verified org + Page) and **not
> self-serve** for a personal profile, so the CSV export is the practical floor.
> Saves are visible in native post analytics (count-only) but have no self-serve
> API pull; dwell is internal-only for organic posts. See the README boundaries.
> API pull; the **in-network/out-of-network reach split** is visible natively too
> (Discovery, under impressions — rolling out globally since June 2026) but as
> percentages, and is absent from the CSV, with export status unverified; dwell is
> internal-only for organic posts. Saves and the reach share are therefore
> **optional manual columns** the user adds to the CSV (`Saves`,
> `Out-of-network` / `In-network`) — see `assets/analytics/README.md` for the
> entry rules, and the README boundaries for the full data boundary.
## Step 1: Check for CSV Files in Exports Directory
@ -135,6 +141,7 @@ The CLI prints (see `cli.ts` `handleImport`):
- `Date range:` — earliest to latest post in the batch
- `Batch ID:` and `Saved to: posts/<file>` — the batch file written
- `Saves entered:` — only when the CSV carried a `Saves` column (manual entry)
- `Reach entered:` — only when the CSV carried an `Out-of-network` (or `In-network`) column; reports the impressions-weighted share **and how many posts carried a reading**, so partial coverage is visible instead of reading as a whole-batch number
- An anomaly block — either `Immediate alerts detected:` with 🔴/⚠️/ spike/drop lines, or `No anomalies detected in imported data.`
**Surface the CLI's output to the user** — for example:
@ -146,6 +153,7 @@ Posts imported: 42
Date range: 2025-12-01 to 2026-01-29
Saved to: posts/2025-12-01-batch-a1b2c3d4.json
Saves entered: 1,204 across 18 post(s) (manual)
Reach entered: 31.4% out-of-network across 12 post(s) (manual, impressions-weighted)
Immediate alerts detected:
─────────────────────────────────────