Bỏ qua, tới nội dung chính

Kiến trúc · ADR 0062

ZIP projects run their test cases, hidden ones counted only

Trạng thái
accepted
Ngày
2026-11-25
Người quyết định
SmartLearn team (issue #202)

Context

A ZIP project submission never ran a test. The api enqueued spec.testCases: [] (C# too), and the worker merges the job spec over the question's code spec, so the empty list hid the project's real suite. An AUTOMATED_TEST rubric criterion was then scored by the AI evidence engines, and at finalize calculateRubricEvaluation computed it from an empty result list. Single CODE questions already run their cases through the sandbox runners.

Decision

  • The api sends the whole suite, public and hidden, on submit and on regrade of a ZIP project (MANUAL_RUBRIC): the question's testCases column (what the student's paper shows), else codeSpec.testCases, plus entryPoint (code spec, else the technical requirements) and timeoutMs. Essays still send none.
  • The worker runs the entry-point file of the archive through the existing runners: runMultiLanguageEvaluation for JS/TS/Python/Java/C/C++/Go, runCSharpEvaluation (already project-aware) for C#. The entry point matches at any depth (bai-nop/main.py), shallowest first; without one, the language default (main.py, src/main.ts, …). A missing entry point fails every case; a runner outage (INFRA_ERROR) scores the criterion 0 with the reason and leaves it to the instructor.
  • AUTOMATED_TEST = real pass ratio, computed by calculateRubricEvaluation itself, so the instructor's finalize reproduces the number and the override rule of PR #193 is unchanged. The criterion still needs review, like every project criterion. With no suite at all, the criterion keeps the evidence engine, as before.
  • Hidden cases never leave the server. ProjectSubmission.tests (summarizeProjectTests) details public cases and only counts hidden ones, for student and instructor alike. Criterion feedback, and so the AI feedback prompt, carries counts and public case ids only.
  • The replay fingerprint includes the suite, and EVALUATOR_ENGINE_VERSION is 2.4.0, so a run graded before this change is never replayed as if tests had run.

No new queue, job or Redis read: the tests run inside the existing grading job (ADR-0059).

Consequences

  • A project is graded as one program reading stdin. A multi-file program that imports its own modules is not supported by the single-source runners yet; its cases fail and the instructor overrides. Running the whole tree is the next step if projects need it.
  • Grading a project now costs one sandbox run per test case (capped at 10 s each).
  • The showcase projects (PR #201) can move their correctness criterion to AUTOMATED_TEST.
  • Authoring still demotes an AUTO criterion to HYBRID (hasExecutableSpec: false); making that depend on the presence of test cases is a separate change.