Browse documentation

Plans

RankFlow AI Mock Application — Parallel Execution Plan

Status: Active grounding document

docs/mock-application-execution-plan.md
On this page

Status: Active grounding document
Version: 1.0.0
Last updated: 2026-06-21
Coordinator: Primary Codex agent
Canonical implemented screen: /dashboard

1. Outcome#

Build one deployable Next.js mock application that validates the complete RankFlow customer and operator journey before production API work begins.

The mock must let a stakeholder click through:

  1. Clinic onboarding.
  2. AI-assisted profile generation.
  3. Medical approval or rejection.
  4. Directory profile publication.
  5. Google Business Profile and citation operations.
  6. Monthly visibility reporting.
  7. Admin review and exception handling.

The mock is a product-contract exercise, not a disposable collection of screens. Screen states define fixture requirements; fixture requirements define mock API shapes; the mock API is never allowed to invent fields that no approved screen consumes.

2. Non-Negotiable Source Order#

When two documents disagree, agents must use this precedence order and record the conflict in the task handoff:

  1. The two approved dashboard images:
    • public/images/homepage/homepage-results-dashboard-rise.png
    • public/images/homepage/homepage-citation-dashboard-rise-v2.png
  2. docs/visual-dna.md and docs/brand/tokens/design-tokens.json.
  3. docs/specs/frontend/frontend-spec-01-design-system.md.
  4. The canonical /dashboard implementation created by task RF-UI-001.
  5. Screen specifications under docs/specs/frontend/, docs/specs/user-dashboard-ui.md, and docs/specs/admin-dashboard-ui.md.
  6. Product flow and content documents: docs/homepage-content.md, docs/homepage-build-plan.md, docs/directory-profile-plan.md, and docs/directory-website-architecture.md.
  7. Backend specifications under docs/specs/.
  8. Agent assumptions.

An agent may not replace a higher-precedence decision with a familiar library default.

3. Locked Product Decisions#

Decision Contract
Runtime Existing Next.js App Router application; do not create a second app.
Frontend React, TypeScript, Tailwind foundation, CSS design tokens, Lucide icons.
Mock geography Kerala fixture set from the current product request; geography is data, not hard-coded UI structure.
Initial roles Client/doctor, admin/operator, and public visitor.
Medical control Clinic, hospital, and doctor content requires an approval state before publication.
Data strategy Screen contract first, typed fixtures second, in-memory repository third, API adapters fourth.
Persistence Browser/session memory for the mock; production persistence is explicitly out of scope.
Brand Rise / Quiet Signal only. Legacy gold/navy and generic purple AI styling are forbidden.
Route ownership Public routes, client routes, and admin routes remain separate even when they share primitives.

4. Canonical UI Contract#

The /dashboard visibility screen is the reference implementation for every application surface.

4.1 Visual Rules#

Element Required rule
Canvas Paper White #F6F6F8; no pure white page canvas.
Sidebar Deep Ink #011821, icon-first, quiet borders, Ember Orange active rail.
Cards Card White, 1px Mist border, 8px radius, almost-flat shadow.
Type Geist as the production Suisse equivalent; weight 400/500 only in new dashboard code.
Primary text Deep Ink; secondary text Graphite; metadata Slate.
Positive/live Forest Teal only.
Active/booked/focus Ember Orange only and sparingly.
Chart series Forest Teal, Sky Blue, Lavender, Fog/Slate.
Grid Dense 12-column desktop composition with 4px spacing discipline.
Controls 36–40px height, white surface, Mist border, 8px radius.
Motion 100–200ms state transitions; no scroll hijacking; honor reduced motion.
Icons Lucide, 18–20px, 1.5px stroke, label every icon-only control.

4.2 Component Rules#

  • Reuse DashboardShell, DashboardSidebar, DashboardHeader, DashboardCard, metric-card, status-row, and chart primitives from the canonical screen.
  • New dashboard cards may vary their internal layout but may not introduce a new radius, shadow, font weight, border color, or icon family.
  • Data-dense pages use an overview band, a primary work surface, and an optional right detail rail, matching the citation reference.
  • Empty, loading, error, rejected, pending-approval, published, processing, and needs-action states must be designed explicitly.
  • Mobile collapses the sidebar to a compact header and turns multi-column grids into one reading order; it must not scale down desktop content until illegible.

4.3 Visual Acceptance#

  • Desktop comparison viewport: 1536 × 1024.
  • Tablet QA: 1024 × 768.
  • Mobile QA: 390 × 844.
  • No horizontal overflow at any target viewport.
  • Reference-level layout tolerance: primary columns within 16px, card gaps within 4px, component radii exact, palette exact.
  • A screenshot is required for every completed route before its task is marked done.

5. Architecture and Ownership#

src/
  app/
    dashboard/               client application routes
    admin/                   operator application routes
    clinics/[city]/[slug]/   public directory routes
    onboarding/              customer setup flow
  components/
    dashboard/               canonical shell and dashboard primitives
    admin/                   admin-only compositions
    directory/               public profile/search compositions
    onboarding/              setup and approval compositions
  features/
    approval/                state and transition rules
    citations/               citation operations rules
    directory-profile/       profile lifecycle rules
    search/                  deterministic mock search
  lib/mock/
    fixtures/                JSON-compatible source records
    repositories/            in-memory persistence boundary
    api/                     typed mock API facade
  shared/
    contracts/               types and schemas shared by UI and mock API

Until these folders exist, agents must place work in the closest existing src/app, src/components, or src/lib boundary and avoid unrelated restructuring.

6. Dependency Graph#

flowchart LR
  A[RF-PLAN-001 Grounding plan] --> B[RF-UI-001 Canonical dashboard]
  B --> C1[Client screen contracts]
  B --> C2[Admin screen contracts]
  B --> C3[Public directory contracts]
  B --> C4[Onboarding and approval contracts]
  C1 --> D[Typed fixture contract]
  C2 --> D
  C3 --> D
  C4 --> D
  D --> E[In-memory repositories]
  E --> F[Mock API facade]
  F --> G[Route integration]
  G --> H[End-to-end flows]
  H --> I[Visual, accessibility, and regression QA]

The hard gate is deliberate: no mock API implementation begins before the consuming screen contracts and typed fixture contract are approved.

7. Task Ledger#

Status values: BLOCKED, READY, IN PROGRESS, REVIEW, DONE.

Wave 0 — Grounding and Canonical Screen#

ID Status Task Outputs Depends on
RF-PLAN-001 DONE Create this execution plan. This document with source order, task graph, ownership, and quality gates. None
RF-UI-001 DONE Build the canonical client dashboard screen. /dashboard, reusable dashboard shell, card/chart/status primitives, responsive rules. RF-PLAN-001
RF-UI-002 REVIEW Capture and approve reference screenshots. Desktop and mobile verified; tablet capture and human visual approval remain. RF-UI-001

Wave 1 — Screen Contracts#

These tasks may execute in parallel after RF-UI-002. Each owns only its route/component folders.

ID Status Task Required states and output Primary references
RF-SCREEN-101 BLOCKED Client profile and approval dashboard. Draft, generating, review-ready, approved, rejected, published; /dashboard/profile. directory-profile-plan.md, TEST-onboarding-e2e.md
RF-SCREEN-102 BLOCKED Citation operations screen. 30-directory grid, filters, detail rail, publish timeline, NAP mismatch, needs action; /dashboard/citations. Citation image, citation-network.md
RF-SCREEN-103 BLOCKED Client content and GBP operations. Queue, post detail, approval, scheduled, published, failed; /dashboard/content, /dashboard/gbp. gbp-social-pipeline.md, frontend specs
RF-SCREEN-104 BLOCKED Client reporting and analytics. Date/location filters, monthly report, empty/no-history and partial-data states. Results image, email-reports-pdf.md
RF-SCREEN-105 BLOCKED Onboarding flow. Business details, services, verification, AI generation, review handoff, success. homepage-content.md, onboarding test spec
RF-SCREEN-106 BLOCKED Public search and results. City/specialty query, results, no-results, filters, loading. Directory architecture, directory profile plan
RF-SCREEN-107 BLOCKED Public clinic profile. Bio, services, doctor details, FAQs, reviews, contact/booking, structured-data preview. Directory architecture and Prisma model
RF-SCREEN-108 BLOCKED Admin overview and approval queue. Queue filters, review drawer, approve/reject/request-change, audit trail. admin-dashboard-ui.md, compliance spec
RF-SCREEN-109 BLOCKED Admin directory operations. Profile list, status filters, publish action, retry/failure states, city controls. Admin frontend specs, backend API
RF-SCREEN-110 BLOCKED Landing-page brand audit. Audit existing 14 sections against canonical tokens; fix only documented drift. Homepage content/build plan, canonical dashboard

Wave 2 — Screen-Derived Data Contract and Fixtures#

ID Status Task Outputs Gate
RF-DATA-201 BLOCKED Extract screen data matrix. Field-by-field table mapping each visible UI value/action to a domain field. All Wave 1 route contracts in REVIEW or DONE.
RF-DATA-202 BLOCKED Create shared schemas and lifecycle enums. TypeScript/Zod contracts for clinic, profile, approval, citation, metrics, review, city, specialty. RF-DATA-201
RF-DATA-203 BLOCKED Build 10 Kerala clinic fixtures. Complete profiles with deliberate edge cases and lifecycle coverage. RF-DATA-202
RF-DATA-204 BLOCKED Build reference fixtures. 8 cities, 8 specialties, 30 citations, 3 testimonials. RF-DATA-202
RF-DATA-205 BLOCKED Build time-series and activity fixtures. Rankings, interactions, citations, report periods, timelines, digest events. RF-DATA-202
RF-DATA-206 BLOCKED Validate fixture completeness. Automated schema tests plus a state-coverage report. RF-DATA-203205

Fixture edge cases must include: incomplete NAP, citation processing, citation needs action, rejected medical copy, approval requested, no reviews, low review score, no ranking history, partial analytics, unpublished profile, and multi-location clinic.

Wave 3 — In-Memory Domain and Mock API#

ID Status Task Outputs Gate
RF-API-301 BLOCKED Define repository interfaces. DI-friendly repositories for profiles, approvals, citations, cities, search, and metrics. RF-DATA-206
RF-API-302 BLOCKED Implement in-memory repositories. Deterministic resettable stores seeded by validated fixtures. RF-API-301
RF-API-303 BLOCKED Implement profile lifecycle manager. Create, generate, request approval, approve/reject, publish transitions. RF-API-302
RF-API-304 BLOCKED Implement citation operations manager. List/filter/select, publish, retry, NAP check, activity timeline. RF-API-302
RF-API-305 BLOCKED Implement search manager. City + specialty filtering, pagination, stable relevance ordering. RF-API-302
RF-API-306 BLOCKED Expose typed mock API facade. directoryProfile, approval, citation, city, search, and metrics methods. RF-API-303305
RF-API-307 BLOCKED Add API behavior tests. Success, validation, authorization simulation, invalid transition, not-found, reset. RF-API-306

The mock facade may mirror future tRPC procedure names, but must not introduce a network server solely for the prototype.

Wave 4 — Route Integration and Clickable Flows#

ID Status Task Outputs Gate
RF-FLOW-401 BLOCKED Wire onboarding to generated profile. Form values create a real in-memory profile and route to review. Wave 3 DONE
RF-FLOW-402 BLOCKED Wire medical approval. Approve/reject/request-change updates all consuming screens. RF-FLOW-401
RF-FLOW-403 BLOCKED Wire publish and public directory. Approved profile becomes discoverable and directly routable. RF-FLOW-402
RF-FLOW-404 BLOCKED Wire citation operations. Publish/retry transitions update cards, health totals, detail rail, activity. Wave 3 DONE
RF-FLOW-405 BLOCKED Wire dashboard metrics. Customer flow mutations visibly affect digest, timeline, and summary values. RF-FLOW-403, RF-FLOW-404
RF-FLOW-406 BLOCKED Wire admin moderation. Admin actions propagate to client and public views. RF-FLOW-402

Wave 5 — Quality, Documentation, and Demo Readiness#

ID Status Task Outputs Gate
RF-QA-501 BLOCKED Unit and flow tests. Jest/Vitest-compatible module tests and Playwright end-to-end paths. Wave 4 DONE
RF-QA-502 BLOCKED Accessibility audit. Keyboard, focus, semantics, contrast, reduced motion, screen-reader labels. Wave 4 DONE
RF-QA-503 BLOCKED Responsive visual regression. Approved screenshots for all routes at three target viewports. Wave 4 DONE
RF-QA-504 BLOCKED Performance and asset pass. Image sizing, route bundle review, no avoidable client components. Wave 4 DONE
RF-QA-505 BLOCKED Security and privacy pass. No secrets, no real patient data, safe mock logging, validation coverage. Wave 4 DONE
RF-DOC-506 BLOCKED Final architecture and changelog. Updated architecture, API contract notes, demo reset/use instructions. RF-QA-501505
RF-DEMO-507 BLOCKED Stakeholder demo script. 8–12 minute click path with reset instructions and known limitations. RF-DOC-506

8. Parallel-Agent Operating Rules#

  1. The coordinator assigns one task ID and explicit file ownership per agent.
  2. An agent reads this plan, the task's listed references, and the canonical dashboard before editing.
  3. No two agents edit the same file in the same wave.
  4. Shared contracts are coordinator-owned until RF-DATA-202 is approved.
  5. Agents return changed files, verification commands, screenshots, assumptions, and unresolved conflicts.
  6. The coordinator performs integration and marks status; agents do not self-declare global completion.
  7. At most three implementation agents run beside the coordinator so review keeps pace with output.
  8. A blocked agent returns the nearest valid artifact instead of creating speculative API or data structures.

Required Agent Handoff#

TASK: <task ID and title>
FILES OWNED: <exclusive paths>
READ FIRST: <source documents>
INPUT CONTRACT: <types/components/assets already approved>
OUTPUT CONTRACT: <routes/components/tests/screenshots required>
DO NOT CHANGE: <shared files and higher-precedence decisions>
ACCEPTANCE: <task-specific checks>
VERIFY: <exact commands>

9. Definition of Done Per Screen#

  • Route renders without console errors.
  • Uses the canonical shell and tokens.
  • All specified lifecycle states exist and can be reached.
  • UI values come through one typed ViewModel boundary, not scattered literals.
  • All buttons and controls have a visible or intentionally mocked outcome.
  • Loading, empty, error, permission, and success states are covered where applicable.
  • Keyboard navigation and visible focus work.
  • Desktop, tablet, and mobile screenshots are attached.
  • Typecheck and build pass.
  • Architecture/changelog are updated if the route introduces a new boundary.

10. Verification Commands#

codegraph sync
npm run typecheck
npm run build
npm audit --audit-level=moderate

Add the project test runner and browser test commands as soon as RF-QA-501 introduces them.

11. Current Next Action#

Finish RF-UI-002: review the tablet breakpoint and provide human visual approval for /dashboard. Then change all Wave 1 screen tasks from BLOCKED to READY and launch agents with exclusive file ownership.