fix(linkedin-studio): close v4.0.0 audit review findings (S8)

Close the 5 findings from the S7 /trekreview release gate (review.md, verdict BLOCK):

- BLOCKER: comment-multiplier "5x" reconciled to the canonical order-only framing
  (no fixed multiplier) in agents/engagement-coach.md, linkedin-growth-playbook,
  linkedin-formats.md — per algorithm-signals-reference.md ("do not quote a comment
  multiplier").
- BLOCKER: carousel rate "6.60%/6.6% (highest)" reconciled to "~7% top organic
  format" in linkedin-formats.md:42 (was self-contradicting :50) and
  assets/templates/carousel-templates.md.
- Lint hardening: test-runner.sh STALE_STATS now matches 6.60% + the 5x comment
  folklore and scans agents/ + assets/templates/ — the grep that defines the
  Phase-0 criterion now catches both BLOCKERs.
- MAJOR: onboarding.md command count 26 -> 27.
- MAJOR: add section-append-branch (production-path) tests for recordFirstHourPlan
  + recordOutreachContact against a template-layout fixture.
- MINOR: move date-scalar changes.push inside the write branch in state-updater.mjs.

Verify: node --test hooks/scripts/__tests__/*.test.mjs -> 92/92; bash
scripts/test-runner.sh -> 66/0/0. NO push until /trekreview re-confirms ALLOW/WARN.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-05-30 09:27:15 +02:00
commit 18b198f655
8 changed files with 104 additions and 13 deletions

View file

@ -219,13 +219,16 @@ export function recordFirstHourPlan(stateContent, { planDate, postTopic = '', ta
let content = stateContent;
const changes = [];
// 1. last_firsthour_date — replace in place, else insert after last_post_date (additive)
// 1. last_firsthour_date — replace in place, else insert after last_post_date (additive).
// Report the change only inside the branch that actually writes it: if neither
// anchor field exists, the scalar is not inserted and must not be reported as changed.
if (/^last_firsthour_date: .*/m.test(content)) {
content = replaceField(content, 'last_firsthour_date', `"${planDate}"`);
changes.push(`last_firsthour_date → ${planDate}`);
} else if (/^last_post_date: .*/m.test(content)) {
content = content.replace(/^(last_post_date: .*)$/m, `$1\nlast_firsthour_date: "${planDate}"`);
changes.push(`last_firsthour_date → ${planDate}`);
}
changes.push(`last_firsthour_date → ${planDate}`);
// 2. firsthour_active flag — only touch if the field is declared (additive)
if (/^firsthour_active: .*/m.test(content)) {
@ -276,15 +279,18 @@ export function recordOutreachContact(stateContent, { contactDate, track = '', p
const changes = [];
// 1. last_outreach_date — replace in place, else insert after last_firsthour_date
// if present, else after last_post_date (additive — never required up front)
// if present, else after last_post_date (additive — never required up front).
// Report the change only inside the branch that actually writes it.
if (/^last_outreach_date: .*/m.test(content)) {
content = replaceField(content, 'last_outreach_date', `"${contactDate}"`);
changes.push(`last_outreach_date → ${contactDate}`);
} else if (/^last_firsthour_date: .*/m.test(content)) {
content = content.replace(/^(last_firsthour_date: .*)$/m, `$1\nlast_outreach_date: "${contactDate}"`);
changes.push(`last_outreach_date → ${contactDate}`);
} else if (/^last_post_date: .*/m.test(content)) {
content = content.replace(/^(last_post_date: .*)$/m, `$1\nlast_outreach_date: "${contactDate}"`);
changes.push(`last_outreach_date → ${contactDate}`);
}
changes.push(`last_outreach_date → ${contactDate}`);
// 2. outreach_active flag — only touch if the field is declared (additive)
if (/^outreach_active: .*/m.test(content)) {