Spaces:
Sleeping
Sleeping
|
Download HANDOFF.md from refaelz/legacy-code-challenge-v2: direct link, hf CLI and curl.
- Browser
- Download file 7.09 kB
-
https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/HANDOFF.md
- Command line
-
hf download hf://spaces/refaelz/legacy-code-challenge-v2/HANDOFF.md
-
curl -L -o HANDOFF.md https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/HANDOFF.md
7.09 kB
| # Project Handoff | |
| ## Purpose | |
| Legacy Code Challenge is a React/Vite and FastAPI application for instructors to | |
| prepare debugging exercises from approved public repositories and for students to | |
| join shared rounds, edit a buggy workspace, run tests, request hints, and submit a | |
| fix. Supabase stores round snapshots, progress summaries, submissions, quotas, and | |
| advisory review state. | |
| ## Architecture | |
| - `backend/app.py`: OAuth/session handling, student and instructor authorization, | |
| challenge jobs, round publishing/admission, history, submissions, and usage gates. | |
| - `architect/`: challenge generation, sabotage, repository cloning, and private test | |
| artifacts. | |
| - `challenge_runtime.py`: isolated UUID workspaces and immutable shared-round | |
| snapshots. | |
| - `orchestrator/scoring.py`: subprocess test runner and deterministic evaluation; | |
| optional LLM scoring review is separate. | |
| - `frontend/src/App.tsx`: student editor/results/history and instructor authoring, | |
| round lifecycle, and activity dashboard. | |
| - `supabase_schema.sql`, `supabase_quota.py`, `supabase_history.py`, and | |
| `supabase_challenge_rounds.py`: database schema and server-only Supabase adapters. | |
| ## Access Policy | |
| - HF and Google OAuth authenticate an identity; organization or email membership is | |
| not required for sign-in. Joining requires an authenticated session, a valid round | |
| code, the deployment's `COURSE_ID`, and an open round. | |
| - Instructor authorization is separate and uses exact `provider:OIDC-subject` | |
| memberships in Supabase. Authenticated students can request instructor access; | |
| administrators approve requests in-app and grants apply without a restart. The | |
| legacy `COURSE_INSTRUCTOR_IDENTITIES` allowlist remains as an administrator bootstrap. | |
| A round code never grants instructor permissions. | |
| - Course users can generate private personal challenges from any public GitHub | |
| repository, with a persistent limit of three generations per database day. They | |
| cannot publish or manage shared rounds; shared publication remains allowlisted. | |
| - In course mode, approved instructors and course admins can publish shared rounds | |
| from any valid public GitHub repository. Round publication creates a `prepared` | |
| snapshot that must be opened. | |
| - The challenge solution/diagnosis button is instructor-only in the UI and its API | |
| endpoint also requires the instructor role. Student sessions cannot fetch the diff. | |
| - Each round has one instructor-selected chat-message cap per student (default 5), | |
| selected at publish time and frozen when opened. The server enforces this cap for | |
| chat; automatic grading has no separate LLM-unit limit. Score-review claims still | |
| enforce ownership, round availability, and idempotency. The official score uses | |
| 90% deterministic test results and 10% LLM grade before hint and unrelated-function scope penalties. | |
| Keyless submissions use test results alone; a later-added key adds the LLM component | |
| without replacing the test score. The complete patch is included in LLM review for | |
| line-level minimality assessment. | |
| - Personal API keys are held per in-memory session when no server key is configured. | |
| They are not written to progress/submission records. Jobs capture the key at enqueue. | |
| - Round state transitions compare the requesting instructor identity with the round's | |
| `published_by` identity in the server-only database RPC. Resume also checks the | |
| saved course scope. | |
| - Full challenge metadata and solution-bearing fields live under the server-private | |
| workspace artifact directory. The student-visible state file contains only fields | |
| needed by the editor and challenge brief; this does not isolate code running as the | |
| same operating-system user. | |
| ## History and Sharing | |
| - Each challenge attempt gets a unique UUID workspace. Student history is filtered by | |
| provider, subject, and course and returns summaries, not raw payloads. | |
| - The same session/workspace returns its existing published round ID on repeat Publish; | |
| the cap and snapshot are reused too. A different workspace creates a different round. | |
| The published snapshot is immutable. Cross-worker concurrent publishing is not yet | |
| protected by a database uniqueness claim. | |
| - Local resume requires the workspace and private progress files to still exist on the | |
| current server. Cloud progress metadata does not yet recreate a workspace after a | |
| server restart or on another replica. Loading/resuming a different attempt clears | |
| stale test results, test-source viewers, hints, and diffs from the prior challenge. | |
| ## Configuration | |
| Set these as server-side Space variables/secrets, not frontend values: | |
| - `COURSE_ID`: stable course/deployment scope. | |
| - `COURSE_INSTRUCTOR_IDENTITIES`: comma-separated `provider:OIDC-subject` grants; keep | |
| private. | |
| - `COURSE_APPROVED_REPOSITORIES`: comma-separated canonical GitHub URLs. | |
| - `OAUTH_CLIENT_ID` / `OAUTH_CLIENT_SECRET` for HF OAuth, and Google OAuth client | |
| credentials if Google sign-in is enabled. | |
| - `SUPABASE_URL` / `SUPABASE_SECRET_KEY` for persistent rounds, history, and quotas. | |
| - Server LLM provider key, if students should not enter their own per-session key. | |
| The local `.env` is intentionally not documented here; never print or commit it. | |
| ## Verification | |
| Latest one-limit checks: 186 Python tests passed and 4 opt-in live-LLM tests skipped; | |
| 32 React tests, the TypeScript/Vite build, Docker build, Render Blueprint parse, and | |
| SQL migration/rerun plus request, approval, role, and quota smoke tests on local | |
| PostgreSQL 16 passed. An earlier schema revision was applied to live Supabase; the | |
| one-limit SQL revision still needs to be applied and was not queried directly here. | |
| The latest code changes have not been deployed. | |
| Local | |
| public config reports `course_mode=false`, HF and Google OAuth enabled, and dev login | |
| disabled; no identity or secret values are stored in this handoff. The local FastAPI | |
| server is served at `http://localhost:7860/`; Vite is at `http://127.0.0.1:5174/`. | |
| ## Known Gaps | |
| - Round publish idempotency is cached in the session/private progress; cross-worker | |
| concurrent publishes are not protected by a database uniqueness claim. | |
| - Workspace resume is local-only; long-term cloud restoration is not implemented. | |
| - Test code runs in a separate constrained process, but stronger hostile-code | |
| sandboxing is still deferred. | |
| - Student code and private artifacts are still not isolated by an OS/container sandbox; | |
| filesystem redaction reduces accidental exposure but is not a hostile-code boundary. | |
| - Personal challenge generation retains its separate daily course limit. Shared-round | |
| chat and grading do not use a second LLM-unit cap. | |
| ## Working Conventions | |
| - Run Python tests with `py -3.14 -m pytest` and frontend tests with `npm --prefix | |
| frontend test`; build with `npm --prefix frontend run build`. | |
| - Do not read `.env` values. Do not deploy, push, or commit without an explicit request. | |
| - For future requirement changes, the user prefers multiple independent engineering | |
| reviews before implementation, followed by focused tests and end-to-end student and | |
| instructor simulations. |