Engineering Audits & Changelog - Jashan-randhawa/AI-FitnessTracker1 GitHub Wiki
๐ Engineering Audits, RFCs & Changelog
This page documents the foundational engineering assessments, root-cause analyses (RCAs), security audits, and version release changelogs conducted on the FitTrack AI platform.
๐งญ Navigation
- 1. Release Changelog (v1.0.0 โ v2.1.0)
- 2. Report 1: CI Failure Root Cause Analysis & Verified Fix
- 3. Report 2: Maintenance Plan Verification & Security Audit
- 4. Report 3: FitBot AI Assistant Review, Logging & Maintenance Plan
- 5. Report 4: Package Release Assessment & Modular Monorepo Plan
1. Release Changelog
Version 2.4.1 (2026-10-02) โ OAuth Callback Resilience, Mobile Chat Navigation & Profile Verification UI
- ๐ก๏ธ Google OAuth Callback Single-Execution Guard: Frontend
GoogleCallbackutilizes a single-executionuseReflifecycle guard to eliminate duplicate OAuth code exchange triggers, timing-safe fragment scrubbing before React state changes, explicit URL parameter error code mapping (access_denied,google_state_invalid,oauth_failed), and an interactive fallback retry screen. - ๐ฑ Persistent Mobile Bottom Navigation & 100dvh Viewport: Bottom navigation bar remains anchored during FitBot AI Coach usage with smooth flex layout, dynamic
100dvhcontainer height, safe-area inset protection, and blank prompt input placeholder. - โ๏ธ Mobile Email Verification Layout & Symmetrical Sign-In Methods: Responsive mobile cards for authentication methods and email verification status chips (
Verified/Pending Verification), 60s cooldown debouncing with live countdown timer, and unverified account alert banner. - ๐งช 139 Unit & Integration Tests Passing: 139/139 unit tests passing across 37 test suites with zero failures.
Version 2.4.0 (2026-10-01) โ Email Delivery Resilience (F1โF5) & Profile Customization
- ๐ก๏ธ 5-Layer Password Reset Resilience (F1โF5):
- F1 (Double-Click Interceptor): Synchronous
useRefguard blocks rapid double-clicks on submit/resend before React state re-renders. - F2 (60s Token Debounce): Suppresses duplicate reset token generation and Brevo email dispatches if an active token was issued within 60 seconds, preserving the active link and avoiding inbox clutter.
- F3 (Retry Hardening): Halts retry loops immediately on request timeouts to eliminate duplicate email dispatches after remote acceptance.
- F4 (Distributed Rate Limiting): Atomic Redis rate limiting with automatic in-memory fallback.
- F5 (Request Tracing): End-to-end
requestIdpropagation across controllers, background dispatch, and security audit logs.
- F1 (Double-Click Interceptor): Synchronous
- ๐ค Profile Username Customization: Live username editing in Profile with length validation (3โ30 characters), case-insensitive MongoDB collision checks returning
409 Conflict, and zero-reload state synchronization. - ๐งช 134 Unit & Integration Tests Passing: 134/134 tests passing across 35 test suites with zero failures.
Version 2.3.0 (2026-10-01) โ Unified Dual Sign-In Architecture (Google OAuth + Password)
- One Account, Two Sign-In Methods: Enables linking Google OAuth and standard password credentials to a single shared MongoDB record.
- 6-Case Account Linking Matrix: Automated safe linking, mismatch rejection, and unverified account reclaiming.
- Session Safety & Instant Revocation: Real-time token revocation on password change/reset via
passwordChangedAtverification, plus 15-minute step-up authentication. - Unified Password Policy & History Prevention: Rolling 5-password history protection blocking password reuse.
- Signup Email Verification Flow: Built-in 24-hour verification tokens with dedicated confirmation screens.
Version 2.1.0 (2026-09-28) โ Modular Packages & Resilient AI Architecture
- ๐ฆ Modular Packages Ecosystem: Published 7 decoupled, production-grade npm packages to GitHub Packages under
@jashan-randhawa/*:@jashan-randhawa/openrouter-resilient-client@jashan-randhawa/express-ai-guard@jashan-randhawa/react-calendar-heatmap-streaks@jashan-randhawa/react-workout-tracker@jashan-randhawa/react-motion-presets@jashan-randhawa/fitness-utils@jashan-randhawa/ai-nutrition-estimator
- ๐ง FitBot Voice & UX Upgrades: Integrated Speech-to-Text (STT) voice input and Web Speech API Text-to-Speech (TTS) read-aloud playback, instant
AbortControllergeneration stopping, native Markdown tables, collapsible plan cards, and audio completion chimes. - ๐ก๏ธ Backend Reliability:
OPENROUTER_FALLBACK_MODELfailover to Gemini 2.0 Flash, dual-tier rate limiting (30 req/min IP + 20 req/min user-keyed), production error masking (MongoServerError),X-Request-IdUUID correlation tracing, and automated secret scrubbing. - ๐งช 91 Passing Unit Tests: 35 server tests (
node --test) + 56 package tests (Vitest).
Version 2.0.1 (2026-09-27) โ Critical Security & Dependency Audit
- Critical CVE Patch: Bumped
jspdfto^4.2.1in client, pulling patched[email protected]and resolving confirmed critical XSS advisory in the dependency tree. - Multer Upgrade: Bumped
multerfrom1.4.xto2.4.0resolving disclosed denial-of-service (DoS) advisories. - Rate Limiting Hardening: Installed
[email protected]across auth routes (5 req/15m), password reset (3 req/15m), AI endpoints (30 req/m), and YouTube search proxy (30 req/m). - OAuth Token Security: Replaced query-string token transfer with secure URL fragment (
#access_token=) and POST body exchange. - Anti-Enumeration Password Recovery: Unified responses across non-existent accounts, third-party OAuth providers, and upstream email errors.
Version 2.0.0 (2026-09-12) โ Mobile Redesign & Architecture Upgrade
- Fixed bottom navigation bar with active micro-animations.
- Safe-area notch padding (
viewport-fit=coverand dynamic.safe-area-pbclasses). - Full-height
100dvhmobile chat viewports. - Frontend upgrades: React 19.2, TypeScript 5.9, Vite 7, and Tailwind CSS v4.
2. Report 1: CI Failure Root Cause Analysis & Verified Fix
Problem
GitHub Actions CI failed at the Run unit tests step on node --test test/**/*.test.js.
Confirmed Root Cause
- Runner Shell: GitHub Actions executes
/usr/bin/bashwithout the non-defaultglobstaroption enabled. Because test files reside directly inserver/test/, bash treated**as a single*matching only subfolders. - Node 20 Runtime: Native CLI glob parsing in
node --testarguments was only introduced in Node.js 21.0.0 (#47653). Since CI pinned Node.js 20 LTS, Node treated the unmatched glob string as a literal missing file path.
Resolution
Updated the test script in server/package.json to a single-level wildcard expanded universally by POSIX shells:
"test": "node --test test/*.test.js"
Result: 17/17 tests passing cleanly across all Node LTS releases.
3. Report 2: Maintenance Plan Verification & Security Audit
All 18 maintenance and security items were verified via independent byte-for-byte local reproductions:
- Zero-Vulnerability Baseline:
npm auditacross client and server confirms 0 known vulnerabilities. - OAuth Token Leak Protection: Fragment-based OAuth
#access_token=prevents tokens leaking into browser history and HTTP Referer headers. - Rate Limiting Protection:
express-rate-limitprevents brute force on auth and credit exhaustion on OpenRouter endpoints. - Production Error Masking:
MongoServerErrorand Mongoose internals masked with generic client messages whenNODE_ENV === 'production'.
4. Report 3: FitBot AI Assistant Review, Logging & Maintenance Plan
- Transient Error Retries: 1โ2 retries with randomized exponential backoff on 429/5xx and network timeouts.
- Automatic Model Failover: Automatic fallback to Gemini 2.0 Flash (
OPENROUTER_FALLBACK_MODEL) on primary model hiccups. - Structured JSON Logging: Standardized JSON logs with automated secret scrubbing (passwords, tokens, API keys).
- Request Tracing: Persistent
X-Request-Idheaders assigned to every incoming request. - Sliding-Window History Truncation: Enforced 50-message cap, 8,000-char single-message limit, and graceful truncation above 40,000 chars.
5. Report 4: Package Release Assessment & Modular Monorepo Plan
7 decoupled packages were evaluated across Cohesion, Coupling, Reusability, Testability, and Uniqueness, and extracted to GitHub Packages:
- Generic contribution heatmap with 4-level color scales and timezone-safe streak calculations.
- Headless workout session hook managing volume math, sets, and rest timers.
- Resilient OpenRouter client with automated model failover and JSON parsing.
- Accessible Framer Motion presets with OS-level reduced motion support.
- Multi-entrypoint fitness math, speech/audio hooks, and multi-page PDF reporting.