Skip to content

Commit 7e98bab

Browse files
fix: 15 code quality issues — generics, types, locale, dead code, naming (#118)
## Summary Resolves 15 code-quality issues across 10 files (24 original commits) + 5 follow-up fixes for CI/CI-blocking issues identified by review tools (CodeRabbit, cubic) and CI logs. ### Original PR (commits 1-24) - 8 atomic type-safety fixes: ActionResult discriminated union, generic dummyDb methods, type-narrow Genkit output via safeParse, i18n locale mapping, generic handleActionError - 2 utility additions: `getErrorMessage` (safe error extraction), `getZodError` (Zod detection) - 3 magic-number extractions: `STREAK_MULTIPLIER`, `BONUS_THRESHOLD`, `BASE_XP_PER_WORKOUT`, `XP_PER_COMPLETED_SERIE`, `MS_PER_DAY`, `DAYS_PER_MONTH` - 4 cleanup commits: `as` cast removal in alunoService, logger.toRecord safe helper, dead placeholder-images files, misleading constant renames - tsconfig: `noUnusedLocals` + `noUnusedParameters` enabled ### Follow-up fixes (this squash) | Commit | Issue | Root cause | |---|---|---| | fix(actions): add ActionResult<T> | 8 TS2339 (3 client + 5 test) | async-inferred return widened `success: true` literal to `boolean`, broke `if (result.success)` narrowing | | fix(deps): remove typosquatted 'supabase' | CI Security audit critical | GHSA-x96m-c5fj-q75c flagged unscoped `supabase@^2.92.1` as malware; unused, all Supabase usage is scoped `@supabase/supabase-js` | | fix(actions): drop broken HistoricoTreinoSchema.parse() | cubic P1 bug I introduced | Zod schema required `exercicios[]` field not present on Prisma model — parse threw on every successful treino finalization | | fix(actions): dummyDb `as T` cleanup | CodeRabbit MINOR | Redundant `T | null` in `findById<T>` return cast | | fix(e2e): wrap seed-e2e top-level await in main() | E2E Tests fail | PR commit 9edd2f9 (SonarQube fixes) refactored seed from `.catch().finally()` to `try { await seed() }` — top-level await incompatible with tsx CJS output | ### Verification - typecheck: 0 errors - lint: 0 errors, 9 pre-existing warnings (setState-in-effect, unrelated) - test: 86/86 (13 suites) - format: clean - npm audit --audit-level=high: exit 0 - CI: 13/13 checks pass (Quality Gates, Tests & Coverage, SonarCloud, Vercel, E2E, CodeQL, Semgrep ×2, GitGuardian, CodeRabbit, cubic, Analyze JS-TS, Vercel Preview)
1 parent 9edd2f9 commit 7e98bab

41 files changed

Lines changed: 2035 additions & 353 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.sisyphus/boulder.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"active_plan": "/home/emiyakiritsugu/Projetos_Antigravity/PWeb_Project/.sisyphus/plans/pr118-correction-optimization.md",
3+
"started_at": "2026-06-04T01:25:46.597Z",
4+
"session_ids": [
5+
"ses_1776758b8ffe0IKUMawLYpvPQw",
6+
"ses_16fc27358ffeNfun8Qdh7fDluf",
7+
"ses_16fc259c1ffeUtNcUJmLcWbkvA",
8+
"ses_16fc23e3dffeJ6WOz1M0iDykXL",
9+
"ses_16fc225bcffe8abQwLq23BbDq2",
10+
"ses_16fa87119ffe70sEei10acP95M",
11+
"ses_16fa2e3f1ffe8viXu177SRNzjC",
12+
"ses_16fa213a6ffeMyoy60MLCpUBRz",
13+
"ses_16fa173bfffeerYy4m153uWUfJ",
14+
"ses_16fa10d14ffe4dXS00EPOklz5M",
15+
"ses_16fa09c45ffe6T4ncs74X2Hm0y",
16+
"ses_16fa008ebffeHZQKKVydt0uUhc",
17+
"ses_16f9f8481ffenZzCAX6sheyvdu"
18+
],
19+
"plan_name": "pr118-correction-optimization",
20+
"agent": "atlas",
21+
"task_sessions": {}
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
> vitest run
2+
RUN v4.1.6 /home/emiyakiritsugu/Projetos_Antigravity/PWeb_Project
3+
Test Files 10 passed (10)
4+
Tests 71 passed (71)
5+
Start at 22:26:33
6+
Duration 1.27s (transform 812ms, setup 698ms, import 1.40s, tests 212ms, environment 7.15s)
7+
(node:165263) [DEP0205] DeprecationWarning: `module.register()` is deprecated. Use `module.registerHooks()` instead.
8+
(Use `node --trace-deprecation ...` to show where the warning was created)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/lib/data.ts:124: const STREAK_MULTIPLIER = 0.7;
2+
src/lib/data.ts:125: const BONUS_THRESHOLD = 0.05;
3+
src/lib/data.ts:129: alunos: Math.floor(totalAlunos * (STREAK_MULTIPLIER + idx * BONUS_THRESHOLD)),

.sisyphus/evidence/wave0-imports.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)