Skip to content

Add validation, deterministic AI generation, Supabase reconciliation, E2E harness, and observability - #17

Merged
Armand9999 merged 2 commits into
mainfrom
codex/familiarize-with-codebase-ytre8v
Jun 22, 2026
Merged

Add validation, deterministic AI generation, Supabase reconciliation, E2E harness, and observability#17
Armand9999 merged 2 commits into
mainfrom
codex/familiarize-with-codebase-ytre8v

Conversation

@Armand9999

Copy link
Copy Markdown
Owner

Motivation

  • Harden runtime and CI quality for generated workout/meal features by adding validation, deterministic E2E fixtures, and safer OpenAI usage.
  • Bring database schema into a reproducible migration and generated TypeScript contract to preserve existing production state and enforce Row Level Security.
  • Improve operability with structured logging, health/readiness endpoints, typed Supabase helpers, and a Playwright-based E2E harness wired into CI.

Description

  • Add strong input and domain validation and utilities: app/lib/date.ts, app/lib/profile.ts, app/lib/auth.ts, app/lib/generated-plans.ts, app/lib/definitions.ts, app/lib/profile-options.ts, and associated schema/type updates.
  • Refactor generation and persistence to be non-destructive, validated, and testable with deterministic AI fixtures: app/lib/workout-generator.ts, app/protected/profile/meal-plan/action.ts, app/lib/e2e-ai-fixtures.ts, and app/lib/generated-plans.ts; use upsert/rpc and validate OpenAI responses before storing.
  • Add observability and safety: structured redacting logger app/lib/logger.ts, GET /api/health and GET /api/readiness endpoints, improved error logging across layout/middleware/handlers, and safer auth callback handling with getSafeRedirectPath.
  • Supply Supabase productionization artifacts and types: supabase/migrations/20260611170000_reconcile_fitness_schema.sql, supabase/preflight/..., app/lib/database.types.ts, supabase/config.toml, plus typed Supabase client/middleware/server helpers and cookie handling improvements in utils/supabase/*.ts.
  • Add UX pages and flows for password recovery/reset and profile setup, plus small UI and accessibility fixes (NavBar image -> next/image, WorkoutTemplates date plumbing, WeeklyProgress date range keys).
  • Add CI, local tooling, and E2E harness: scripts/check-env.mjs, playwright.config.ts, Playwright tests in e2e/, package.json scripts, .github/workflows/quality.yml, and test runner/TypeScript configs..env.example and .gitignore updated to document env usage and ignore artifacts.

Testing

  • Added a comprehensive unit/test-suite under tests/*.test.ts and ran npm test locally; unit tests passed.
  • Ran static checks locally with npm run lint and npm run typecheck, and a production build with npm run build; these succeeded.
  • Configured Playwright E2E coverage with deterministic mocked-AI flows and an authenticated setup; CI workflow (.github/workflows/quality.yml) runs npm run env:check, npm run check, npm run build, and npm run test:e2e and uploads Playwright artifacts on failure.

Codex Task

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fitness-app Ready Ready Preview, Comment Jun 22, 2026 11:00pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b8caaa616

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +73 to +76
return (
<div className="max-w-xl mx-auto p-6 bg-red-50 dark:bg-red-900/20 rounded-lg">
<p className="text-red-600 dark:text-red-400">The saved meal plan is invalid. Generate a new plan to continue.</p>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep regeneration available for invalid meal plans

When an existing meal plan fails the new strict parser, this early return removes the New Plan button even though the message tells the user to generate one. Because getMeal() returns existing records without regenerating, any user with a malformed or legacy saved meals value is stuck on this error screen until the database row is manually changed; keep the regenerate action visible here or trigger regeneration for invalid saved plans.

Useful? React with 👍 / 👎.

@Armand9999
Armand9999 merged commit fbc511d into main Jun 22, 2026
2 of 3 checks passed
@Armand9999
Armand9999 deleted the codex/familiarize-with-codebase-ytre8v branch June 22, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant