Final polish: security, accessibility, tests, code quality#5
Merged
Conversation
A four-part pass across the movable score dimensions, each verified. Security - In-memory per-client rate limiter (src/lib/rate-limit.ts) on all 7 AI/ mutating routes -> 429 + Retry-After; guards Gemini quota + shared demo. - SECURITY.md documenting the posture (headers, validation, rate limits, constrained AI actions, secret handling, injection-sink review). Accessibility (verified 0 violations) - Playwright + axe-core audit of the 3 pages plus interactive states (copilot, emergency dialog); `npm run audit:a11y`. - Fixed the 3 real violations it found: Tag + critical-red text contrast (added CRITICAL_TEXT token for text-on-dark), and a keyboard-focusable scroll region for the live feed. Testing (coverage 43% -> ~77%) - API route validation + rate-limit tests, SimulationEngine determinism tests, rate-limiter unit tests. 69 -> 85 tests. - Coverage floor enforced in vitest config (lines/statements 70%). Code quality - Typed the Google Maps integration via a minimal local ambient surface (src/types/google-maps.d.ts) — removes the last `any` cluster. - Decomposed dashboard.tsx: extracted EventLine/IncidentCard/DocOverlay into dashboard-parts.tsx (~200 lines out of the god component). - Prettier added (config + format/format:check scripts) and applied repo-wide; ESLint node-globals for scripts. CI now runs format:check + lint + typecheck + tests (with coverage floor) + build. Verified: format/lint/typecheck clean, 85 tests, 0 axe violations, production build succeeds.
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.
The pre-final-submission push across all four movable score dimensions. Everything verified.
Security
src/lib/rate-limit.ts) on all 7 AI/mutating routes →429+Retry-After(guards Gemini quota + shared-demo disruption).SECURITY.mddocumenting the full posture.Accessibility — verified 0 violations
npm run audit:a11y) of all 3 pages plus interactive states (copilot open, emergency dialog).Tag+ critical-red-text contrast (newCRITICAL_TEXTtoken for text-on-dark), and a keyboard-focusable scroll region for the live feed.Testing — coverage 43% → ~77%
SimulationEnginedeterminism tests. 69 → 85 tests.Code quality
src/types/google-maps.d.ts) — removes the lastanycluster.dashboard.tsx— extractedEventLine/IncidentCard/DocOverlayintodashboard-parts.tsx(~200 lines out of the god component).CI
Now runs
format:check+lint+typecheck+test(with coverage floor) +build.Verified: format/lint/typecheck clean · 85 tests pass · 0 axe violations · production build succeeds. No runtime behavior change beyond rate limits + the contrast tweaks.