Add a defense task over a student's mycpu checkout

Merged
JS
2d ago
+12131-87

A course that grades a student's own RISC-V core in Chisel (ca2026-mycpu) needs to know the student wrote it and understands it. This adds an opt-in defense set to task mode: codetrial web --task-mode --workspace <path-to-checkout> examines the student's own checkout. Lines the student added, chosen with the package's own salt, are explained to Jim; a stated change is typed and its failing specs predicted before a real sbt testOnly run; and the student's core, built with a mutant drawn per attempt, is run beside the clean build (retire log, waveform, obs-trace window) until the student states the cycle, signal, rule and exercise of the bug. Edits and builds happen in a private git worktree, so the student's tree and index are never written, and the page never learns the mutant or what a claim is checked against.

Jim examines without saying right or wrong and is told the panel's events once neither he nor the learner is speaking. A package may allow up to three hints (hints, default 0); each is recorded against its item and caps that item's suggested marks at 2. The result gains a defense section of suggested marks, labelled as suggestions generated on the student's machine. Item code is colored from a vendored tree-sitter-scala grammar, a defense set's setup advances by itself and remembers its PIN per set version, and scripts/task-package.py gains pin new and pin check. docs/mycpu-defense.md is the contract; non-defense task mode is unchanged.

Verified with ./scripts/test.sh on the branch, rebased on main: every gate passes except the browser test "a formatter that cannot load changes nothing, and the next press loads it", which fails on main as well. Each of the eight commits was built with clippy and passes its own tests. A rehearsal against a public ca2026-mycpu checkout and a live Gemini room exercised the panel, hints and the bug item end to end.

Left out, as open questions: defense packages keep packageVersion, taskContract and rubricProfile at 1 under task-mode's draft clause; the defense prompt is not pinned in tests/golden/task-prompts.json; a hint whose grant is lost with a dropped Gemini socket still counts; and when the student's bootcamp gate stamp is stale, the course's Makefile reruns that gate in the student's bootcamp clone.


Summary by cubic

Adds an opt-in defense task to task mode that verifies a student understands the RISC-V core they built in ca2026-mycpu, by examining their own checkout under codetrial web --task-mode --workspace.

  • The student explains lines they added, types a stated change, predicts the failing specs before a real sbt testOnly run, and finds a bug in a mutant-drawn model of their core run against the clean build.
  • All edits and builds happen in a private git worktree, so the student's own tree and index are never written; the page never sees the mutant or what a claim is checked against.
  • Jim examines without saying right or wrong, and hears panel events as notes once neither side is speaking; the result gains a defense section of suggested marks, labeled as generated on the student's machine.
  • A package may allow up to three hints, each recorded against its item and capping that item's marks at 2.
  • Item code is colored from a vendored tree-sitter-scala grammar, the defense set's setup advances on its own and remembers its PIN per set version, and scripts/task-package.py gains pin new and pin check.
  • docs/mycpu-defense.md is the contract; non-defense task mode is unchanged.

Fixes

  • Mutation testing closed coverage gaps: tests now pin the attempt's limit edges, the slot/review/room wiring, the panel's routes and refusals, and the defense result's display and withheld fallback.
  • The panel acts only while the work is neither ended nor frozen, runs cap at 2,000,000 cycles, and a relative command path resolves where it runs.
  • A trace without a first cycle and a pin check manifest of the wrong shape are refused; a hint grant Jim never received is taken back, and a stale refresh cannot draw over an action.