Spaces:
Sleeping
Download README.md from refaelz/legacy-code-challenge-v2: direct link, hf CLI and curl.
- Browser
- Download file 6.01 kB
-
https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/README.md
- Command line
-
hf download hf://spaces/refaelz/legacy-code-challenge-v2/README.md
-
curl -L -o README.md https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/README.md
title: Legacy Code Challenge
emoji: π
colorFrom: red
colorTo: pink
sdk: docker
app_port: 7860
pinned: false
hf_oauth: true
π Legacy Code Challenge
AI-powered educational tool for debugging legacy code. Students receive buggy code from real GitHub repositories and must fix it with AI assistance.
Features
- π Automated bug injection into real codebases
- π€ AI-powered hint system (GPT-4o)
- π§ͺ Automated testing and scoring
- π Optional Google Sheets summaries
- πΎ Complete submission storage in Supabase
How to Use
- Sign in with Hugging Face or Google.
- Join an open shared challenge with its code, or create a private personal challenge from any public GitHub repository. Instructors can also publish and manage shared rounds.
- Debug the injected bugs, run tests, and submit your fix.
Sign-In
Hugging Face sign-in is enabled for deployed Spaces with hf_oauth: true. For local sign-in, create an OAuth app with http://localhost:7860/auth/callback as its redirect URI and set OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, and OAUTH_REDIRECT_BASE_URL=http://localhost:7860 in .env. Google sign-in requires OAuth client credentials and a callback URI. Neither provider requires organization or email membership allowlists to sign in. OAuth establishes identity; it does not grant instructor privileges. Never put OAuth client secrets in frontend code.
Shared Challenge Rounds
Configure SUPABASE_URL and SUPABASE_SECRET_KEY. An authorized instructor selects an approved repository, prepares a challenge, chooses a per-student LLM cap from 0 to 100 units (default 20), and publishes it as a prepared round. The cap is frozen for that round. Repeating Publish for the same workspace returns the same round code; opening the round is a separate action. A student with an authenticated HF or Google identity can use that code while the round is open. The code is a bearer invitation scoped to COURSE_ID; anyone who receives it can join. Each join receives a fresh isolated workspace. The private snapshot and tests are stored in Supabase and checked by hash.
For course deployments, configure COURSE_ID, COURSE_INSTRUCTOR_IDENTITIES, and COURSE_APPROVED_REPOSITORIES as server-side settings. Instructor identities use exact provider:OIDC-subject entries. Keep instructor grants and provider credentials out of the frontend.
In course mode, users can create up to three private personal challenges per database day from any public GitHub repository. Creating a personal challenge does not grant instructor permissions. Approved instructors and course admins can publish shared rounds from any valid public GitHub repository. Students may request instructor access in the app; administrators approve requests in the course access panel, and database-backed grants take effect without restarting the server. COURSE_INSTRUCTOR_IDENTITIES is retained as a legacy/bootstrap administrator list, not the routine way to grant new instructors. Personal challenge execution is not a hardened sandbox for hostile code.
For private shared rounds, the publisher and course administrators can view each student's attempt, including the complete recorded chat, hints, public test runs, submission results, and submitted diff. Students are informed of this visibility. Test-run history is recorded for new attempts; older attempts can show incomplete or unavailable history. Elapsed time is measured from the saved start until submission or last activity, not active working time. Data is available to the dashboard after the attempt checkpoint has synced to Supabase.
Submission and Reflection
Before final submission, students record confidence (1β5) and optional known limitations. A successfully scored submission stores an immutable code snapshot and timestamp, then locks edits, resets, tests, and hints for that challenge. The results screen collects two 1β5 understanding ratings and a short explanation of the core bug; each submission accepts one reflection. Typed lifecycle events are appended to a server-private JSONL file and exclude code, chat text, and personal details. Local development uses per-process file locking; this log is not a cross-worker audit service.
Local Challenge Diagnosis
Only an authenticated instructor sees What to fix and where. The server independently checks the instructor allowlist before returning the target file, affected function, bug description, and focused expected diff; student sessions cannot access the endpoint directly. The diagnosis does not modify the workspace.
Submission Storage
Create a free Supabase project and configure SUPABASE_URL and SUPABASE_SECRET_KEY in Hugging Face Spaces Settings. Follow SUPABASE_SETUP.md for the SQL schema and setup steps.
Scoring
The official score combines the deterministic test score (90%) and, when available, the LLM assessment (10%); hint and deterministic scope penalties are then deducted. Shared rounds have one instructor-set limit: chat messages per student. The server enforces this cap for chat, and no separate LLM-unit limit blocks automatic grading. Score-review claims still enforce ownership, round availability, and idempotency. The complete student diff is included in grading so unrelated additions, including lines inside a bug function, can lower the LLM minimality assessment. Keyless submissions use the test score alone; adding a key later adds the 10% LLM component without replacing the test score. The deterministic scope penalty is two points per unrelated changed/added function, capped at six; helpers called by a bug function are exempt. Generated challenges may also include one or two regression checks that pass on the received code and can catch a fix that breaks existing behavior. The post-submission expected-changes panel shows only the focused diff, not a full reference file.
Google Sheets summaries remain optional. New submissions are no longer uploaded to Git.