Spaces:
Sleeping
Sleeping
|
Download SYSTEM_VERIFICATION.md from refaelz/legacy-code-challenge-v2: direct link, hf CLI and curl.
- Browser
- Download file 14.8 kB
-
https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/SYSTEM_VERIFICATION.md
- Command line
-
hf download hf://spaces/refaelz/legacy-code-challenge-v2/SYSTEM_VERIFICATION.md
-
curl -L -o SYSTEM_VERIFICATION.md https://huggingface.co/spaces/refaelz/legacy-code-challenge-v2/resolve/main/SYSTEM_VERIFICATION.md
14.8 kB
| # System Verification Plan | |
| ## Executed Audit: 2026-11-16 | |
| - Windows / Python 3.14: 98 tests and 15 subtests passed. | |
| - Disposable production image / Linux / Python 3.11 / non-root user: the same | |
| 98 tests and 15 subtests passed. No local secrets were passed to the container. | |
| - React / jsdom: 16 tests passed. TypeScript and Vite production build passed. | |
| - Added 8 Python tests and 3 React tests, including their parameterized scenarios. | |
| - Docker production build passed. A separate disposable server returned HTTP 200 | |
| for `/health`, `/`, and `/api/config` on host port 7861. | |
| - Real browser with synthetic API responses: Monaco loaded; an actual editor edit | |
| reached the test request; Enter sent and Shift+Enter inserted a newline; hint | |
| confirmation and free thanks worked; public results and consumed hints appeared | |
| after submission. | |
| - Browser layout: active challenge checked at window widths 320, 390, and 1440; | |
| document width did not exceed the actual client area, including Windows scrollbars. | |
| Results were also inspected at desktop and mobile widths with screenshots. | |
| ### Reproduced and Repaired | |
| 1. Existing timestamp-based bytecode could override same-size/same-mtime student | |
| edits. Test subprocesses now use a fresh, unwritten bytecode cache prefix. | |
| 2. Progress JSON serialization errors escaped the cloud adapter. They now return | |
| safe diagnostics without contacting the network. | |
| 3. Generic free follow-up questions could be mistaken for paid hint consent. | |
| Consent detection now requires hint context in both the API and hint graph. | |
| 4. Model exception text was exposed in chat. Users now receive a generic failure | |
| message without a hint charge; logs contain only the exception class. | |
| 5. Active-challenge controls widened mobile pages. Grid tracks and action wrapping | |
| now constrain the layout; the fixed body minimum no longer causes scrollbar overflow. | |
| The audit does not certify live OAuth providers, live Supabase permissions/schema, | |
| paid model-generated challenge quality, or multi-worker deployment. The existing | |
| working API process is not restarted by this audit to avoid losing an active | |
| in-memory session; backend changes require a planned restart before use. | |
| ## Implementation Verification: 2026-11-17 | |
| - Shared rounds enforce one instructor-set 0–100 chat-message cap per student | |
| (default 5), stored with and frozen for the round. Automatic grading is not gated | |
| by a separate LLM-unit cap. The official score blends 90% deterministic tests and | |
| 10% LLM grade when a model key is available. | |
| - Shared rounds now follow `prepared` -> `open` -> `closed`; publication stores the | |
| publisher and configured course ID. Admission is designed to serialize against | |
| close through service-only PostgreSQL RPCs. Re-publishing the | |
| same workspace in a session returns its existing round code without creating a | |
| second snapshot or storage upload; a new workspace gets a new code. | |
| - Roles are resolved server-side from `COURSE_INSTRUCTOR_IDENTITIES` entries in | |
| `provider:subject` form. HF and Google OAuth authenticate identities without an | |
| organization/email membership gate; students still need an open round code to join. | |
| Course challenge authoring is restricted to `COURSE_APPROVED_REPOSITORIES`. | |
| - Student history returns explicit summary DTOs, filters by provider, subject, and | |
| configured course ID, and omits raw payloads. Local unfinished attempts can be | |
| resumed only while their workspace remains on the current server. | |
| - Python 3.14 application regression set: 136 passed, 20 subtests passed. The run | |
| included API, scoring, runtime, events, quota, history, and round adapters. | |
| - React/jsdom: 22 passed. TypeScript and Vite production build passed. | |
| - Browser smoke with synthetic API responses: instructor dashboard rendered a course | |
| round and participant, the approved repository was selected, and opening the round | |
| changed the available action to **Close round**. At a 1014px desktop viewport the | |
| document measured 999px; at 390px mobile it measured 375px, with no horizontal | |
| overflow. No live API, OAuth, Supabase, or model was used. | |
| - Editor diagnostics reported no errors in the touched Python and TypeScript files. | |
| - Docker production build passed. The image reported Python 3.11.18 and uid 1000; | |
| `/health` and `/api/config` returned successfully from a disposable container. | |
| - The same Python regression set passed inside the rebuilt image as non-root: | |
| 136 passed, 20 subtests passed. | |
| - PostgreSQL 16 applied `supabase_schema.sql` twice without errors in a disposable | |
| container. Transactional RPC smoke checks passed for the legacy quota-reservation | |
| RPC, idempotent score-review claim/completion, round open/close, and rejection of | |
| admission after close. The instructor-facing chat-message cap accepts 0–100 and | |
| rejects 101; score-review claims do not reserve or check round LLM units. The | |
| database used local stubs for Supabase roles and `storage.buckets`; it does not | |
| verify permissions in the user's live project. | |
| - The user confirmed an earlier SQL revision completed successfully in Supabase. | |
| The one-limit revision is verified against disposable PostgreSQL but has not been | |
| rerun in the live project. This session has no Supabase settings to inspect it. | |
| ### Remaining Deployment Checks | |
| - Rerun the latest `supabase_schema.sql` in the intended project to install the | |
| message-cap and score-review RPC updates and confirm the tables, `course_id` | |
| columns, and service-only RPC grants are visible. Existing rows default to | |
| `course_id='local'`; backfill only after identifying their actual course owner. | |
| - Configure `COURSE_ID`, `COURSE_INSTRUCTOR_IDENTITIES`, and | |
| `COURSE_APPROVED_REPOSITORIES` as server-side settings. | |
| Never put role grants or storage secrets in the frontend. | |
| - Verify Supabase RPC signatures, score-review idempotency, round close races, | |
| private storage access, and history filters in a disposable Supabase project. | |
| - Verify HF and Google OAuth callbacks in the intended deployment; mocked OAuth | |
| fixtures do not certify provider configuration. | |
| - Local resume is not a durable cloud workspace restore after a server restart; only | |
| attempts whose local artifacts remain available are resumable. | |
| ## Scope and Rules | |
| Exercise the React/FastAPI application, generated test runners, and storage adapters. | |
| Keep student workspaces and credentials untouched. Use temporary workspaces, synthetic | |
| identities, deterministic model responses, and mocked external APIs. Never count a | |
| mocked OAuth or Supabase call as a live-provider verification. | |
| ## Feature Acceptance Matrix | |
| | Area | Acceptance criteria and simulations | Automated coverage | | |
| | --- | --- | --- | | |
| | Authentication | Anonymous and expired sessions rejected; development login disabled in deployment; verified OAuth identity required | `backend/test_api.py` | | |
| | OAuth | State/cookie binding, invalid state, provider failures, HF/Google sign-in without course membership allowlists, local callback hostname consistency | `backend/test_api.py` | | |
| | Shared-round invitation | Any verified HF/Google identity can join an open same-course round by code; closed rounds reject admission | `backend/test_api.py` | | |
| | Authorization | Foreign origins, private files, path traversal, cross-session jobs and completed submissions rejected | `backend/test_api.py`, `test_challenge_runtime.py` | | |
| | Challenge creation | Unique workspace, initial checkpoint before scoring, timer and options passed through, generation failure releases operation | `backend/test_api.py`, `test_challenge_runtime.py` | | |
| | Generation and diagnosis | Literal-only generated arguments, changed functions, detectable bugs, refactored solution reconstruction without changing student code | `test_saboteur_generated_test_validation.py`, `backend/test_api.py` | | |
| | Shared rounds | Durable publish failure, join isolation, artifact hashes, archive restoration across different roots, unchanged source template | `test_challenge_runtime.py`, `test_supabase_challenge_rounds.py`, `backend/test_api.py` | | |
| | Chat limit | One instructor-selected 0–100 message cap per student (default 5); no separate LLM-unit cap blocks automatic grading | `test_supabase_challenge_rounds.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Round lifecycle | Prepared/open/closed transitions, publisher authorization, course-scoped admission, no join after close | `test_supabase_challenge_rounds.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Roles and authoring | Exact provider/subject instructor allowlist, invite-code student admission, approved-repository validation | `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Student history | Owner/course-filtered summaries, secret payload redaction, local unfinished-attempt resume | `test_supabase_history.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Instructor activity | Course-scoped round and participant summaries; sensitive payloads removed; managed open/close controls | `test_supabase_history.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Editing | Save and reset target, block hidden artifacts, preserve unsaved edits when navigation is cancelled | `test_challenge_runtime.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Test execution | Execute saved student copy, public and secret fail/fix/revert, ignore stale same-size/same-mtime bytecode, structured results, timeout and output limits | `test_scoring_security.py`, `test_challenge_runtime.py` | | |
| | Scoring | Test-based score independent of LLM advice, penalties cumulative, wrong-location behavior, secret details not exposed | `test_scoring_fairness.py`, `backend/test_api.py` | | |
| | Hints | Fresh explicit consent per hint, withhold unapproved content, Hebrew/English replies, courtesy and decline never charged, cap enforced | `backend/test_api.py` | | |
| | Hint failures | Free questions cannot create paid consent; model failure does not charge or disclose provider error details | `backend/test_api.py` | | |
| | Chat UI | Enter sends once, Shift+Enter newline, empty and duplicate busy sends blocked, history and confirmation restored | `frontend/src/App.test.tsx` | | |
| | Progress | Checkpoint at creation and after completed chat, save/reset, tests, submission and reflection; no keys/cookies in snapshot | `backend/test_api.py` | | |
| | Cloud failure | Local checkpoint survives failure; next update retries full state; safe timeout/encoding diagnostics; warning displayed | `test_supabase_submissions_logger.py`, `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Events | Typed privacy-minimized records, concurrent appends form valid complete JSONL records | `test_event_log.py` | | |
| | Final submission | Immutable saved code and self-assessment; overlapping submissions cannot overwrite code; all mutations locked after completion | `backend/test_api.py` | | |
| | Results | Public output only, consumed hint contents beside score, restored result, legacy missing-history state | `frontend/src/App.test.tsx`, `backend/test_api.py` | | |
| | Reflection | One reflection attached to the correct immutable submission, second reflection rejected | `backend/test_api.py`, `frontend/src/App.test.tsx` | | |
| | Runtime | Frontend typecheck/build; production Docker image; Python 3.11 container checks | Release commands below | | |
| ## Audit Ownership | |
| Five independent review perspectives cover identity/security, runtime/scoring, | |
| conversational state, storage/reliability, and frontend workflows. Implementation-capable | |
| agents add disjoint test changes. The coordinating agent reproduces proposed defects, | |
| repairs production code, reruns the failing check first, and combines the final results. | |
| Read-only review suggestions are not recorded as executed tests. | |
| ## Release Commands | |
| Run the application tests explicitly so vendored challenge repositories are not | |
| accidentally collected as application regression tests: | |
| ```powershell | |
| py -3.14 -m pytest -q backend/test_api.py test_challenge_runtime.py test_supabase_submissions_logger.py test_supabase_challenge_rounds.py test_supabase_course_access.py test_event_log.py test_scoring_security.py test_scoring_fairness.py test_saboteur_generated_test_validation.py test_google_sheets_logger.py test_orchestrator.py test_refactored_saboteur.py | |
| npm --prefix frontend test | |
| npm --prefix frontend run build | |
| docker build -t legacy-interview-verify . | |
| ``` | |
| The legacy `test_refactored_saboteur.py` contains live-LLM exercises and skips them by | |
| default. They never replace `OPENAI_API_KEY` during import. To run them, set | |
| `RUN_LIVE_LLM_TESTS=1` and provide a valid key explicitly; these tests may incur cost. | |
| ## Browser Scenarios | |
| Use a new browser page with intercepted `/api/` responses and synthetic challenge data. | |
| Verify editor/brief rendering, Enter versus Shift+Enter, pending hint confirmation, | |
| no duplicate request while busy, final hint summary, refresh recovery, and a narrow | |
| mobile viewport. Report separately from real OAuth, model, or Supabase validation. | |
| The executed browser audit used a page-local fetch override after the browser tool's | |
| route interception stalled. Editor changes and UI interactions were real; API responses | |
| were synthetic. The test page must be closed afterward so it cannot be confused with | |
| the real application. Refresh recovery is covered by the React regression suite. | |
| ## Required Live Checks Before Deployment | |
| - Run the updated `supabase_schema.sql` in the intended project. Verify | |
| `challenge_attempts`, `submissions`, `challenge_rounds`, private bucket permissions, | |
| and server-only grants. No live schema change is performed by unit tests. | |
| - Start a test challenge and confirm its cloud row exists before submission. Send | |
| chat and a confirmed hint, save an edit, run public tests, submit, and reflect; | |
| inspect that the same attempt updates and the final submission stays immutable. | |
| - Complete Hugging Face login with one allowed and one disallowed course account. | |
| If Google is enabled, repeat with verified allowed and disallowed emails. | |
| - Generate representative challenges with and without refactoring and multiple bugs | |
| using a controlled model budget. Deterministic fixtures cannot certify LLM quality. | |
| - Confirm secrets are supplied only by the server's environment/Secrets. Never | |
| print them or ship local environment files in the Docker context. | |
| ## Known Boundaries | |
| Checkpoints preserve data but do not automatically restore login sessions after a | |
| server restart. Unsaved editor keystrokes are not checkpointed. Cloud retry happens | |
| on the next checkpoint, not while idle. Locks and event logging are process-local; | |
| multi-worker coordination and stronger hostile-code sandboxing require separate work. | |
| Passing these checks reduces regression risk; it is not a guarantee of zero defects. |