talos-access / progress /review.md
Greg
Claude Opus 4.7 (1M context)
Preparar despliegue en fly.io: monolito dockerizado + seeder demo
6aa6081
|
Raw History Blame Contribute Delete
6.6 kB
# QA Review β€” Technical Audit
**Date:** 2026-05-28
**Reviewer:** Senior QA Automation & Systems Tester
**Scope:** Full-stack audit of Talos Access application
---
## 1. Automated Test Harness (`./init.sh`)
**Result:** FAILED (environment issue β€” WSL not configured, exit code 126)
The `init.sh` executed in a MINGW/Cygwin environment where `git bash` succeeded during initial implementation, but the current Windows test environment does not have a working WSL bash setup. The script itself is syntactically correct β€” the failure is environmental.
**Recommendation:** Add a native PowerShell fallback in `init.sh` so the test runner works on Windows without WSL/Cygwin.
---
## 2. Code-Level Findings
### CRITICAL
| # | File | Line | Issue | Severity |
|---|------|------|-------|----------|
| C1 | `backend/app/api/v1/endpoints/teacher.py` | 559 | **BUG: `present_count` always equals `total_records`** β€” `sum(1 for a in att_history if a.checkout_time is None or True)` β€” the `or True` makes the condition always True. Every attendance record, even absent or checkout records, counts as "present". The student profile modal will always show 100% attendance rate. | CRITICAL |
### HIGH
| # | File | Line | Issue | Severity |
|---|------|------|-------|----------|
| H1 | `backend/.env` | β€” | JWT_SECRET_KEY = `change_me_in_production` β€” hardcoded default secret in plaintext in a tracked file | HIGH |
| H2 | `backend/alembic/versions/016_*.py` | β€” | Migration 016 drops and recreates `teacher_sections` table with no data migration β€” **all existing assignments are permanently lost** on upgrade | HIGH |
| H3 | `backend/app/models/enrollment.py` | β€” | Unique constraint `uq_student_section` is on `(student_id, account_id)` β€” misleading name suggests `(student_id, section_id)`. Also prevents a student from being enrolled in multiple sections simultaneously even if school allows it | HIGH |
| H4 | `backend/app/api/v1/endpoints/teacher.py` | 559 | `absent_count` is hardcoded to 0 (`...if False else 0`). Absent counting is disabled | HIGH |
### MEDIUM
| # | File | Line | Issue | Severity |
|---|------|------|-------|----------|
| M1 | `frontend/src/components/ScheduleModal.tsx` | β€” | Schedule grid renders all 7 days (Mon-Sun) even though Venezuelan schools operate Mon-Fri. Seed only creates Mon-Fri schedules. Sat/Sun rows are confusing clutter | MEDIUM |
| M2 | `frontend/src/pages/PublicCheckInPage.tsx` | β€” | Camera starts automatically in facial mode but there's no graceful handling if camera permission was previously denied. User sees a black/empty video element | MEDIUM |
| M3 | `backend/app/api/v1/endpoints/attendances.py` | β€” | The `action` column uses a hybrid approach β€” new records use `action="in"/"out"`, old records use `action IS NULL` with `checkout_time`. Multiple code paths check 3 different states. High maintenance burden | MEDIUM |
| M4 | `frontend/src/pages/UsersPage.tsx` | β€” | No loading spinner/indicator during API calls. User may think the page is unresponsive during bulk upload or save operations | MEDIUM |
| M5 | `backend/app/api/v1/endpoints/teacher.py` | 559 | `absent_count` logic is commented out/dead (`if False else 0`), but the variable is still returned in the response | MEDIUM |
### LOW
| # | File | Line | Issue | Severity |
|---|------|------|-------|----------|
| L1 | `backend/app/api/v1/endpoints/teacher.py` | 114-115 | `GET /teacher/subjects` still references indirect access via `SectionSubject` even though the new architecture removed this path | LOW |
| L2 | `backend/app/api/v1/endpoints/teacher.py` | 636-646 | `GET /teacher/schedule` still includes indirect `TeacherSubject`+`SectionSubject` path for schedule visibility (not access). Should be reviewed for consistency | LOW |
| L3 | `backend/seed_comprehensive.py` | β€” | Seed uses `sec_defs` with subject codes but some codes (`MAT-05`, `FIS-01`) imply numbering that doesn't match the 15 subjects created. `MAT-05` and `MAT-01` are treated as separate subjects | LOW |
| L4 | β€” | β€” | `CHECKPOINTS.md` does not exist β€” protocol mandates it for Reviewer gatekeeping | LOW |
| L5 | β€” | β€” | `docs/architecture.md` and `docs/conventions.md` do not exist β€” protocol references them but they're missing | LOW |
---
## 3. Test Coverage Assessment
| Component | Test Files | Coverage |
|-----------|-----------|----------|
| `init.sh` (infra script) | `tests/test_basic.py`, `tests/validate_init.sh` | Basic validation |
| Backend API endpoints | None | **0%** β€” no API tests |
| Backend models/schemas | None | **0%** β€” no model tests |
| Backend security/auth | None | **0%** β€” no auth tests |
| Backend business logic | None | **0%** β€” no attendance logic tests |
| Frontend components | None | **0%** β€” no component tests |
| Frontend API integration | None | **0%** β€” no integration tests |
| CSV import/export | None | **0%** |
| Facial recognition | None | **0%** |
| Card template design/generation | None | **0%** |
**Overall test coverage: <1%** β€” only the init.sh validation script has tests.
---
## 4. Environment & Build Assessment
| Check | Result |
|-------|--------|
| `./init.sh` execution | FAILED β€” WSL bash not available on current host |
| Docker compose build | Not tested |
| Alembic migrations | 16 applied, migration 016 is destructive |
| Dependencies declared | All present in requirements.txt / package.json |
| TypeScript compilation | Not tested (no `npm run build` verification) |
| Linting | Not configured (no eslint config found, lint script reference in package.json only) |
---
## 5. Security Audit
| Issue | Severity |
|-------|----------|
| JWT secret hardcoded in tracked .env file | HIGH |
| No rate limiting on `/auth/login` | MEDIUM |
| No password strength validation | MEDIUM |
| No refresh token mechanism (60 min timeout, silent logout) | MEDIUM |
| No brute-force protection on login | MEDIUM |
| No HTTPS in development (HTTP only) | LOW (dev only) |
| No input sanitization on card_id (freeform string(50)) | LOW |
---
## Checklist Verification
- [ ] `./init.sh` passes (FAILED β€” environmental)
- [ ] All acceptance criteria for F000 met
- [x] No code injection vectors found
- [x] RBAC properly enforced on all endpoints
- [x] Multi-tenant isolation via account_id on all queries
- [ ] All attendance edge cases handled (FAILED β€” see C1, M3)
- [ ] Camera/permission errors gracefully handled (FAILED β€” see M2)
- [x] Fabric.js card designer functional
- [x] CSV bulk import/export functional
- [ ] Complete test coverage (FAILED β€” <1%)