talos-access / progress /history.md
Greg
Preparar despliegue en fly.io: monolito dockerizado + seeder demo
6aa6081
|
Raw History Blame Contribute Delete
9.46 kB
# Current Session β€” Implementer Build
**Active Feature:** F000 β€” infrastructure_automation_script
**Status:** ready_for_review
**Controller:** Implementer
## Implementation Plan
1. Write `init.sh` β€” cross-platform initialization/test runner with OS detection, dependency validation, test discovery, and correct exit codes
2. Create `tests/` directory with baseline verification tests (pytest-style and standalone)
3. Run `./init.sh` (via PowerShell/Bash) and refactor until green
4. Update `feature_list.json` status and hand off to Reviewer
## Execution Log
- **2026-05-28** β€” Initialized implementation. Context read: AGENTS.md, feature_list.json, quickstart.ps1, backend tests.
- **2026-05-28** β€” Wrote init.sh and test files.
- **2026-05-28** β€” Verification: `init.sh` executed via Git Bash. All tests PASSED (exit 0).
- OS detection: detected "windows" (MINGW)
- Python: 3.12.4, Node: v23.3.0, Docker: 27.0.3
- Tests run: `__init__.py`, `test_basic.py`, `validate_init.sh` β€” all passed
- Exit code: 0
## Artifacts Created
- `init.sh` β€” Cross-platform initialization & test runner script
- `tests/__init__.py` β€” Package marker
- `tests/test_basic.py` β€” Validates init.sh existence and structure
- `tests/validate_init.sh` β€” Validates init.sh shebang, syntax, and readability
## Handoff
Ready for **Reviewer** gatekeeping per AGENTS.md protocol.
--- End of Session ---
# Current Session β€” Advisor & Reviewer Co-Audit
**Status:** completed β€” REMEDIATION_REQUIRED
**Controller:** Advisor + Reviewer
**Scope:** Full project audit β€” all 18 pages, 18 services, 16 backend endpoint groups, 15 models, 16 migrations, Docker setup, auth/RBAC, business rules
**Audit method:** Source code review + init.sh execution + business logic analysis
## Findings Summary
- **Critical bugs:** 2 (present_count, absent_count disabled)
- **Security:** 1 (JWT secret hardcoded)
- **Domain gaps:** 25+ across 9 categories
- **Missing docs:** CHECKPOINTS.md, docs/architecture.md, docs/conventions.md
- **Test coverage:** <1%
## Remediation Plan
See `progress/sprint_plan.md` for phased roadmap (9 features: F001-F009).
--- End of Session ---
# Current Session β€” MVP Day-Sprint
**Status:** completed βœ…
**Controller:** Leader (executed directly)
**Duration:** 2026-05-28 (single day-sprint)
## Completed
- **F001**: Fixed `present_count` bug (`teacher.py:559`) β€” removed `or True`
- **F002**: Re-enabled `absent_count` logic (`teacher.py:560`) β€” removed `if False`
- **F003**: Rotated JWT_SECRET_KEY to generated value; updated `.env.example` with production warning
- **F004**: Built "Mis Hijos" page β€” backend endpoint `GET /representative/children` + frontend page with attendance cards, schedule, and status indicators
- **F005**: Fixed enrollment unique constraint from `(student_id, account_id)` to `(section_id, student_id)` β€” migration 017 applied, multi-section enrollment works
## Files Changed
| File | Change |
|------|--------|
| `backend/app/api/v1/endpoints/teacher.py:559-560` | Fixed present_count/absent_count logic |
| `backend/.env` | JWT secret rotated to generated value |
| `backend/.env.example` | Added production warning comment |
| `backend/app/api/v1/endpoints/representative.py` | **NEW** β€” representative children endpoint |
| `backend/app/api/v1/router.py` | Added representative router |
| `frontend/src/pages/RepresentativeChildrenPage.tsx` | **NEW** β€” Mis Hijos page |
| `frontend/src/services/representativeService.ts` | **NEW** β€” API service |
| `frontend/src/App.tsx` | Added `/mis-hijos` route |
| `frontend/src/components/Sidebar.tsx` | Added "Mis Hijos" nav item |
| `backend/app/models/enrollment.py` | Changed unique constraint columns |
| `backend/alembic/versions/33cb4ee027ee_*.py` | **NEW** β€” enrollment constraint migration |
## Deferred to Post-MVP
- F006: Holiday calendar + schedule grid improvements
- F006.1: Section capacity enforcement
- F007: Audit log viewer + password reset
- F008: Admin/obrero workflows + late analytics
- F009: CHECKPOINTS.md + docs + test coverage
--- End of Session ---
# Current Session β€” Post-MVP Sprint (F006β€”F009)
**Status:** completed βœ…
**Controller:** Leader (direct execution)
**Duration:** 2026-05-28
## Completed
- **F006 β€” School Calendar & Holidays:**
- `ScheduleModal.tsx`: weekend toggle (mostrar/ocultar fin de semana), dynamic grid
- `Holiday` model + migration `019_create_holidays_table.py`
- `POST/GET /settings/holidays` CRUD (admin-only, 409 on duplicate date)
- `is_holiday()` blocks attendance creation in 4 endpoint files (attendances, teacher, facial, settings)
- `HolidaysPage.tsx` frontend with year filter, route `/dashboard/holidays`
- **F006.1 β€” Section Capacity Enforcement:**
- `_section_at_capacity()` helper + enforcement on `POST/PUT /enrollments` and bulk
- **F007 β€” Audit Log & Password Reset:**
- `User` model: `must_change_password`, `password_reset_token`, `password_reset_expires` columns + migration `018`
- `POST /auth/admin-reset-password/{user_id}` (admin generates token) + `POST /auth/reset-password` (public redeem)
- Login response includes `must_change_password` flag
- `ResetPasswordPage.tsx` public route
- Users page: "Reset Password" button + token modal with copy-to-clipboard
- `GET /audit-logs` paginated + filterable
- `AuditLogsPage.tsx` with filters and expandable JSON details
- **F008 β€” Role Workflows & Late Analytics:**
- Sidebar: administrativo gets access to Usuarios, Secciones, MatrΓ­culas, Reportes. "Tardanzas" added for admin/administrativo/teacher
- `GET /reports/late-arrivals` β€” SQL CASE-based late/early counts
- `GET /reports/students` β€” monthly student summary
- `LateArrivalsPage.tsx` with date range filter and visual bars
- **F009 β€” Documentation & Tests:**
- `CHECKPOINTS.md` with full feature verification checklist
- `docs/architecture.md` β€” system layers, data flow, key patterns
- `docs/conventions.md` β€” code style, project structure, migrations
- `tests/conftest.py` + `tests/test_business.py` β€” 12 tests covering holiday isolation, section capacity, attendance counting, password validation
## Key Decisions
- Password reset without email: admin-generated `secrets.token_urlsafe(32)` token shown on-screen
- Holiday blocking at endpoint level via `is_holiday()` utility
- Late analytics via `LIKE` on `note` column using `RETRASO:`/`SALIDA TEMPRANA:` prefix convention
- `must_change_password` stored as `String(1)` with `"0"`/`"1"` to match existing `is_active` convention
## Files Changed
| File | Change |
|------|--------|
| `backend/app/models/user.py` | Added password reset fields |
| `backend/app/models/holiday.py` | **NEW** β€” Holiday model |
| `backend/app/utils/holiday_check.py` | **NEW** β€” `is_holiday()` utility |
| `backend/app/api/v1/endpoints/auth.py` | Added admin-reset-password + reset-password |
| `backend/app/api/v1/endpoints/settings.py` | Holiday CRUD endpoints |
| `backend/app/api/v1/endpoints/enrollments.py` | Capacity check |
| `backend/app/api/v1/endpoints/audit_logs.py` | **NEW** β€” audit log viewer |
| `backend/app/api/v1/endpoints/reports.py` | Late arrivals + student reports |
| `backend/app/api/v1/endpoints/attendances.py` | Holiday block |
| `backend/app/api/v1/endpoints/teacher.py` | Holiday block |
| `backend/app/api/v1/endpoints/facial.py` | Holiday block |
| `backend/alembic/versions/018_add_password_reset_fields.py` | **NEW** |
| `backend/alembic/versions/019_create_holidays_table.py` | **NEW** |
| `frontend/src/components/ScheduleModal.tsx` | Weekend toggle |
| `frontend/src/pages/ResetPasswordPage.tsx` | **NEW** |
| `frontend/src/pages/HolidaysPage.tsx` | **NEW** |
| `frontend/src/pages/AuditLogsPage.tsx` | **NEW** |
| `frontend/src/pages/LateArrivalsPage.tsx` | **NEW** |
| `frontend/src/pages/UsersPage.tsx` | Reset password button + token modal |
| `frontend/src/components/Sidebar.tsx` | New nav items |
| `frontend/src/App.tsx` | New routes |
| `frontend/src/services/authService.ts` | Admin reset password + change password |
| `tests/conftest.py` | In-memory SQLite fixtures |
| `tests/test_business.py` | **NEW** β€” 12 business logic tests |
| `CHECKPOINTS.md` | **NEW** |
| `docs/architecture.md` | **NEW** |
| `docs/conventions.md` | **NEW** |
--- End of Session ---
# Current Session β€” Advisor Post-MVP Validation
**Status:** completed βœ…
**Controller:** Advisor
**Date:** 2026-05-28
## Scope
Post-implementation domain audit verifying F001-F005 fixes.
## Verification Results
- **Tests:** `pytest tests/` β€” 2/2 passed βœ…
- **F001 (present_count):** Confirmed fixed β€” `or True` removed, correct logic βœ…
- **F002 (absent_count):** Confirmed fixed β€” re-enabled as `total - present_count` βœ…
- **F003 (JWT secret):** Confirmed rotated β€” generated hex key in `.env`, placeholder in `.env.example` βœ…
- **F004 (Mis Hijos):** Backend endpoint + frontend page exist and match patterns βœ…
- **F005 (enrollment constraint):** Changed to `(section_id, student_id)` with migration 017 βœ…
## Verdict
**DOMAIN_VALIDATED** β€” All Phase 1 critical business logic issues resolved. System ready for production deployment of F001-F005 scope.
## Remaining
- F006, F006.1, F007, F008, F009 β€” pending in feature_list.json for next sprint
--- End of Session ---