Skip to content

Final polish: security, accessibility, tests, code quality#5

Merged
Sarthak195 merged 1 commit into
mainfrom
final-polish
Jul 15, 2026
Merged

Final polish: security, accessibility, tests, code quality#5
Sarthak195 merged 1 commit into
mainfrom
final-polish

Conversation

@Sarthak195

Copy link
Copy Markdown
Owner

The pre-final-submission push across all four movable score dimensions. Everything verified.

Security

  • Rate limiting (src/lib/rate-limit.ts) on all 7 AI/mutating routes → 429 + Retry-After (guards Gemini quota + shared-demo disruption).
  • SECURITY.md documenting the full posture.

Accessibility — verified 0 violations

  • Playwright + axe-core audit (npm run audit:a11y) of all 3 pages plus interactive states (copilot open, emergency dialog).
  • Fixed the 3 real issues it surfaced: Tag + critical-red-text contrast (new CRITICAL_TEXT token for text-on-dark), and a keyboard-focusable scroll region for the live feed.

Testing — coverage 43% → ~77%

  • Route-validation tests, rate-limit tests, SimulationEngine determinism tests. 69 → 85 tests.
  • Coverage floor enforced in CI (70% lines/statements).

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 + applied repo-wide; ESLint node-globals for scripts.

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.

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.
@Sarthak195
Sarthak195 merged commit 2c4975f into main Jul 15, 2026
1 check passed
@Sarthak195
Sarthak195 deleted the final-polish branch July 15, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant