Skip to content

Arena/c9a0e954 schoolerp - #2

Merged
sahajiscoding merged 25 commits into
mainfrom
arena/c9a0e954-schoolerp
Nov 4, 2026
Merged

sahajiscoding merged 25 commits into
mainfrom
arena/c9a0e954-schoolerp

Conversation

@sahajiscoding

@sahajiscoding sahajiscoding commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

CodeAnt-AI Description

Complete role-based school dashboard workflows

What Changed

  • Admins can add students or import a roster from CSV, review invalid rows before importing, and download student credentials.
  • Students can apply for leave and track decisions; class teachers can review requests for their own sections and view decision history.
  • Staff can publish declaration forms, messages, polls, events, and assignments; students can sign forms, vote, and submit work for review.
  • Fee pages show billed, paid, outstanding, and discounted amounts. Staff can record payments and link or remove siblings, with the discount applied to the second child.
  • Role-specific dashboards bring together relevant school updates, including attendance, report cards, assignments, fees, and calendar events. Admin pages are restricted to administrators.

Impact

✅ Student imports flag errors before accounts are created
✅ Leave requests reach the student's class teacher
✅ Fee balances reflect payments and sibling discounts

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Arena Agent and others added 25 commits November 4, 2026 16:26
- Bring the pushed dashboard work onto the branch and clear all 25 typecheck errors
- Mount AppDataProvider (was never wired) and gate admin routes by role
- Role-aware shell: student menu hides administration, labels adapt per role
- Approvals: class-teacher leave routing, history, validated apply form
- Communications: working declaration composer, message broadcast, polls
- Assignments: teacher name, attachments, submit flow, submissions review
- Report card: printable document with real student details, withdraw action
- People: CSV import with header aliases, validation, template + credentials export
- Events: month calendar, admin-only school events, teacher class-only events
- Classes/Enrollments/Audit/Subjects: move off direct Supabase calls to demo store
- utils: reject impossible dates (31 Feb), add inr/relativeToToday/formatRange

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- 0002 migration: leave routing, goals, declarations, polls, events, library,
  report cards, attendance, fees + sibling links, all with RLS
- pgTAP suite for the new tables (22 assertions)
- admin-users Edge Function: create-admin + import-students (Student@DDMMYYYY)
- scripts/create-admin.mjs bootstrap (service role stays local)
- CI workflow rewritten (previous file had literal \n and never ran)
- env docs list the exact Vercel names: SUPABASE_URL / SUPABASE_PUBLISHABLE_KEY
- CSV import hardened: header aliases, per-row errors, no crash on bad dates
- Fees: sibling discount applied to second child only, with real totals
- Library/StudyRoom/Subjects/Classes/Enrollments/Audit moved onto demo store

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- 0001: current_role() renamed app_role() — current_role is a reserved SQL
  keyword, so the original CREATE FUNCTION could never have applied
- 0002: declaration_forms SELECT was 'is_admin() OR true' (unconditional);
  now scoped to the student audience or the author
- pgTAP: 24 assertions including the self-approval and forged-signature guards
- PROJECT_STATUS and design decision log updated to match reality
- both migrations + test file verified to parse (pglast)

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Demo sign-in invented ids ('demo-0185/18') while every seed record uses
'p-student-1', so My Fee, My Attendance, My Leaves, My Report Card and the
student assignment board were all empty for a signed-in student. The demo
accounts now carry the seeded person id.

Also: teachers only mark attendance for their own class (mirrors RLS),
course-progress form validates student/subject/percent.

Verified with a jsdom smoke suite: sign-in as all three roles, all 19 routes
render with no runtime errors, leave approval (2->1 pending), report-card
generation, class event creation, CSV import (2 of 4 rows), student leave
apply, submission, declaration signing and poll voting.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Applied 0001 + 0002 to Postgres 14 (pgserver) and exercised the policies as the
authenticated role. Fixed:

1. class_teacher_id was added after class_teacher_of_section() /
   is_class_teacher_of() referenced it, so every call failed with
   'column s.class_teacher_id does not exist'. ALTER TABLE moved above the
   helpers.
2. school_events_teacher_insert used section_ids <@ ARRAY(SELECT section_id ...),
   which compares an array to a single row. Teachers could never publish a class
   event. Replaced with NOT EXISTS (... NOT teaches_section(...)).
3. leave_requests_teacher_decide let a reviewer move a leave between any two
   statuses; now requires status='pending' on read and decided_by=auth.uid() on
   write, so an approval cannot be silently rewritten.

Added supabase/tests/verify_rls_local.py (20 assertions, all passing) and a
tests README explaining the pgTAP vs no-Docker routes.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
package.json typecheck pointed at 'npm run typecheck --workspaces --if-present',
which skipped apps/mobile entirely (it has no typecheck script) and produced no
output about it. scripts/typecheck-all.mjs now checks admin, mobile and shared,
and reports a workspace whose own dependencies are absent instead of silently
passing.

Added 'npm run verify:rls' for the no-Docker database suite.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Vite only injects VITE_-prefixed variables into process.env, so the documented
pair (no prefix, matching the Vercel project) resolved to undefined when written
as a plain line in apps/admin/.env. The app then short-circuited to demo mode and
login reported 'Supabase not configured' even though the variables were set
correctly. vite.config.ts now uses loadEnv(mode, cwd, '') so unprefixed names are
read from .env*, with process.env still taking precedence. Verified: a plain
SUPABASE_URL=/SUPABASE_PUBLISHABLE_KEY pair in .env is now inlined into the
production bundle.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Brings in the zod 4.6.7 bump merged from PR #1. Main adds no files the branch
lacks, so source conflicts are resolved in favour of this branch (the complete
dashboard implementation); package-lock.json and packages/shared/package.json
are taken from main so the dependency bump is preserved.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Three advisories reached the tree:
  GHSA-mrhx-c7xc-m3w5 zod  <4.6.6   (fixed by PR #1, merged)
  GHSA-3g3m-2fjr-6pw4 glob 9.0.0-14.0.1
  GHSA-g3hv-75wg-m249 minimatch >=7.0.0 <11.0.1

glob is now pinned to ^14.0.3 and the minimatch copies that were hoisted at 10.x
are pinned to ^11.0.4. eslint's own minimatch@3.1.5 is *outside* the advisory
range and is deliberately left alone, so eslint's globbing semantics do not
change.

eslint 9 -> 10 removes the @eslint/eslintrc dependency, drops the
@eslint-community/eslint-utils advisory, and lets @eslint/config-array run on
minimatch 10. eslint 10 also flagged three genuine dead stores in
normalizeDob(), which are fixed here.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Dependency tree now reports 0 vulnerabilities: @eslint/config-array and eslint
are pinned to minimatch ^11.0.4, so every copy in the tree is >= 11.0.1.

eslint-plugin-react-hooks 5 -> 7 and eslint-plugin-react-refresh 0.4 -> 0.5
(matching eslint 10, which all four plugins support via peers) surfaced two real
lifecycle problems, both fixed rather than suppressed:

  - AuthContext set 'loading' inside an effect to short-circuit the no-client
    case. It now starts resolved when Supabase is not configured, so there is no
    cascading render on mount.
  - AppShell closed the mobile drawer and notification popover from an effect
    keyed on the pathname. The shell is now keyed on the pathname in App.tsx, so
    React resets that state on navigation and the effect is gone.

Also fixed three dead stores in normalizeDob() (no-useless-assignment) and
extracted AppShell's routeLabels into labelFor(role) so the breadcrumb memo has
an honest dependency list.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
printHtml() and StudyRoom's openMaterial() built HTML by string interpolation
and handed it to document.write(). The values involved are user-entered (student
and subject names, teacher notes, file names), so a crafted name executed script
in the generated window — a stored XSS sink reachable from the report-card
printer and the study-room preview.

Added escapeHtml() to lib/utils and applied it to every interpolation in both
documents. printHtml() also escapes its <title>.

To stop this coming back, eslint now bans document.write() outright
(no-restricted-syntax) with the two reviewed, now-escaped call sites annotated.
Verified the rule fires on a deliberately vulnerable probe file.

Also made the two flagged fs paths in scripts/ provably constant.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Nine third-party scanners run on every push, but only CodeQL, Codacy (free rule
sets), OSSAR and the CI gate can succeed without a vendor account. The rest fail
on missing credentials, not on findings, so they will stay red forever no matter
what the code does. Documented the required secret for each, the Endor Labs
'namespace: example' template leftover, and the option of deleting the redundant
scanners rather than keeping seven checks permanently red.

Also bumped the deprecated actions/cache@v3 to v4 in CodeScan.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
GitHub forces Node 20 actions onto Node 24 now and annotates every run. Node 20
is also EOL, and eslint 10 requires >= 20.19, so the CI job pins Node 22 and the
root engines field says >= 20.19.0.

setup-node/setup-java/setup-dotnet bumped to v6 and actions/cache to v4.

Verified locally on Node 22.22.3 with a clean 'npm ci': typecheck, lint
(0 errors) and the admin build all exit 0, and npm reports 0 vulnerabilities.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Refreshing /login (or any non-root route) returned Vercel's 404 because
vercel.json declared no rewrite: the platform looked for a real file at that
path. React Router never got a chance to run, so the only way back was to delete
the path from the address bar.

Added a catch-all rewrite to /index.html that excludes real asset directories,
so /assets/*.js and /brand/*.png are still served as files, plus baseline
security headers (CSP, nosniff, frame denial, HSTS, referrer policy) and
immutable caching for fingerprinted assets.

Verified against the real build output: /login, /dashboard, /fees, /approvals
and /report-card all resolve to dist/index.html while /assets and /brand files
are unaffected.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…ermissions

CodeQL scans the workflow files themselves ('actions' language), and the code
scanning tab reports supply-chain findings there. Addressed the whole class:

  - every 'uses:' is now pinned to a 40-character commit SHA, including
    GitHub-owned actions (mutable tags like @v4 can be repointed at any time);
  - github/codeql-action/upload-sarif moved from the retired v3 to v4 across
    six workflows;
  - all 11 workflows declare 'permissions: contents: read' at the top level,
    with the security-events: write the SARIF uploads need scoped to the job;
  - codeql.yml's commented-out 'actions/setup-example@v1' placeholder is gone.

checkmarx/ast-github-action@v3 does not exist upstream (latest is 2.3.47 and
there is no v3 ref), so that workflow could never have resolved; it now pins the
real 2.3.47 commit. Its credentials are still missing, so the job itself stays
red until a Checkmarx account exists — see docs/security/scanning.md.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
signIn() checked the hardcoded demo credentials BEFORE asking Supabase whether a
client existed, so with a real project configured, ADMIN001/Admin@1234 still
returned an admin profile. The browser was deciding identity for a
database-backed app: a full authentication bypass, and exactly the kind of
hardcoded-credential finding every SAST tool reports.

Fixes:
  - the Supabase branch now runs first; demo credentials are consulted only when
    no client exists at all;
  - the demo table sits inside an 'import.meta.env.DEV' branch, so a production
    build folds it away;
  - the login-page hint, the People-page example and the seeded 'password' field
    no longer embed literals (the last two derive the value).

Verified against the real production bundle: Admin@1234, Teacher@1234 and
Student@14052010 now appear 0 times in dist/assets/*.js (previously 1, 1 and 3).
Dev mode is unchanged - DEV is true there, so the demo accounts still work.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
'import.meta.env.DEV' is a property lookup on a define'd object, so neither Vite
nor esbuild could prove the guarded branch dead; the demo table and the
login-page credential hint survived minification. Replaced with an explicit
__DEMO_MODE__ define that compiles to a literal true/false, declared in
vite-env.d.ts.

esbuild also hoists JSX literals out of dead branches under the automatic JSX
runtime, so the hint now returns its element from an early-return guard and
builds the credential strings from parts — no complete literal exists in source
to hoist.

Verified both ways: Vite's production build and a plain minified esbuild build of
main.tsx both contain zero occurrences of Admin@1234, Teacher@1234 and
Student@14052010, while a development build still shows the hint and accepts the
demo logins.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
eslint's no-undef fired on the define'd constant. Declared as a read-only global
in the admin flat config, matching the ambient type in vite-env.d.ts.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…olumn)

teaches_section(section_id uuid) compared 'ta.section_id = section_id'. Inside
the body a bare name resolves to the function parameter, so that is
'ta.section_id = ta.section_id' - a tautology. Every teacher passed the
section check for every section, which widens every policy built on it
(assignments, events, leave routing, materials).

Verified on Postgres 14 before fixing: with one row in (section_a), the
shadowed function returned true for a completely unrelated uuid, while the
prefixed version returned false.

Changes:
  - all SECURITY DEFINER helpers take p_-prefixed parameters (documented in
    0001 so this is not reintroduced);
  - every helper pins SET search_path = '' with schema-qualified bodies, closing
    the search_path privilege-escalation pattern Supabase's linter reports;
  - new 0003 revokes the default PUBLIC/anon EXECUTE grant and re-grants to
    authenticated only.

verify_rls_local.py now applies 0003 and asserts teaches_section is false for a
foreign section and true for the caller's own. Confirmed the new assertions fail
when the original shadowing is put back. 23/23 pass.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The same shadowing mistake as teaches_section(), this time inside a policy: the
subquery compared 'e.student_id = student_id', and with no local binding that
bare name resolved back to e.student_id, so the EXISTS degenerated to
'e.student_id = e.student_id'. Any teacher could open a private thread with any
student in the school.

Verified on Postgres 14 that the predicate matched a student in an unrelated
section before the fix.

Now references threads.student_id explicitly. verify_rls_local.py asserts a
teacher is denied for a foreign student and allowed for their own, and both
assertions fail if the bare name is restored. 25/25 pass.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Correct as written (polls has no poll_id column, so the bare name bound to the
outer row) but it reads exactly like the two shadowing bugs just fixed, and any
future column added to polls would silently flip its meaning. Spelled out
instead.

An audit of every policy and SECURITY DEFINER body found no other ambiguous
references.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
schoolerp Ready Ready Preview Nov 4, 2026 5:36pm UTC

@codeant-ai

codeant-ai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

CodeAnt  CodeAnt Review Status

✅  Review completed

Status Commit Started (UTC) Finished (UTC)
✅  #0feff Reviewed your PR 8bf3f27 Nov 04, 2026 · 17:36 17:49

@codeant-ai

codeant-ai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Nov 4, 2026
@gitguardian

gitguardian Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 5 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
39593366 Triggered Generic Password 42ad863 apps/admin/src/contexts/AuthContext.tsx View secret
39593366 Triggered Generic Password 42ad863 apps/admin/src/lib/seed.ts View secret
39597775 Triggered Generic Password 42ad863 apps/admin/src/pages/People.tsx View secret
39597774 Triggered Generic Password 42ad863 apps/admin/src/lib/seed.ts View secret
39593366 Triggered Generic Password 670434f apps/admin/src/contexts/AuthContext.tsx View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. 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


🦉 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.

@sahajiscoding
sahajiscoding merged commit 828e6ec into main Nov 4, 2026
12 of 21 checks passed
@sahajiscoding
sahajiscoding deleted the arena/c9a0e954-schoolerp branch November 4, 2026 17:38
Comment thread scripts/create-admin.mjs
Comment on lines +134 to +144
console.log(`
Admin created.

Login ID : ${loginId}
Password : ${password}
Role : admin

The account is flagged must_change_password, so the console will ask for a new
password at first sign-in. Share these credentials over a secure channel and
then delete this terminal history.
`);

@github-advanced-security github-advanced-security AI 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.

Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-advanced-security github-advanced-security AI 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.

Tsqllint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-advanced-security github-advanced-security AI 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.

Pylint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread apps/admin/vite.config.ts
Comment on lines +35 to +40
server: {
host: '0.0.0.0',
// The Arena sandbox serves previews from a generated sub-domain; allow any
// host so the live preview and localhost both work.
allowedHosts: true,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: With host: '0.0.0.0', this disables Vite's Host-header check on the dev server, letting malicious DNS-rebinding sites access its source files.

Assessment: 🔴 Critical · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/vite.config.ts
**Line:** 35:40
**Comment:**
	*Security: With `host: '0.0.0.0'`, this disables Vite's Host-header check on the dev server, letting malicious DNS-rebinding sites access its source files.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

statement under test — pgserver.psql() opens a new connection per call.
"""

import pgserver, tempfile, uuid, json, re, sys
statement under test — pgserver.psql() opens a new connection per call.
"""

import pgserver, tempfile, uuid, json, re, sys
statement under test — pgserver.psql() opens a new connection per call.
"""

import pgserver, tempfile, uuid, json, re, sys
"""Blocked writes produce no command tag (the RLS error goes to stderr) and
a blocked UPDATE/DELETE reports `UPDATE 0` / `DELETE 0`."""
ok, out = run_as(uid, f"{sql} RETURNING 1;")
err = [l for l in out.splitlines() if l.startswith("ERROR:")]
ok, out = run_as(uid, f"{sql} RETURNING 1;")
err = [l for l in out.splitlines() if l.startswith("ERROR:")]
if not ok or err:
return "DENIED" if any("row-level security" in l or "permission denied" in l for l in err) else "OTHER"
("student authors report card", attempt(ids['sa'], f"insert into report_cards (student_id,term,academic_year,created_by) values ('{ids['sa']}','X','2026-27','{ids['sa']}')")),
("student creates sibling link", attempt(ids['sa'], f"insert into sibling_links (student_id,sibling_id,discount_percent) values ('{ids['sb']}','{ids['sa']}',50)")),
("student approves own leave", attempt(ids['sb'], f"update leave_requests set status='approved' where student_id='{ids['sb']}'")),
("teacher creates school-wide event", attempt(ids['cteach'], f"insert into school_events (title,kind,start_date,end_date,section_ids,created_by) values ('Fake','Holiday','2026-12-01','2026-12-01','{{}}','{ids['cteach']}')")),
# Regression: the threads INSERT policy compared `e.student_id = student_id`,
# which collapsed to a tautology and let a teacher open a thread with ANY
# student. 'sa' sits in a section this teacher does not teach.
("teacher opens thread with foreign student", attempt(ids['oteach'], f"insert into threads (teacher_id,student_id,subject) values ('{ids['oteach']}','{ids['sa']}','Extra classes')")),

print()
pos = [
("class teacher approves leave", attempt(ids['cteach'], f"update leave_requests set status='approved', decided_by='{ids['cteach']}' where student_id='{ids['sa']}'")),
print()
pos = [
("class teacher approves leave", attempt(ids['cteach'], f"update leave_requests set status='approved', decided_by='{ids['cteach']}' where student_id='{ids['sa']}'")),
("teacher creates class event", attempt(ids['oteach'], f"insert into school_events (title,kind,start_date,end_date,section_ids,created_by) values ('Unit test','Exam','2026-12-02','2026-12-02',ARRAY['{osec}']::uuid[],'{ids['oteach']}')")),
("class teacher approves leave", attempt(ids['cteach'], f"update leave_requests set status='approved', decided_by='{ids['cteach']}' where student_id='{ids['sa']}'")),
("teacher creates class event", attempt(ids['oteach'], f"insert into school_events (title,kind,start_date,end_date,section_ids,created_by) values ('Unit test','Exam','2026-12-02','2026-12-02',ARRAY['{osec}']::uuid[],'{ids['oteach']}')")),
("admin applies sibling discount", attempt(ids['admin'], f"update fee_records set sibling_discount_percent=50 where student_id='{ids['sb']}'")),
("teacher opens thread with own student", attempt(ids['oteach'], f"insert into threads (teacher_id,student_id,subject) values ('{ids['oteach']}','{ids['sb']}','Revision plan')")),
Comment thread PROJECT_STATUS.md
3. Add new risks or open questions.
4. Update "Last updated".
5. Never mark something done without a test or manual verification note.
1. Apply `0001` + `0002`, run both pgTAP suites, fix any policy fallout.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This deployment instruction skips 0003_function_hardening.sql, leaving SECURITY DEFINER helpers executable by PUBLIC and anon under PostgreSQL's default grants.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** PROJECT_STATUS.md
**Line:** 121:121
**Comment:**
	*Security: This deployment instruction skips `0003_function_hardening.sql`, leaving `SECURITY DEFINER` helpers executable by `PUBLIC` and `anon` under PostgreSQL's default grants.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread .github/workflows/ci.yml
# A client-side variable may name a public key and nothing else.
# PUBLISHABLE_KEY / ANON_KEY are the allowed exceptions.
if grep -rIn --include='*.ts' --include='*.tsx' --include='*.js' --include='*.mjs' \
--include='.env.example' -E '(EXPO_PUBLIC|VITE)_[A-Z_]*(SECRET|SERVICE|PRIVATE|JWT|POSTGRES|PASSWORD|TOKEN)' \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The pattern omits DATABASE, so names such as VITE_DATABASE_URL bypass this guard even though the project classifies database variables as server-side.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .github/workflows/ci.yml
**Line:** 42:42
**Comment:**
	*Security: The pattern omits `DATABASE`, so names such as `VITE_DATABASE_URL` bypass this guard even though the project classifies database variables as server-side.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread .github/workflows/ci.yml
if grep -rIn --include='*.ts' --include='*.tsx' --include='*.js' --include='*.mjs' \
--include='.env.example' -E '(EXPO_PUBLIC|VITE)_[A-Z_]*(SECRET|SERVICE|PRIVATE|JWT|POSTGRES|PASSWORD|TOKEN)' \
apps/ scripts/ 2>/dev/null \
| grep -v -E 'PUBLISHABLE_KEY|ANON_KEY' ; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Filtering whole result lines lets a secret-like variable pass whenever its source line also mentions PUBLISHABLE_KEY or ANON_KEY.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .github/workflows/ci.yml
**Line:** 44:44
**Comment:**
	*Security: Filtering whole result lines lets a secret-like variable pass whenever its source line also mentions `PUBLISHABLE_KEY` or `ANON_KEY`.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines 96 to 103
data.addPerson({
full_name: form.full_name,
login_id: form.login_id,
role: form.role,
email: form.email,
phone: form.phone,
full_name: form.full_name.trim(),
login_id: form.login_id.trim(),
role: 'student',
dob: isoDob ?? undefined,
class_label: form.class_label,
section_label: form.section_label,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This adds the student only to local app data and does not create an authentication user, so the generated credentials cannot sign in.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/People.tsx
**Line:** 96:103
**Comment:**
	*Incomplete Implementation: This adds the student only to local app data and does not create an authentication user, so the generated credentials cannot sign in.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

setPreview([]);
return;
}
const seen = new Set<string>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This set only tracks numbers in the current CSV; importing a number already in people adds another account with the same login ID.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/People.tsx
**Line:** 133:133
**Comment:**
	*Logic Error: This set only tracks numbers in the current CSV; importing a number already in `people` adds another account with the same login ID.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +207 to +214
validRows.map((row) => ({
full_name: row.full_name,
admission_no: row.admission_no,
login_id: row.admission_no,
password: row.password,
class: row.class_label,
section: row.section_label,
})),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Imported names and admission numbers go directly into the credentials CSV; a value beginning with = can run as a spreadsheet formula when the file is opened.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/People.tsx
**Line:** 207:214
**Comment:**
	*Security: Imported names and admission numbers go directly into the credentials CSV; a value beginning with `=` can run as a spreadsheet formula when the file is opened.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +67 to +68
marks: Number(s.marks) || 0,
max_marks: Number(s.max_marks) || 100,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Negative marks and marks above the maximum are accepted, allowing impossible totals and percentages that produce misleading report card grades.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/ReportCard.tsx
**Line:** 67:68
**Comment:**
	*Logic Error: Negative marks and marks above the maximum are accepted, allowing impossible totals and percentages that produce misleading report card grades.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +51 to +52
isAdmin() || isStudent()
? true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: For student accounts, this condition includes every student, exposing their names, login IDs, and attendance records in the shared data store.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Attendance.tsx
**Line:** 51:52
**Comment:**
	*Security: For student accounts, this condition includes every student, exposing their names, login IDs, and attendance records in the shared data store.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

<div>
<h1 className="text-2xl font-bold text-ink">Audit Log</h1>
<p className="text-muted">
Every administrative action is recorded. Entries are read-only — admins cannot edit or delete

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: data.audit only shows seeded entries because no administrative action calls logAudit, so this presents an incomplete list as a complete audit trail.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Comment mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/AuditLog.tsx
**Line:** 34:34
**Comment:**
	*Comment Mismatch: `data.audit` only shows seeded entries because no administrative action calls `logAudit`, so this presents an incomplete list as a complete audit trail.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +74 to +79
data.broadcastMessage({
title: messageForm.title.trim() || 'Message from your teacher',
body: messageForm.body.trim(),
section_label: messageForm.section_label,
created_by: profile.id,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The selected section is passed to broadcastMessage, but it creates one shared notification without recipient filtering, so every user receives the message.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Communications.tsx
**Line:** 74:79
**Comment:**
	*Api Mismatch: The selected section is passed to `broadcastMessage`, but it creates one shared notification without recipient filtering, so every user receives the message.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

style={{ width: `${share}%` }}
/>
</div>
{!hasVoted && isStudent() && (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This shows Vote even after poll.closes_at, and voting has no deadline check, so students can vote in closed polls.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Incorrect condition logic

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Communications.tsx
**Line:** 237:237
**Comment:**
	*Incorrect Condition Logic: This shows Vote even after `poll.closes_at`, and voting has no deadline check, so students can vote in closed polls.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +422 to +427
onClick={() =>
setPollForm({
...pollForm,
options: pollForm.options.filter((_, index) => index !== i),
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Removing every option still allows publishing, creating a poll with no choices that students cannot vote in.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Communications.tsx
**Line:** 422:427
**Comment:**
	*Incomplete Implementation: Removing every option still allows publishing, creating a poll with no choices that students cannot vote in.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎


CREATE OR REPLACE FUNCTION set_auth_uid(uid uuid) RETURNS void
LANGUAGE sql AS $$
SELECT set_config('request.jwt.claims', jsonb_build_object('sub', uid::text)::text, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Without a surrounding transaction, is_local=true resets this claim when the statement commits, so subsequent assertions run without the selected user.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/tests/rls_matrix_dashboard.sql
**Line:** 19:19
**Comment:**
	*Logic Error: Without a surrounding transaction, `is_local=true` resets this claim when the statement commits, so subsequent assertions run without the selected user.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +44 to +49
INSERT INTO profiles (id, role, full_name, login_id, is_active) VALUES
(admin_id, 'admin', 'Admin', 'ADM900', true),
(class_teacher, 'teacher', 'Class Teacher', 'TCH900', true),
(other_teacher, 'teacher', 'Other Teacher', 'TCH901', true),
(student_a, 'student', 'Student A', 'STU900', true),
(student_b, 'student', 'Student B', 'STU901', true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: These profile IDs have no matching rows in auth.users, so the foreign key rejects fixture setup and the pgTAP file stops before its assertions.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/tests/rls_matrix_dashboard.sql
**Line:** 44:49
**Comment:**
	*Api Mismatch: These profile IDs have no matching rows in `auth.users`, so the foreign key rejects fixture setup and the pgTAP file stops before its assertions.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

-- ---------------------------------------------------------------------------

-- 1. class teacher sees the leave request for their section
SELECT set_auth_uid((SELECT value FROM ids WHERE key = 'class_teacher'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The test never switches from the privileged database owner to authenticated, so RLS is bypassed and the policies are not actually tested.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/tests/rls_matrix_dashboard.sql
**Line:** 107:107
**Comment:**
	*Logic Error: The test never switches from the privileged database owner to `authenticated`, so RLS is bypassed and the policies are not actually tested.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

create or replace function auth.uid() returns uuid language sql stable as $fn$
select nullif(current_setting('request.jwt.claims', true)::jsonb ->> 'sub', '')::uuid; $fn$;
do $$ begin create role authenticated nologin; exception when duplicate_object then null; end $$;""")
db.psql(open('/home/user/schoolerp/supabase/migrations/0001_initial_schema.sql').read().replace('CREATE EXTENSION IF NOT EXISTS pgcrypto;',''))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This absolute path points to one developer's checkout, so the documented verifier raises FileNotFoundError in this repository or another checkout.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/tests/verify_rls_local.py
**Line:** 22:22
**Comment:**
	*Api Mismatch: This absolute path points to one developer's checkout, so the documented verifier raises `FileNotFoundError` in this repository or another checkout.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

ok = res == "ALLOWED"; fails += 0 if ok else 1
print(f"{'PASS' if ok else 'FAIL'} {name:40s} {res}")

print("\nRESULT:", "ALL PASS" if fails == 0 else f"{fails} FAILURES")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Even when checks increment fails, this only prints the result and exits with status zero, so automation treats failed RLS checks as successful.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/tests/verify_rls_local.py
**Line:** 164:164
**Comment:**
	*Logic Error: Even when checks increment `fails`, this only prints the result and exits with status zero, so automation treats failed RLS checks as successful.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread scripts/create-admin.mjs

const loginId = (process.argv[2] || (await rl.question('Admin login ID [ADMIN001]: ')) || 'ADMIN001').trim();
const fullName = (process.argv[3] || (await rl.question('Full name [School Administrator]: ')) || 'School Administrator').trim();
const password = (process.argv[4] || (await rl.question('Password (min 10 chars): ')) || '').trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Passing the initial password through process.argv[4] exposes it in shell history and process listings while the script runs.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/create-admin.mjs
**Line:** 70:70
**Comment:**
	*Security: Passing the initial password through `process.argv[4]` exposes it in shell history and process listings while the script runs.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread scripts/create-admin.mjs
}

const supabase = createClient(url, serviceRoleKey, { auth: { persistSession: false } });
const email = `${loginId.toLowerCase()}@pws.local`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: ADMIN+1 becomes admin+1@pws.local here, but sign-in normalizes it to admin-1@pws.local, so the created admin cannot log in.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/create-admin.mjs
**Line:** 84:84
**Comment:**
	*Api Mismatch: `ADMIN+1` becomes `admin+1@pws.local` here, but sign-in normalizes it to `admin-1@pws.local`, so the created admin cannot log in.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread scripts/create-admin.mjs
});

if (profileError) {
await supabase.auth.admin.deleteUser(created.user.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: If deleting the auth user fails, its returned error is ignored and the script still claims rollback, leaving an auth-only account.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Missing cleanup

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/create-admin.mjs
**Line:** 121:121
**Comment:**
	*Missing Cleanup: If deleting the auth user fails, its returned error is ignored and the script still claims rollback, leaving an auth-only account.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

// Without a Supabase client there is no session to wait for, so start out
// resolved rather than flipping `loading` inside an effect (which cascades
// renders on mount).
const [loading, setLoading] = useState(() => !missingSupabaseConfig());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: loading starts true when both config strings exist, but a rejected client returns before clearing it, leaving protected routes on an endless spinner.

Assessment: 🔴 Critical · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/contexts/AuthContext.tsx
**Line:** 90:90
**Comment:**
	*Logic Error: `loading` starts true when both config strings exist, but a rejected client returns before clearing it, leaving protected routes on an endless spinner.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +545 to +551
fees: link
? current.fees.map((invoice) =>
invoice.student_id === link.sibling_id
? { ...invoice, discount: 0, sibling_of: undefined }
: invoice,
)
: current.fees,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Removing the sibling discount leaves invoice paid and status unchanged; the seeded invoice becomes partially due while still marked paid and has no Pay action.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/lib/appData.tsx
**Line:** 545:551
**Comment:**
	*Incomplete Implementation: Removing the sibling discount leaves invoice `paid` and `status` unchanged; the seeded invoice becomes partially due while still marked paid and has no Pay action.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +575 to +576
books: current.books.filter((book) => book.id !== id),
bookIssues: current.bookIssues.filter((issue) => issue.book_id !== id),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Removing the final book deletes its active issue row, so the borrowed item disappears from the issued-book list and cannot be returned.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/lib/appData.tsx
**Line:** 575:576
**Comment:**
	*Logic Error: Removing the final book deletes its active issue row, so the borrowed item disappears from the issued-book list and cannot be returned.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +671 to +678
{
id: uid('notif'),
title: input.title,
body: input.body,
kind: 'notice',
created_at: new Date().toISOString(),
read: false,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The selected section_label is never stored, so every class receives this broadcast through the shared notification feed, exposing messages outside their intended audience.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/lib/appData.tsx
**Line:** 671:678
**Comment:**
	*Security: The selected `section_label` is never stored, so every class receives this broadcast through the shared notification feed, exposing messages outside their intended audience.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

const removeClass: AppDataContextValue['removeClass'] = useCallback((id) => {
setState((current) => ({
...current,
classes: current.classes.filter((entry) => entry.id !== id),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Removing a class leaves enrolled students’ class_label unchanged, so Enrollments still marks them enrolled in a class that no longer exists.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/lib/appData.tsx
**Line:** 704:704
**Comment:**
	*Incomplete Implementation: Removing a class leaves enrolled students’ `class_label` unchanged, so Enrollments still marks them enrolled in a class that no longer exists.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +78 to +79
body: submissionNote.trim() || 'Submitted from the student portal.',
file_name: submissionNote.trim() ? 'submission.pdf' : undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Any text note is recorded as file submission.pdf even though the modal collects no file, so teachers see an attachment that was never sent.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Assignments.tsx
**Line:** 78:79
**Comment:**
	*Logic Error: Any text note is recorded as file submission.pdf even though the modal collects no file, so teachers see an attachment that was never sent.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +94 to +102
return sectionStudents
.filter((student) => !submitted.some((s) => s.student_id === student.id))
.slice(0, 1)
.map((student) => ({
assignment: hw,
student,
submission: submitted.find((s) => s.student_id === student.id) ?? null,
missing: true,
}))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The submissions view keeps only one non-submitting student per assignment, so every other student who missed it disappears from the per-student status list.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Assignments.tsx
**Line:** 94:102
**Comment:**
	*Logic Error: The submissions view keeps only one non-submitting student per assignment, so every other student who missed it disappears from the per-student status list.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +35 to +37
const myAttendance = data.attendance.filter((a) => a.student_id === profile?.id);
const presentDays = myAttendance.filter((a) => a.status === 'present').length;
const teachingDays = myAttendance.filter((a) => a.status !== 'holiday').length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: attendanceRate uses every saved attendance record, so once older months remain in storage, the “this month” percentage includes them.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Dashboard.tsx
**Line:** 35:37
**Comment:**
	*Logic Error: `attendanceRate` uses every saved attendance record, so once older months remain in storage, the “this month” percentage includes them.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +53 to +56
return data.homework.filter((hw) => {
const student = data.people.find((p) => p.id === profile?.id);
return hw.section_label === `${student?.class_label} - ${student?.section_label}`;
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: This list includes past-due homework and assignments already submitted, so the dashboard labels completed or expired work as pending.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Logic error

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Dashboard.tsx
**Line:** 53:56
**Comment:**
	*Logic Error: This list includes past-due homework and assignments already submitted, so the dashboard labels completed or expired work as pending.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

data.notify('An event needs a title and a start date.');
return;
}
const audience = isAdmin() ? form.audience : 'Class only';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Teacher events are saved with a generic audience instead of their teacherSection, so the calendar cannot identify which section each event targets.

Assessment: 🟠 Major · 🔁 Occurrence: Often · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Events.tsx
**Line:** 89:89
**Comment:**
	*Incomplete Implementation: Teacher events are saved with a generic audience instead of their `teacherSection`, so the calendar cannot identify which section each event targets.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

data.linkSibling(
siblingForm.student_id,
siblingForm.sibling_id,
Number(siblingForm.discount_percent) || 50,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Entering a valid 0% sibling discount falls through this fallback and applies a 50% discount instead.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Falsy zero check

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Fees.tsx
**Line:** 74:74
**Comment:**
	*Falsy Zero Check: Entering a valid 0% sibling discount falls through this fallback and applies a 50% discount instead.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +83 to 87
if (!payForm.invoice_id || !payForm.amount) {
data.notify('Pick an invoice and enter the amount received.');
return;
}
data.recordPayment(payForm.invoice_id, Number(payForm.amount) || 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: A negative amount passes this check and reduces the invoice’s recorded payment, allowing its paid balance to become negative.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incorrect condition logic

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Fees.tsx
**Line:** 83:87
**Comment:**
	*Incorrect Condition Logic: A negative amount passes this check and reduces the invoice’s recorded payment, allowing its paid balance to become negative.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

</TableRow>
</TableHeader>
<tbody>
{data.siblings.map((link) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Students can see every sibling link here, including other students’ names, admission numbers, and family relationships.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** apps/admin/src/pages/Fees.tsx
**Line:** 249:249
**Comment:**
	*Security: Students can see every sibling link here, including other students’ names, admission numbers, and family relationships.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +213 to +219
await admin.from('student_details').insert({
profile_id: created.user.id,
admission_no: admissionNo,
date_of_birth: dateOfBirth,
});

results.push({ admissionNo, status: 'created', password });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: An invalid calendar date such as 2010-02-31 makes this insert fail, but the profile remains and the response still counts the student as created.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/functions/admin-users/index.ts
**Line:** 213:219
**Comment:**
	*Incomplete Implementation: An invalid calendar date such as `2010-02-31` makes this insert fail, but the profile remains and the response still counts the student as created.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

SET search_path = ''
AS $$
SELECT p.role FROM profiles p WHERE p.id = auth.uid();
SELECT p.role FROM public.profiles p WHERE p.id = auth.uid();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: app_role() returns a role even when its profile is inactive, so a disabled teacher or admin can still use policies that grant role-based writes.

Assessment: 🔴 Critical · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/migrations/0001_initial_schema.sql
**Line:** 190:190
**Comment:**
	*Security: `app_role()` returns a role even when its profile is inactive, so a disabled teacher or admin can still use policies that grant role-based writes.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

FOR SELECT USING (
is_admin()
OR created_by = auth.uid()
OR audience IN ('students', 'both')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Every student can read forms with a student audience, including forms whose section_ids target other sections.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/migrations/0002_dashboard_modules.sql
**Line:** 346:346
**Comment:**
	*Security: Every student can read forms with a student audience, including forms whose `section_ids` target other sections.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +390 to +392
CREATE POLICY "school_events_owner_update" ON school_events
FOR UPDATE USING (auth.uid() = created_by OR is_admin())
WITH CHECK (auth.uid() = created_by OR is_admin());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: A teacher who owns an event can change its sections to the whole school or sections they do not teach; this update policy does not retain the insert scope.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/migrations/0002_dashboard_modules.sql
**Line:** 390:392
**Comment:**
	*Security: A teacher who owns an event can change its sections to the whole school or sections they do not teach; this update policy does not retain the insert scope.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +412 to +415
CREATE POLICY "report_cards_teacher_write" ON report_cards
FOR INSERT WITH CHECK (
auth.uid() = created_by AND (app_role() = 'teacher' OR is_admin())
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Any teacher can create a report card for any student by setting created_by to their own ID; this policy does not check the teacher’s section.

Assessment: 🔴 Critical · 🔁 Occurrence: Sometimes · 🏷️ Security

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** supabase/migrations/0002_dashboard_modules.sql
**Line:** 412:415
**Comment:**
	*Security: Any teacher can create a report card for any student by setting `created_by` to their own ID; this policy does not check the teacher’s section.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Nov 4, 2026

Copy link
Copy Markdown

CodeAnt  CodeAnt Nitpicks

18 code suggestions

1. After users delete all seeded books, classes, or subjects, this treats saved empty arrays as stale and repopulates them on the next load.

Logic error · apps/admin/src/lib/appData.tsx:130-136


2. Removing a class leaves students’ class and section labels unchanged, so they remain assigned to a class that no longer exists.

Stale reference · apps/admin/src/pages/Classes.tsx:100


3. Different admission numbers such as 900/18 and 900-18 normalize to the same email, so importing both makes the second account creation fail.

Logic error · supabase/functions/admin-users/index.ts:33-41


4. With checkout’s default depth of one, neither the base ref nor HEAD~1 is available, leaving changed empty and preventing the PROJECT_STATUS warning.

Logic error · .github/workflows/ci.yml:76


5. Selecting teacher or student preview makes isAdmin() false and removes RoleSwitcher, including “Back to my role”; admins cannot exit preview without reloading.

Logic error · apps/admin/src/components/AppShell.tsx:351-357


6. This keeps the original array order, so the seeded older request appears before the newer one despite the inbox claiming newest first.

Logic error · apps/admin/src/pages/Approvals.tsx:63


7. With the default all filter, pending requests appear in Decision history as well as Pending approvals, so the table presents undecided requests as history.

Incorrect condition logic · apps/admin/src/pages/Approvals.tsx:64


8. The type filter does not affect this list, so selecting Homework or Assignments in the submissions tab still shows both types.

Incorrect condition logic · apps/admin/src/pages/Assignments.tsx:89


9. pendingLeaves counts requests from every section, while the teacher’s approvals inbox is section-scoped, so unrelated requests inflate the dashboard count.

Incorrect condition logic · apps/admin/src/pages/Dashboard.tsx:29


10. If the end date precedes the start date, this saves a reversed range; no calendar day can match it, so the event disappears from the calendar.

Incorrect condition logic · apps/admin/src/pages/Events.tsx:99


11. When the DOB is blank, this message promises a date-based password, but the account receives Student@1234 instead.

Possible bug · apps/admin/src/pages/People.tsx:331


12. Students added through the manual form store their admission number as login_id, not admission_no, so this student picker omits their number.

Api mismatch · apps/admin/src/pages/ReportCard.tsx:257


13. scripts/create-admin.mjs creates administrator accounts with a supplied password; this decision log falsely says it implements student DOB-based passwords.

Comment mismatch · docs/superpowers/specs/2026-11-03-school-erp-design.md:334


14. This attributes the bootstrap action to the newly created admin, falsely recording that account as the actor who created itself.

Incorrect variable usage · scripts/create-admin.mjs:127


15. For apps/mobile, this invokes root TypeScript 5.9 even though the workspace pins 6.0.3, so the mobile check uses the wrong compiler.

Api mismatch · scripts/typecheck-all.mjs:40-43


16. A student can pair any poll’s poll_id with an option from another poll; the insert check never verifies that the option belongs to that poll.

Logic error · supabase/migrations/0002_dashboard_modules.sql:372-373


17. No declaration forms are seeded, so both counts are zero and this assertion passes without checking whether students can see parent-only forms.

Incomplete implementation · supabase/tests/rls_matrix_dashboard.sql:303-305


18. The test uses a leave-request ID as form_id, but no matching declaration form exists, so the foreign-key error passes without testing the ownership policy.

Api mismatch · supabase/tests/rls_matrix_dashboard.sql:312-314

sahajiscoding added a commit that referenced this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants