Repository navigation
Chore: CI restoration, linting, and code hygiene improvements - #68
Merged
Merged
Conversation
The suite used DATABASE_URL, i.e. whatever the app used — the real Supabase project — and one prefix (LimitDish-) was missing from the cleanup list, so test dishes could be left in the live catalogue. - conftest reads TEST_DATABASE_URL and refuses any Supabase host. - scripts/test-db.ps1 starts pgvector/pgvector:pg16 on :55432, applies a minimal Supabase shim (auth.users, anon/authenticated with Supabase's default grants) and migrates to head. All 18 migrations now build a database from scratch and downgrade/upgrade cleanly. - Fixed tests that relied on the live catalogue or created dishes without the now-required diet_type. Full suite: 396 passed on a fresh database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dish_feedback existed only as a hand-run SQL script while the Plate and Menu pages already used it, so any database built by alembic lacked it and the feedback endpoints failed. Migration 019 creates it idempotently with RLS (read totals when signed in, write only your own vote) and validates meal_type; reading totals now requires sign-in like every other endpoint. The suite used to connect as a superuser, which bypasses RLS, so no policy was ever tested. The test database now has messfit_app/messfit_worker logins and the app side runs as messfit_app, as in production. New isolation tests prove cross-user reads/writes and self-promotion to admin are refused; they fail if RLS is switched off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ruff: stray mid-file imports moved to the top, unused imports removed; per-file ignores only for seed scripts (sys.path setup) and alembic env. - alembic env.py now imports the analytics models, so autogenerate sees every table. - mypy: Sequence for the regression helper, typed validator return, pywebpush has no stubs, CursorResult.rowcount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…actions The React Compiler lint rules flagged state copied into effects, clock reads during render and a ref written during render. Rewritten to the documented patterns: useSyncExternalStore for online status, the analytics opt-out (now also live across tabs) and the current meal slot; state adjusted during render for prop changes; derived state for the OCR review copy and the More sheet; the rest timer's deadline set when it starts. useFlash could leave 'Saved' on screen forever if the flag cleared within 2s; fixed. Two justified exceptions (localStorage restore, click-handler Date.now). New e2e: rest timer countdown/extend/skip/self-close, weight prefill and the Saved confirmation, the mobile More sheet. 95 e2e pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- eslint.config.mjs (Next 16 flat config: core-web-vitals + typescript); ESLint pinned to 9.x because eslint-plugin-react doesn't support 10. pnpm exec eslint . is clean. - Removed deprecated/unused @supabase/auth-helpers-nextjs, tw-animate-css and @types/uuid (uuid ships types); shadcn is a dev tool, not a runtime dependency. Production audit: 81 -> 43 advisories, none critical. - Removed the stray npm package-lock.json (the repo uses pnpm). - Every production build rewrote the committed public/sw.js. The hand-written dev worker is now public/sw-dev.js (registered by next dev); the generated sw.js is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI was removed in June because it ran against infrastructure that didn't exist. It now brings its own: a pgvector Postgres service plus the Supabase shim, and runs as the RLS-restricted app role. API job: ruff, mypy, migrations from scratch and down/up, pytest, the 50-scenario optimizer eval, pip-audit. Web job: tsc, eslint, webpack build, pnpm audit (fails on critical), Playwright. Every step was run locally first, including the API suite with no .env and dummy secrets only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 27250866 | Triggered | Generic Password | a44046e | .github/workflows/ci.yml | View secret |
| 27250866 | Triggered | Generic Password | 0f4ea1c | services/api/scripts/test-db.ps1 | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
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.
Restore CI with a dedicated test database and document local testing. Clean up linting issues and type-check findings across the codebase. Update React components to adhere to best practices and improve overall code hygiene. Ensure migrations and tests are properly aligned with the database schema.