social-reporting-tool/v2/server/db
DJP 46675e9a99 Wire the rest: lens artefacts, brief edit, manifest panel, QA sign-off + build gate
Closes the V3 brief gaps that were called out in the audit.

Stage 8c lens artefacts (V3 §8c):
- prompts/lens_enrichment.md: rubric for Hooks Library / Visual Vernacular /
  Audio Atlas / Sentiment Map.
- stages/stage_8c_lenses.ts: zod-validated lens generation from atomic
  insights + per-video analyses; writes lenses/{hooks_library,visual_vernacular,
  audio_atlas,sentiment_map}.json.
- stage_10_build.ts: dataset_v2.json now includes the four lens arrays.
- cli.ts: new `lenses` command; `all` runs 8c after Stage 8 (fail-soft);
  `build` runs 8c too in case the previous run skipped it.

Pipeline split for sign-off enforcement (V3 §9):
- cli.ts `all` command now stops at status=qa after Stage 9. The operator app
  drives Stage 10 separately via POST /api/reports/:id/build, which the
  server only allows after CM + Strategist sign-offs from two different
  humans.
- routes/reports.ts: handleQaSignoff (POST /api/reports/:id/qa/sign with
  role=cm|strategist), handleBuildReport (verifies both signoffs + different
  user_ids, then spawns `cli.ts build`). handleGetReport now also returns
  manifest summary + qa.{cm_signoff,strategist_signoff}.

Brief edit (PATCH):
- db/briefs.ts: updateBrief.
- routes/briefs.ts: handleUpdateBrief, with editor+ team role.
- /api/briefs/:id PATCH route added.
- operator-app: useUpdateBrief hook; new /briefs/:id/edit route — minimal
  JSON-textarea form, prefilled from brief.full, with Zod-issue surfacing.
- briefs/detail: "Edit" button next to Export/Run.

Reports detail UI:
- ManifestPanel: when manifest summary is in the response, render asset-
  status grid + collapsible missing-videos list + the exact CLI command to
  --drop-failing-backfill.
- SignoffPanel: two cards (CM + Strategist) showing signed-by-email/at;
  "Sign as ..." button per side; client-side guard prevents the same user
  signing both; "Build report" button enabled only when both signoffs
  present + different humans.
- Dashboard static-serve route + Open dashboard / Download bundle from
  earlier session re-confirmed wired.

Server clean, vite build green at 282 kB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 19:57:49 -04:00
..
briefs.ts Wire the rest: lens artefacts, brief edit, manifest panel, QA sign-off + build gate 2026-04-29 19:57:49 -04:00
client.ts Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
memberships.ts Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
reports.ts Wire reports end-to-end: trigger, track, poll, view 2026-04-29 19:18:57 -04:00
teams.ts Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00
users.ts Add V2: multi-team social-reporting platform with manifest-gated linking 2026-04-29 17:39:07 -04:00