Skip to content

Grade conductor questions via headless conductor runtime - #387

Draft
RichDom2185 wants to merge 1 commit into
richard/2601-maintenancefrom
conductor-grading
Draft

Grade conductor questions via headless conductor runtime#387
RichDom2185 wants to merge 1 commit into
richard/2601-maintenancefrom
conductor-grading

Conversation

@RichDom2185

Copy link
Copy Markdown
Member

What & why

Adds grading support for conductor (external-runtime) programming questions. Until now the backend refused to send them here; they carry a (language, evaluator) pair instead of the legacy chapter/external/globals.

Pairs with backend PR source-academy/backend#1367, which sends conductor answers to this grader as library: { format: "conductor", language, evaluator }.

How it works

  • runAll (src/index.ts) branches on library.format === 'conductor' to runAllConductor (src/conductor.ts) before any legacy field is touched.
  • runAllConductor resolves the evaluator via @sourceacademy/language-directory, fetches + caches the published evaluator bundle, and runs it headless in a Node worker_threads worker driven by the @sourceacademy/conductor host protocol (a self/ILink shim + a NodeHostPlugin).
  • Each testcase runs in a fresh worker (isolation + a wall-clock watchdog for runaway code). Grading compares the program's stdout to testcase.answer (python-3 CSE surfaces values via stdout, not the result channel). The response is the same Summary shape as the legacy path, so the backend parser is unchanged.

Scope

  • python-3 pure-TypeScript evaluators only (cse / PVML). Pyodide/WASM evaluators need a browser runtime and are deferred (they surface as a run error here).

Verification

  • yarn test — 48/48 (10 new conductor unit tests + existing suites), yarn typecheck, yarn format:check, yarn build all pass.
  • End-to-end smoke (scripts/smoke-conductor.cjs, not in CI) run against the real PyCseEvaluator3.js: 4 python-3 testcases graded correctly (pass/pass/fail/runtime-error).

Deploy notes

  • The evaluator bundle is fetched from source-academy.github.io at runtime, so the Lambda needs outbound egress — or vendor the bundle at build time.
  • Assessments must use real language-directory ids (e.g. python3 / python3Default).

Draft: stacked on richard/2601-maintenance (depends on its Node 24 / build-script updates).

Conductor programming questions carry a (language, evaluator) pair resolved
via @sourceacademy/language-directory to an evaluator bundle. The bundle is
run headless in a Node worker_threads worker driven by the @sourceacademy/
conductor host protocol, and each testcase's stdout is graded against its
expected answer, returning the same Summary shape as the legacy js-slang path.

Scope: pure-TypeScript python-3 evaluators (cse/PVML); Pyodide/WASM deferred.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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