Repository navigation
feat(reports): templates with section picker, four new modules, deltas and change-story summary - #419
Merged
Merged
Conversation
…ctions, generate US-1.1: four templates — Weekly Visibility Summary (7d), Monthly Executive Report (full, 30d), Competitor Benchmark, Citation & Sources. - template registry (lib/reports/templates.ts) drives everything: the generate dialog's template cards (name, description, section chips, default period = the static preview), which sections createReport gathers, and — since the detail page and PDF render purely by payload field presence — which sections appear in the output - payload metric fields are now all optional; every renderer guards on its field, so legacy reports and slim templates both render cleanly - summary endpoint accepts a template id and flavors the prose (weekly pulse / competitor standing / citation mix) - library table + detail header show the template name; template ids are persisted in reports.template (existing column, no migration)
…hange-story summary US-1.3 — templates are now defaults, not fixed shapes: the generate dialog grows a section checkbox grid (pre-filled by the selected template) and createReport accepts explicit section picks. Shopping is brand-pref-gated twice: hidden in the dialog when the brand's shopping mode is off (like the sidebar's requiresBrandPref) and refused server-side regardless of caller. New modules, each windowed to the report period with a previous-window delta (US-1.4): Topic Performance (per-topic avg visibility + points change), AI Traffic (visits + % change, platform split, top pages), Shopping Visibility (SoV + points change, products surfaced, card rate, top merchant) and Site Audit Score (latest completed as of period end vs the prior audit). Rendered in the detail page and the PDF; all optional payload fields so legacy reports and slim picks render cleanly. US-1.1 — the dialog gains a brand selector (defaults to the active brand). US-1.2 — the AI summary prompt now demands a change story: open with the movement arc (e.g. 42 → 48), name the driver, name the biggest risk, close with the single next focus; baseline wording when no prior data exists. Also: prompts.topic_id and site_audits added to the generated Supabase types (schema had them; the types file lagged).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Report templates grow into a full pick-your-modules flow (US-1.1 → US-1.4):
Templates + section picker (US-1.1, US-1.3)
createReportaccepts explicit picks and only gathers what's selected.requiresBrandPref), and the server refuses to gather it regardless of what a caller sends.Four new modules, all windowed to the report period with previous-window deltas (US-1.4)
All are optional payload fields; the detail page and the PDF render purely by field presence, so legacy reports and slim section picks render cleanly.
Change-story executive summary (US-1.2)
Also
prompts.topic_idandsite_auditsadded to the generated Supabase types (the schema had them; the types file lagged).Related issue
—
Type of change
feat— New featureHow to test
/dashboard/reports(no sidebar entry — soft launch) → Generate Report.cd server && npm test(112 passing) ·cd web && yarn typecheck && yarn lint.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)