Spaces:
Runtime error
Runtime error
Commit History
-
feat(ta-01): backend-proxy photo URLs so they stop expiring
Greg +1: Claude Opus 4.7 (1M context)Frontend now receives stable /api/v1/photos/{account_id}/{user_id}/{filename} URLs for face photos, regardless of which storage backend is active. The serve_photo endpoint authenticates against our own JWT and streams the bytes from disk (local) or Supabase (S3 via boto3.get_object). Browser caches the response privately for 5 minutes so re-renders don't hit the backend. This eliminates the 10-min signed-URL expiry pain — the URL never changes and never goes stale. Same behavior on the local-disk dev backend and on Supabase in prod. - PhotoStorage Protocol gains fetch_bytes(path) -> (bytes, content_type). - Implemented on all three adapters (Local, InMemory, Supabase). - serve_photo routes through the protocol; per-backend logic moves there. - users.py response mapping and the upload endpoint return the proxied URL instead of storage.get_url() so legacy signed URLs are gone. Tests: 22 passed (storage + photo upload), no regressions. Co-Authored-By: Claude Opus 4.7 (1M context) <n…8ca1e92 -
fix(ta-01): re-protect /photos/_debug with admin RBAC
Greg3263790 -
diag(ta-01): make /photos/_debug public so it's accessible without login
Greg232390f -
diag(ta-01): log resolved photo backend + admin /photos/_debug endpoint
Gregccc4fb4 -
fix(ta-01): treat blank PHOTO_STORAGE_BACKEND as unset (default to local)
Grega1c2d97 -
refactor(ta-01): swap supabase-py for boto3 S3 adapter
Greg +1: Claude Opus 4.7 (1M context)The supabase-py SDK was ~70MB with sub-deps and only used for storage. Switch to boto3 against Supabase's S3-compatible endpoint. Same class name (SupabaseStorage) for adapter-pattern continuity; the constructor now takes access_key/secret_key/endpoint/region and uses presigned URLs via generate_presigned_url for private buckets. Env vars (HF Space Secrets): SUPABASE_ACCESS_KEY_ID (from Dashboard → Project Settings → Storage → S3) SUPABASE_ACCESS_KEY_SECRET SUPABASE_ENDPOINT (e.g. https://<ref>.storage.supabase.co/storage/v1/s3) SUPABASE_REGION (default us-west-2) SUPABASE_PHOTO_BUCKET (default user-photos) Side benefit: vendor-agnostic. The same adapter works against AWS S3, R2, MinIO by changing endpoint and region. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>959bccd -
feat(ta-01): implement SupabaseStorage adapter with signed URLs
Greg +1: Claude Opus 4.7 (1M context)- SupabaseStorage uploads to {account_id}/{user_id}/{uuid}.{ext} inside the configured bucket via supabase-py. get_url() returns a short-lived signed URL (default 10 min TTL) so private buckets stay private. - _strip_url_prefix normalizes inputs so delete() works whether given a relative path or a full Supabase URL (with or without query token). - supabase>=2.0 added to requirements; SDK is lazily imported so the local backend (PHOTO_STORAGE_BACKEND=local) doesn't pay the cost. - AuthImage now passes http(s):// URLs through directly (Supabase signed URLs are already authenticated via the token query param). - Tests updated to cover credential check, prefix stripping for relative paths and signed URLs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ea91fea -
fix(ta-01): install libmagic1 in HF Dockerfile so python-magic loads
Greg5e480e2 -
Merge pull request #3 from Yisus32/feat/ta-01
Jesús AltuveUnverified signatureTA-01: photo storage, admin attendance, gate decouple + responsive UIe9ee232 -
chore: remove obsolete .opencode docs and skills
Greg5c95596 -
style(ta-01): icon-only Crear/Carga Masiva buttons on mobile in Materias and Secciones
Greg0b411cb -
style(ta-01): collapse Crear/Carga Masiva buttons to icon-only on mobile
Greg52690e1 -
fix(ta-01): replace mobile topbar with floating hamburger button
Greg +1: Claude Opus 4.7 (1M context)The fixed topbar was overlapping page-level action buttons (Crear, Carga Masiva). Replace it with a small circular FAB anchored top-left that opens the drawer without consuming a full row of vertical space. main-content now reserves left padding on mobile (pl-16) so page content doesn't sit underneath the FAB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>d456a34 -
feat(ta-01): responsive layout with mobile hamburger drawer
Greg +1: Claude Opus 4.7 (1M context)- Mobile topbar (< md) with hamburger button on the left, brand on right - Sidebar slides in from the left as a drawer on mobile; static on md+ - Backdrop overlay closes the drawer on click - Auto-close on route change (useLocation effect) and after tapping a NavLink - Close button (X) inside the sidebar header on mobile - main-content pads for the topbar on mobile (pt-[4.5rem]) and the sidebar offset only applies on md+ (ml-0 md:ml-64) Sidebar receives optional mobileOpen + onClose props so the drawer state lives in Layout. The desktop experience is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>c16d5c1
-
feat(ta-01): switch between front/back camera in CameraCapture
Greg55f0bbf -
revert(ta-01): role stays immutable on edit (per user request)
Greg6360fcb -
feat(ta-01): allow editing sex and role in user create/edit modal
Greg +1: Claude Opus 4.7 (1M context)Frontend (UsersPage): - Sex selector (Sin especificar / Masculino / Femenino) on create and edit. - Role select no longer disabled while editing; changes are diffed and sent in the PUT payload. Backend (schemas/user.py): - UserUpdate gains optional `role` so PUT /users/{id} can change it. - sex was already supported; just wiring it on the client side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>bee4db8 -
feat(ta-01): spinner placeholder in AuthImage while fetching protected photo
Greg05b0bc2 -
fix(ta-01): use AuthImage so JWT-protected photo URLs render
Greg +1: Claude Opus 4.7 (1M context)Browser <img src> tags cannot send our Authorization header, so a direct fetch of /api/v1/photos/... returned 401 and showed the photo broken. AuthImage fetches the URL through our axios instance (which injects the token) and renders the bytes via a blob URL. Pass-through for data: and blob: URLs so freshly captured/picked previews don't need a roundtrip. Applied to the two render sites in UsersPage. CardGeneratorPage still uses raw <img src=...> for canvas drawing; out of scope for this fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>09aa14c -
feat(ta-01): photo upload + camera capture in user create/edit modal
Greg +1: Claude Opus 4.7 (1M context)Frontend (UsersPage): - New uploadUserPhoto / dataUrlToBlob helpers in userService.ts - Both "Capturar foto" (camera) and "Subir foto" (file picker accepting png/jpg/webp ≤5MB) now route through POST /api/v1/users/{id}/photo - Hidden file input wired via ref; live preview from either source - Format/size hint shown under the controls - Removed enrollFace from this flow (still used by FacialPage kiosk) Backend (facial.py enroll_face): Bug introduced by TA-01: face_encodings.photo became VARCHAR(500) but the kiosk enroll endpoint still tried to persist the raw base64 dataURL, which silently broke camera enrollment. Now decodes → processes via photo_pipeline → uploads via PhotoStorage → stores the path. If photo step fails, encoding is still saved (best-effort) so recognition works. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>9b72922 -
fix(ta-01): unify all dashboard chart counts as gate+class (deduped)
Greg +1: Claude Opus 4.7 (1M context)Extract three helpers in dashboard.py: _presence_user_ids_in_range — union of EntranceLog + Attendance "in" _exit_user_ids_in_range — union of EntranceLog.checkout + Attendance "out" _presence_user_ids_by_day — per-day version of presence union Refactor: /stats today_checkins = |present_today| /stats today_checkouts = |exited_today| /stats currently_on_campus = |present_today - exited_today| /attendance-trend per-day count = |union per day| These apply uniformly to admin and teacher roles. A student with both a gate check-in and a classroom mark on the same day counts ONCE per metric; a student marked only via classroom (TA-01 contingency) is now included. Regression tests cover: class-only inclusion, gate+class dedup, currently_on_campus subtraction across both event sources, and per-day trend dedup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1abf246 -
style(ta-01): rename Gate column to Entrada al plantel for clarity
Gregd08ed8b -
style(ta-01): use neutral Spanish (no voseo) in admin attendance copy
Gregf0f89c5 -
feat(ta-01): empty state when no section selected on admin attendance page
Greg8391c19 -
fix(ta-01): dashboard sex-by-section counts class marks without gate log
Greg +1: Claude Opus 4.7 (1M context)The /dashboard/sex-by-section endpoint joined only EntranceLog, so students marked present via teacher/admin classroom attendance with no gate check-in (contingency path enabled by TA-01) were excluded from the chart. Now unions EntranceLog (gate) with Attendance.action='in' (classroom) and dedupes per (section, student). Regression test covers a student present in Attendance with zero EntranceLog rows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a62864b -
style(ta-01): replace symbol+letter with Masculinos/Femeninos in admin counter
Greg34fb973 -
feat(ta-01): show sex breakdown (M/F) in admin attendance counter
Greg +1: Claude Opus 4.7 (1M context)- RosterItem dataclass + AdminRosterItem TS interface gain `sex` field. - AdminAttendancePage counter now shows "(M: N · F: N)" alongside Presentes. - Teacher response unchanged (StudentCardResponse doesn't include sex). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4aadf35 -
fix(ta-01): post-review hardening — traversal guard, dead code, kiosco doc
Greg +1: Claude Opus 4.7 (1M context)- photos.py: resolve()+is_relative_to() guard against path traversal in GET /photos/{account_id}/{user_id}/{filename}. The account scope check alone did not prevent ../-style escape outside LOCAL_PHOTO_ROOT. - teacher.py: remove skipped_ids dead code in submit_swipe and batch_toggle. The lists were declared but never populated after the gate decouple, and the secondary SELECT to resolve student names ran on every swipe for no effect. Response shape unchanged (skipped: list[dict] = [] always). - facial.py: module docstring explaining that the kiosk path does not write Attendance directly; if it ever does, marked_by_role='kiosco' should be set. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>0e087c3 -
feat(ta-01): admin attendance page with /admin-attendance route + sidebar item
Greg +1: Claude Sonnet 4.6Adds AdminAttendancePage (standalone, no extraction — state shapes differ too much between teacher list view and admin roster view). Features: - Section dropdown + date picker (default today, supports back-dating) - Roster table with effective-status logic, pending toggles, amber highlight - Gate chip: neutral gray, informational tooltip, never blocking - Save calls batchToggle then refreshes roster - Toast auto-dismiss, error banner, loading spinner Wired at /dashboard/admin-attendance; sidebar visible to admin role only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>655da53 -
feat(ta-01): add adminAttendanceService client
Greg +1: Claude Sonnet 4.6Covers listSections, getRoster (with optional date), swipe, and batchToggle against /api/v1/admin/* endpoints. Uses the same default axios instance as teacherService so bearer auth is injected automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2c6caad -
feat(ta-01): make gate chip informational in teacher attendance toasts
Greg +1: Claude Sonnet 4.6Replace hard-block language ("no se pudieron marcar porque aún no han ingresado") with softer, informational copy pointing admins to the contingency page. No visual chip exists in TeacherAttendancePage (entrance_logged is not in AttendanceSummaryItem), so only toast text is updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e07ae49 -
feat(ta-01): admin attendance endpoints (sections, roster, swipe, batch-toggle)
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>138c1eb -
feat(ta-01): decouple classroom attendance from gate entrance log
Greg +1: Claude Sonnet 4.6Removes the EntranceLog gate-filter from submit_swipe, batch_toggle, and toggle_attendance so teachers can mark students present even when the gate kiosk is offline (power outage, OpenCV crash, network failure). The entrance_logged flag is preserved as informational in the roster/summary endpoints; no existing tests were broken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>71c3a32 -
test(ta-01): regression test for gate ↔ classroom decouple
Greg +1: Claude Sonnet 4.6Adds three tests that expose (and then verify removal of) the coupling between EntranceLog gate check-in and classroom attendance marking in submit_swipe, batch_toggle, and toggle_attendance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>5bea392 -
refactor(ta-01): route teacher attendance + roster through services/attendance
Greg +1: Claude Sonnet 4.6Routes all three attendance-insert endpoints (submit_swipe, batch_toggle, toggle_attendance) through record_attendance() so marked_by_role and marked_by_user_id are populated. Replaces the inline roster build in section_students with list_section_roster(). Gate filter (entrance_logged_ids skip) preserved intact in all three write endpoints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6a6810e -
feat(ta-01): add attendance service (record_attendance + list_section_roster)
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>238a12d -
chore(ta-01): wire photo storage env vars and local volume
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>22557a9 -
feat(ta-01): map face_encodings.photo path to URL in user responses
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>adcd19e -
feat(ta-01): GET /photos endpoint for local storage backend
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ccb2eb5 -
feat(ta-01): POST /users/{id}/photo endpoint with storage + best-effort face encoding
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d116d3f -
chore(ta-01): pin pytest in requirements so tests run after rebuild
Greg0a530b0 -
fix(ta-01): use libmagic1 apt + python-magic for Linux container
Greg +1: Claude Opus 4.7 (1M context)Previous commit aa308f0 added python-magic-bin which is Windows-only. The backend container is Linux, so we need libmagic1 (apt) plus python-magic (PyPI) bindings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a965311 -
feat(ta-01): add photo_pipeline with WebP compression and validation
Greg +1: Claude Opus 4.7 (1M context)Adds image processing service with: - MIME type validation (PNG, JPEG, WebP only) - EXIF transpose handling - Thumbnail scaling to max 800x800 - WebP conversion with quality 85 - Test suite with 5 comprehensive test cases Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>34ae3e8 -
chore(ta-01): add Pillow and python-magic-bin deps for photo pipeline
Greg +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>aa308f0 -
feat(ta-01): add PhotoStorage abstraction with Local/InMemory/Supabase adapters
Greg +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>9e5f651 -
feat(ta-01): update FaceEncoding and Attendance models for new columns
Greg +1: Claude Opus 4.7 (1M context)- FaceEncoding: add photo column as String(500), make encoding nullable - Attendance: add marked_by_role (String) and marked_by_user_id (BigInteger FK) columns These changes match the schema updates from migration 028. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>f2358b4 -
docs(ta-01): warn about photo data loss; tighten FK ondelete
Gregfa350fe -
feat(ta-01): migration for photo URL column + attendance attribution
Greg9f37e9c -
docs(ta-01): add phased implementation plan
Greg +1: Claude Opus 4.7 (1M context)28 tasks across 7 phases covering migration, storage abstraction, photo pipeline, attendance service extraction, admin endpoints, gate decouple, frontend extraction, and verification. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>f82b4c1 -
docs(ta-01): add sprint spec and design for storage + admin attendance + gate decouple
Greg +1: Claude Opus 4.7 (1M context)Three-block sprint design covering: - Photo storage migration from Base64 in DB to Supabase Storage via PhotoStorage abstraction - Admin attendance view for teacher-absence contingencies, with marked_by_* attribution columns - Decoupling gate EntranceLog from classroom attendance to tolerate technical failures Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>cf2fc7c