Skip to content

Ojas - #99

Open
ojas50 wants to merge 5 commits into
mainfrom
ojas
Open

Ojas#99
ojas50 wants to merge 5 commits into
mainfrom
ojas

Conversation

@ojas50

@ojas50 ojas50 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

new bugs

Clearing the GitHub API cache and exporting the local database only checked that someone was signed in, so a student session got 200 from both. The export handed out analytics_history.db (analysis runs plus the full audit_log: login failures, invite events) and labelled it gsad_users.db.

Both endpoints now use a new _require_staff_api() helper (same contract as _require_admin_api): 401 anonymous, 403 anyone who is not admin/faculty, 200 for staff. The download is named analytics_history.db, the Settings copy says it is the analysis & audit database, and the Data Actions panel is hidden for students so no control is rendered that would 403.

New tests/test_auth.py::TestSettingsDataActionsRBAC (6 tests). Suite: 749 passed / 10 skipped (was 743/10).
summarize_team_events capped Team_Active_Dates with sorted(active_dates)[:90], i.e. the OLDEST 90 days - the opposite of every sibling cap (sorted(days)[-cap:] in sync.py). views._recent_activity takes the streak from max(active_days), so any truncation would collapse every streak to 0. Both app/services.py and the frozen legacy services.py now slice [-90:] to stay in step for the parity harness.

New test: tests/test_services.py::TestTeamActivity::test_active_dates_keep_the_newest_90_days (100 push days -> 90 dates, day 11..day 100), green in default and MODULE_UNDER_TEST=app.services modes.
POST /certificates/queue read request.state.user_row, but that attribute is only assigned inside _base_context (page renders), so a POST handler never has it - every queued certificate was stored with student_id='' and PRN-keyed lookups silently missed the row. The handler now resolves the account row itself when the attribute is missing (_memo(f'user:{email}', auth.get_account)); a token-only session with no users row still queues with an empty PRN instead of failing.

New tests: tests/test_certificates.py::TestQueuedCertificateStoresPrn (2 tests).
GET /api/certificates authorised only student_email while certificates.list_certificates_for_student matches student_email OR student_id, so a student could pass their own address plus another student's PRN and read that student's rejected certificate (admin_notes, verified_by, skills). Non-staff callers are now force-scoped to their own identity: both query parameters are ignored, student_email becomes the session email and student_id comes from the caller's own account row. Admin/faculty lookups are unchanged.

New tests: tests/test_certificates.py::TestCertificateApiScoping (4 tests). Docs cover this batch: Bug Tracker rows for BUG-148/151/155 -> Fixed with proof (123 fixed / 16 open, audit 2026-10-28) and a 'Correctness fixes (2026-10-28)' log in Taskflow. Suite: 756 passed / 10 skipped (was 749/10).
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
student-analytics Ready Ready Preview Oct 28, 2026 5:07pm UTC

This branch was successfully deployed

1 active deployment
Preview — 0bc2c0b5 Deployed Oct 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant