diff --git a/docs/superpowers/plans/2026-04-23-p6-seo-errors-cache-flightmap.md b/docs/superpowers/plans/2026-04-23-p6-seo-errors-cache-flightmap.md new file mode 100644 index 00000000..0aedb57f --- /dev/null +++ b/docs/superpowers/plans/2026-04-23-p6-seo-errors-cache-flightmap.md @@ -0,0 +1,162 @@ +# P6 — SEO + Errors + Cache + Карта полетов Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use `superpowers:subagent-driven-development` (recommended) or `superpowers:executing-plans`. + +**Goal:** Bring §4.1.18 (caching), §4.1.19 (microdata — JSON-LD + OpenGraph), §4.1.20 (robots.txt + canonicals), §4.1.21 (404/500 error pages), §4.1.24 (Карта полетов / Flight Map) of TZ РИ-07-2538С into compliance. This is the **final** P-plan. + +**Architecture:** SEO + error infrastructure exists from phase-1 (`src/ui/seo/SeoHead.tsx`, `src/shared/seo/*`, `src/routes/error/[code]/*`). Flight Map exists from phase-1 with initial P1/P2 adjustments. P6 is primarily an audit pass + gap-fill. + +**Tech Stack:** TypeScript, React 18, schema-dts for JSON-LD typing, Modern.js SSR. + +**Parent spec:** `docs/superpowers/specs/2026-04-21-online-board-schedule-tz-redesign-design.md`. + +**Target rule count:** §4.1.18 ≥3, §4.1.19 ≥15, §4.1.20 ≥5, §4.1.21 ≥8, §4.1.24 ≥40. + +--- + +## File Structure + +### Files to create +- `src/shared/seo/jsonLdBuilders.ts` + test — pure JSON-LD builders for each page type (start, search results, flight details). +- `src/routes/robots.txt/page.tsx` (or server route handler for `/robots.txt`) — emit the TZ-prescribed robots rules. +- Any missing Flight Map helpers or tests. + +### Files to modify +- `src/features/online-board/seo.ts` — wire JSON-LD builders into each SEO result. +- `src/features/schedule/seo.ts` — same. +- `src/features/flights-map/seo.ts` — same. +- `src/ui/seo/SeoHead.tsx` — verify all required meta tags emitted. +- `src/routes/error/[code]/*` — verify 404 + 500 page content and SEO. +- `src/features/flights-map/*` — audit per §4.1.24 rule rows. +- spec + +--- + +## Task 1: Populate §4.1.18/19/20/21/24 rules + +TZ line ranges (approximate): +- §4.1.18: ~2908-2910 +- §4.1.19: ~2911-2930 +- §4.1.20: ~2931-2960 +- §4.1.21: ~2961-2984 +- §4.1.24: ~3050-3300 (end of document) + +Use `sed -n '2908,3300p' /tmp/ri_tz_extract/content.txt` to dump. + +Append rule rows. Status=TBD, Plan=P6. + +Target counts: §4.1.18 ≥3, §4.1.19 ≥15, §4.1.20 ≥5, §4.1.21 ≥8, §4.1.24 ≥40. + +Commit: `Populate rule rows for P6 subsections 4.1.18/19/20/21/24 in TZ audit spec`. + +--- + +## Task 2: Resolve C5 (TZ 4.1.1-R22 typo) + +Per P1 Conflicts register entry C5: TZ §4.1.1 ¶9 has `"ДД.ММ.ГГГ"` (3 Г) vs the standard `"ДД.ММ.ГГГГ"` (4 Г). Resolution noted as "treat as typo correction". + +Verify the Flight-Map filter's `Дата рейса` placeholder uses 4 Г. If already correct, close the conflict as Resolved in the spec. + +Commit: `Close C5 TZ 4.1.1-R22 typo conflict (Flight-Map date placeholder uses ДД.ММ.ГГГГ)`. + +--- + +## Task 3: Caching (§4.1.18) + +Per TZ §4.1.18: +- Session-scope cache for search results (already implemented via cross-section store, P1). +- Dictionary cache TTL. +- SSR cache headers. + +Audit existing cache logic. Commit. + +--- + +## Task 4: JSON-LD microdata (§4.1.19) + +For each page type, emit JSON-LD via `schema-dts` types: +- Start pages → `WebSite` + `SearchAction`. +- Results list → `ItemList` with `Flight` items. +- Flight details → `Flight` (scheduled / actual times, carrier, aircraft, route). +- Flight Map → `WebPage` + optional `Dataset` for map. + +Create `src/shared/seo/jsonLdBuilders.ts` with per-type builders + tests. Wire into each section's `seo.ts`. + +Commit per cluster. + +--- + +## Task 5: OpenGraph (§4.1.19) + +Verify `og:*` meta tags per page: +- `og:title`, `og:description`, `og:url`, `og:image`, `og:type`, `og:locale`, `og:site_name`. +- Already in place via `SeoHead` — audit per-page for correctness. + +Commit assertion tests. + +--- + +## Task 6: Robots + canonicals (§4.1.20) + +Per TZ: +- Start pages emit `robots: index,follow`. +- Result pages + details emit `robots: index,follow` (or `noindex` for volatile URLs — check TZ). +- Canonical links on every page (normalized URL, no volatile query params). +- hreflang alternates for all 9 languages. +- Actual `/robots.txt` at host site (may be out of scope for this repo — check CLAUDE.md). + +Verify + commit. + +--- + +## Task 7: 404 + 500 error pages (§4.1.21) + +Per TZ: +- Unknown route → `/error/404` +- Server error → `/error/500` +- 404 page includes: link back to section root, top-level breadcrumb, localized message, illustration. +- 500 page includes: refresh CTA, support contact, localized message. +- Both pages: `noindex`; translated for all 9 languages. + +Verify + commit. + +--- + +## Task 8: Flight Map — §4.1.24 full audit + +Per TZ §4.1.24 (all sub-subsections): +- §4.1.24.1 Start page composition +- §4.1.24.2 Filter attributes (6 parameters) +- §4.1.24.3 Map search + rendering (spider, connecting, dots) +- §4.1.24.4 Interactive map (click, hover, zoom, pan, highlight) +- §4.1.24.5 Internal API +- §4.1.24.6 "Buy ticket" CTA + +Largest P6 task. Iterate per sub-subsection. + +Commits per cluster. + +--- + +## Task 9: Update spec + merge gate + +- [ ] Mark P6 rules Done. +- [ ] Update Conflicts register (close C5). +- [ ] Append merge log. +- [ ] Commit. + +--- + +## Self-Review + +**1. Spec coverage.** §4.1.18–21 + §4.1.24 decomposed into Tasks 3–8. + +**2. Placeholder scan.** Task 2 is a clean-up. Tasks 4–8 are standard audit pattern. + +**3. Type consistency.** `jsonLdBuilders` types align with existing `schema-dts` usage in the project. + +--- + +## Execution Handoff + +Final plan. Execute via subagent-driven development.