feat(report): align SPA with HTML, add "What's Changed" trend section#427
Merged
feat(report): align SPA with HTML, add "What's Changed" trend section#427
Conversation
Merges two threads of report work: - SPA mirrors the downloaded HTML report. Both surfaces consume the same ProjectReportDto and now share copy, layout, and structure: subtitles rewritten to HTML's terse versions, titles in Title Case, Executive Summary gains the headline + 3-card hero, Action Plan uses ranked collapsible cards with "Win condition" labels, channel/category breakdowns swap card grids for stacked share bars, Indexing Health trims to 3 metrics + coverage bar, Recommended Next Steps flattens to a linear list, Agency Diagnostics filters out "Location caveat", Content Opportunities adds top-3 highlight cards, GSC top-queries reorders columns (Query, Clicks, Imp., CTR, Pos., Category), GA4 drops the 12-row landing-page slice, opportunity score renders as 87/100. Dedup helpers (dedupeReportActions, dedupeReportOpportunities) extracted from report-renderer.ts to a new packages/contracts/src/ report-dedup.ts so both surfaces collapse intent duplicates the same way. - New trend-focused "What's Changed" section (act 2) added at Section 2 in both client and agency modes. Computed at the API layer in buildWhatsChanged from existing DTO data — no new DB queries. Surfaces five delta tiles (citation/mention rate, cited queries, GSC clicks, AI referral sessions), provider movements, wins, and regressions. 14-day half-window for traffic deltas; baseline gating reuses isTrendBaseline so N=2 doesn't read as a crisis. Section eyebrows renumbered Section 2-14 -> 3-15 across both surfaces. Three new tests in report.test.ts cover baseline, run-over-run math, and wins/regressions filtering. Bumps to 4.10.0.
Replace canonry-flavored vocabulary with marketing-natural terms across
both report surfaces, since the report is shared externally with users
who don't speak canonry's internal language:
- "(visibility) sweep" → "check" in subtitles, empty states, action copy
- "runs collected" → "checks completed"
- "Establishing baseline" → "Building baseline"
- "Trend deltas" → "Trends"
- "Δ" column → "Change"
- "Provider movements" → "AI engine movements"
- "Per-provider rates" → "Per-engine rates"
- "Run-by-run breakdown" → "Check-by-check breakdown"
- "Run" column header → "Check"
Touches HTML renderer, SPA, server-built copy in report.ts (executive
findings, action plan items, client summary), and test fixtures /
assertions. Internal code comments and CLI command names ("canonry run")
left as-is.
Bumps to 4.10.1.
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
87/100. Dedup helpers (dedupeReportActions,dedupeReportOpportunities) extracted topackages/contracts/src/report-dedup.tsso both surfaces collapse intent duplicates the same way.buildWhatsChangedfrom existing DTO data — no new DB queries. Surfaces five delta tiles (citation/mention rate, cited queries, GSC clicks, AI referral sessions over a 14-day half-window), per-provider movements, wins, and regressions. ReusesisTrendBaselinefor the empty/baseline state.Test plan
pnpm run typecheckclean across the workspacepnpm run test— 2079 tests pass (3 new inreport.test.tscovering baseline, run-over-run math, wins/regressions filtering)pnpm run lintcleanreport.htmlfor the same audience