| Field | Value |
|---|---|
| Status | Accepted |
| Date | 2026-10-30 |
| Amended | 2026-10-31: Go project problems, after spike K5; Java and Kotlin project problems, after spike K4 |
| Spec | problem-format, runners, cli, authoring, installation-and-workspaces, progress-and-scheduling |
| Amends | ADR 0001 (native test files generated from the data), ADR 0012 (a fourth exception to the six-language rule) |
| Amended by | ADR 0016: cs.project no longer pins JDK 21; a project folder builds on the selected JDK, 21 to 26 |
| Amended by | ADR 0017: a project may declare asynchronous methods and a virtual clock, grade them with harness operations, and have stress cases and broken overlays |
| Amended by | ADR 0024: a pass through level N of M is a pass, graded from the rating; the levels cap the grade, and only every level passes, in a mock alone |
| Superseded in part by | ADR 0019, planned and not built: for service projects only, which run in Docker, a project may have its own dependencies, so the rejection of a venv or node_modules per project and of Vitest and Jest for needing a network install no longer holds for that kind of problem. Existing problems do not change |
Every autograded problem today is one file per language: cstudy start generates a stub from the signature, and the runner loads that one file (ADR 0001). A progressive problem grows one class over levels, and a run of cstudy test that passes every case of the unlocked levels opens the next one. That covers an API that grows, but not the work of building and extending a small codebase: splitting it into modules, adding files, writing your own tests and running them with the language's own tools. The owner wants that exercise, and wants a web interface on top of it later.
What the code base showed before the decision:
- The Python runner executes one file as a module of its own, so a package-relative import in a second file fails (
ImportError: attempted relative import with no known parent package). The TypeScript runner imports by file URL, so relative imports already resolve. - Java, Kotlin and Go already compile every file of a problem's package directory; Rust compiles one file as a
#[path]module. - Tests are language-neutral data so that one case set serves six languages and the statement's examples come from the same cases as the grade. IDE-native tests were rejected as a second judge in ADR 0010.
- A catalog problem lists every language that can express it (ADR 0012), with three exceptions.
A spike (scratch code, not merged) built a two-file bank in Python and TypeScript. pytest and node:test both ran in-process from a host script outside the project and reported each test as it started and ended, with the assertion detail; the runner-side cost was 0.12 s for pytest with warm bytecode (0.54 s cold) and 0.06 s for node:test. A second spike (K1) settled the Python folder: a relative .venv link to the shared venv works for pyright, basedpyright and pytest, a requires-python above the venv's Python makes uv run delete the shared venv through that link, and a user file such as random.py shadows the standard library when the project root comes first on sys.path.
-
A new kind.
kind: projecton thepracticaltrack: a folder of seeded files (starter/) thatcstudy startcopies toprojects/<slug>/in the workspace. Levels, level cases and theopscomparator work as for progressive problems and share one level module; the kind gets its own branch in every exhaustivematchonProblemKind. -
One language per problem. A project problem lists exactly one language and is solved only in it. A version in another language is a separate problem, built from scratch with its own id, slug, starter, cases, reference and explanation; only the statement wording may be reused. Siblings link through
related, and the slug carries the language (bank-project-python), since slugs key progress. This is a fourth exception to the six-language rule of ADR 0012: check S13 skipsmust listfor the kind. -
tests.jsonstays the single source. Its cases feed the statement's examples, the visible native tests and the grade.cstudygenerates one native test file per level from that level's visible cases (pytest,node:test, JUnit 5, kotlin.test), at start for level 1 and at each unlock for the next level, and never rewrites one. Authors may ship extra test files in the starter, and users add their own. -
Two commands.
cstudy testruns the native suite: the generated files, the starter's and your own. It is feedback only, never a grade, and opens nothing.cstudy submitsends every case of the unlocked levels, visible and hidden, through the runner protocol; the core's comparator judges each output, and a submission that passes every one opens the next level. Editing a generated test file never changes a grade. -
Levels stay hidden until they open. The starter holds only level 1's methods. Each unlock reveals the next statement section, which names the methods to add, and the grader checks only the methods of the levels it grades.
-
Hidden cases. A failing hidden case shows its input, expected and actual in a practice attempt, and only a count in a mock attempt.
-
Grade.
cstudy donetakes a rating once level 1 passes and caps the grade by the levels finished: all levels, no cap; all but the last,hard; fewer,again. The time box stays soft: finishing over it caps the grade athard, as today. -
One final reference. Each project problem has exactly one approach, whose reference is an overlay on the starter (
solutions/<approach>/, changed and added files only) implementing every level. No snapshot per level. -
Runners host the framework. The Python, TypeScript and JVM runners learn to load a project folder for grading and to run the native framework in-process as a new
suitejob, so a test gets the runner's hang guard, output capture, crash restart and debug launch. Go runs its test binaries as child processes of the runner instead, with the same guarantees (Go). -
Shared toolchains. A project folder reaches the workspace's toolchain by relative path: the Python venv and Node installs, the vendored Go modules, and on the JVM the workspace's Gradle wrapper, daemon and runner runtime. Nothing is installed per project, so a Python, TypeScript or Go project starts offline (NFR-6). A Java or Kotlin project starts offline once
cstudy doctor --fixhas cached JUnit, kotlin-test and their dependencies, which no single-file problem needs (Java and Kotlin). -
Python and TypeScript first. Go followed after spike K5 (below), Java and Kotlin after spike K4 (below), Rust after spike K6 (below). Each needed a build of its own per project (a Gradle build, a Go module, a Cargo crate) and a spike before it was specified:
Language Open question Spike Java, Kotlin Settled by K4: a standalone Gradle build per project folder on the shared daemon, within NFR-1 without a persistent runner (below) K4 Go Settled by K5: one module per project with a go.workof its own in the folder, never an entry in the rootgo.work; the overlay registration works inside a project package (below)K5 Rust Settled by K6: a standalone crate per folder, graded through a harness that depends on it by path, with the dev profile for tests and grading alike; each test a process of its own, since stable libtest has no JSON output (below) K6
Spike K5 (scratch code, not merged) built a two-package Go bank with a test file per level, own tests, subtests, parallel tests and an Example, on Go 1.27 and Delve 1.27.2. Go project problems follow its design (problem-format, runners, installation-and-workspaces):
- A module per folder, with a
go.workof its own. The starter'sgo.moddeclaresmodule <slug>(check S15) and reaches the vendored decimal module throughreplace ../../.cs/runtime/runners/go/third_party/..., so it needs neither ago.sumnor the network.cstudy startwritesprojects/<slug>/go.workholdinguse ., through which gopls andgo test ./...in the folder resolve imports. The rootgo.workis left alone: auseline there breaks every go command once an archive moves the folder, and two folders with one module path fail withmodule appears multiple times. - Grading builds a runner binary per project against a
go.workof its own in the build directory, which joins the build modulecsbuildand the project folder. The registration and thunk files enter the entry's package throughgo build -overlay, as for a practice file; overlay and typed thunks work for a package spread across files and subpackages. The thunks cover the methods of the graded levels only. Measured: 0.23 to 0.37 s p50 of toolchain time. - Suite. The runner runs
go test -json -count=1 -timeout=0 ./...in the folder as a child process and turns its events into suite results. This corrects "Runners host the framework" for Go: the tests run in test binaries, not in the runner's process, yet the hang guard, output capture, crash restart and debug launch still work through the child. Parsing the native report is fine here, unlike JUnit XML in the alternatives below, becausego test -jsonis the go command's documented interface and reports each test as it starts and ends. Measured: 0.53 to 0.69 s p50. - Hang guard and restarts.
-timeoutcovers a whole test binary, not a test, so the hang guard times the gap since the lastgo testevent,t.Paralleltests pausing and finishing late, and the CLI's watcher kills the process group. A test binary that panics or callsos.Exitends with the test it was running, which is reported as anerror; the runner runs that package again with-skipof the top-level tests already reported, so a panic, which a starter'snot implementedmethods raise in every test, never uses up the CLI's crash restarts. A restart after a hang passes-skipthe same way, with the culprit: one regular expression cannot name an arbitrary set of subtests, so both leave out whole top-level tests. - Debug. The runner builds the test binary with
-gcflags=all=-N -l, runs it underdlv exec --headless, and pipes its output throughgo tool test2json; breakpoints in the project's code and in its tests stop. - Speed. A Go project's
cstudy testtakes about 1.2 to 1.4 s end to end, over the 1.0 s that NFR-1 sets for Python and TypeScript projects, so NFR-1 gives Go projects a target of their own: 1.5 s at first, raised to 2 s for 0.9.0 after both 0.8.0 and 0.9.0 measured 1.6 to 1.7 s.
The question K4 answered: the warm p50 of compiling a project's main and test sources plus a JUnit Platform launch, against NFR-1's 3 s (Java) and 5 s (Kotlin); JUnit resolved offline; locks and per-run class copies per project build. ADR 0007 names multi-file problems as its revisit trigger.
Measured on an M3 Pro (JDK 21.0.2, Gradle 9.8.2, Kotlin 2.4.21, JUnit 5.14.4), warm p50 after a one-file edit, for three routes:
| Route | Java | Kotlin | Verdict |
|---|---|---|---|
| (a) One shared Gradle build, a source set per project | Similar to (b) | Similar to (b) | Rejected: adding a project costs 1 to 1.8 s once and invalidates the configuration cache of every JVM build; VS Code folds every project into one Eclipse project, so packages clash; Kotlin tests cannot see internal declarations |
| (b) A standalone Gradle build per project folder, on the shared daemon | 0.61 to 0.64 s build and launch (about 1.0 s with cstudy's own 0.4 s) |
1.26 to 1.41 s (about 1.8 s) | Chosen: a third of the targets |
(c) javac and kotlinc called directly |
Similar | 2.6 to 4.7 s: every run starts a cold compiler with no incremental compile | Rejected |
- A Gradle build per folder.
projects/<slug>/holds its ownsettings.gradle.kts,build.gradle.kts,gradle.propertiesandgradle/wrapper/gradle-wrapper.properties, andsrc/main/<java|kotlin>andsrc/test/<java|kotlin>. Its settings find the workspace by walking up to.cs/workspace.toml, never by a fixed../.., because the same files also build in.cs/build/projects/<slug>/<approach>/. They take the workspace's version catalog and include the runtime'srunners/jvmbuild, whosecs.projectplugin sets the JDK, JUnit and the runner. This is the route that rejects project folders inside the language projects (see the alternatives). - Build and run.
cstudyruns<ws>/jvm/gradlew -p <folder> --offlineon the shared daemon:csClasspathwrites the main and test runtime classpaths before a suite,csMainClasspaththe main one before grading, so a test file that does not compile never blocks a submission. One exclusive lock per project build (not per language), the existing runtime lock and the per-run class copy keep concurrentcstudyprocesses apart; their cost is in the timings. - Suite.
java -cp <test runtime classpath> cs.runner.Mainhosts the JUnit Platform Launcher with a listener that writes protocol events: frameworkjunit-platform, JUnit Jupiter for Java and kotlin.test on JUnit 5 for Kotlin. Test ids name the file first, as pytest's andnode:test's do (src/test/java/bank/Level1Test.java::ex1, with[n]per parameterized invocation), read from the class file'sSourceFileattribute: the spike'spkg.Class::methodnamed no file, and the CLI tells a generated test from the starter's and from yours by its file. A failed assertion's expected and actual are the strings opentest4j carries, not JSON values. A class whose@BeforeAllfails is reported once, under the class's id, so a restart'sskipprunes by class as well as by test. - Grading. The class job of every JVM problem, on the main runtime classpath; the target is the entry class (
bank.Bank). - Offline.
cstudy doctor --fixbuilds one warm-up project per language from the template, which caches JUnit, kotlin-test andapiguardian-api(a resolvable prefetch configuration missedapiguardian-api, which only JUnit's compile variant brings). The first build of a new folder takes 1.5 to 2.4 s on a warm daemon. - No persistent JVM runner. ADR 0007's trigger is not met, and the Kotlin Gradle plugin already keeps a compile daemon of its own.
Spike K6 (scratch code, not merged) built a bank crate and a probe crate whose tests pass, panic, abort, hang, are ignored and expect a panic (should_panic), on Rust 1.92 and rust-analyzer 0.3.3097. Rust project problems follow its design (problem-format, runners, installation-and-workspaces):
- A standalone crate per folder. Cargo refuses a workspace member outside the workspace root, so
projects/<slug>/cannot joinrust/or.cs/build/rust; it is a library crate of its own. The starter shipsCargo.tomland.cargo/config.toml, which points crates.io at the runtime's vendored crates by a path relative to the folder, for rust-analyzer and the nativecargo test.project.entrynames the crate, whose rootsrc/lib.rsmakes the entry class public; the generated tests are integration tests,tests/level_<n>.rs.projects/*/Cargo.lockis ignored: cstudy's builds never write one in the folder, and the nativecargo testdoes. - A harness on a path dependency. Grading builds
.cs/build/rust-projects/<slug>/, a Cargo workspace whose only member is a harness depending on the project crate by path,user = { package = "<crate>", path = "..." }. The generated bridge needs no change: it callsuser::Bank, with the methods of the graded levels only, and aload_errornamessrc/lib.rswhere a single file is named. - The dev profile for projects. The suite and grading both build with the dev profile and the existing pins, sharing
.cs/build/rust/target, so a grade after a suite run compiles only the harness (about 0.19 s); projects have no bench,--perfor time limit to need the release profile. Each build workspace gets a privateCARGO_HOME: the package-cache lock inCARGO_HOME, not the target directory's, serialized concurrent builds. - Suite: one process per test. libtest's stable output is pretty text, and
--format jsonneeds nightly, so nothing parses a report:cstudybuilds every test target withcargo build --lib --tests --keep-going --message-format=json, lists each binary's tests with--list --format terse, and runs each test as a process of its own,<binary> --exact <name> --nocapture, judging it by its exit code. As for Go, the tests run outside the runner's process; unlike Go's, a hang or a crash ends only that test's process, so the suite never restarts, and a test file that does not compile is oneerrorresult while the others run. - Speed. A Rust project's
cstudy testtakes about 1.5 to 1.8 s end to end and its grade about 1.1 s, over the 1.0 s that NFR-1 sets for Python and TypeScript projects, so NFR-1 gives Rust projects a target of their own, 2 s.
- A project problem has no generated stub, no generator, no bench, no oracle and no time limit:
cstudy bench,cstudy test --perf,--stressand--time-limit, andcstudy verify --oracleand--ladder, do not apply to it. - Coverage lines and
--langfilters count a project only in its language. The catalog grows one problem per language version, and each version costs a full authoring pass; the TypeScript pilot measures that cost. - New CLI surface:
cstudy submitandcstudy status, aprojects/folder in every workspace, pytest in the workspace's Python template,submissionsandlevel_unlockstables, verify checks S14 to S16 and D9, and thecstudy doctorrows on the JVM project libraries. - The Python runner gains a package-aware loader that compiles project modules from source on every run and keeps library bytecode under
.cs/pycache/, and one runner process per project job, since two projects may both define a top-levelbankmodule. - The runners' JVM build gains the
cs.projectGradle plugin, which every Java and Kotlin project folder applies, andcs.suite, the JUnit Platform host that only a project's test runtime classpath holds. A Java or Kotlin starter's build files are exactly the template's, with its slug as the root project's name (check S15), so every folder builds the same way and offline. - The JVM warm-up of
cstudy doctor --fixresolves the runtime classpath (csClasspath) and builds the warm-up projects. K4 found that the warm-up before it compiled classes only, so a fresh Gradle home never cached the runner's owngsonand no Java or Kotlin problem, single-file ones included, built offline. - A starter's
pyproject.tomlholds tool tables only. A[project]table,requires-pythonor[tool.uv]in it could makeuv rundelete the shared venv, so check S15 rejects them. - A Go project folder is a module of its own whose
go.work, like a Python folder's.venvlink, is untracked:cstudy startwrites it when it is missing andcstudy doctor --fixrestores it.cstudy doctoralso warns about a vendoredreplacethat does not resolve and about two folders with one module path. A generated Go level file that calls a method not written yet stops its whole package from compiling, as any Go test would;cstudy test --levelleaves it out. - The pilots are
bank-project-python, thenbank-project-typescript, with the behavior ofscheduled-transfers-bank. 0187 and 0248 stay progressive, since converting them would remove their six-language versions. - The web interface is still a PRD non-goal; the project folder,
cstudy submit --jsonandcstudy status --jsonare the boundary it would build on. ADR 0015 later made it a goal.
| Trigger | What to reconsider |
|---|---|
A Rust project's warm cstudy test p50 exceeds its 2 s NFR-1 target |
Running each test binary once for all its tests, and one process per test only after a hang or a crash |
| The warm p50 of a Java or Kotlin project, measured as ADR 0007 measures, exceeds two thirds of its NFR-1 target | ADR 0007's levers for the project build: skip Gradle when nothing changed, then a compile server |
| The owner finds the pilot's generated tests read like machine output | Hand-written visible tests in the starter, kept next to tests.json (alternative C below) |
| Ports become frequent, or a third language version of one project is wanted | Sharing cases between siblings, and a variant_of field so that cstudy start bank-project --lang typescript works |
| Seeing the code evolve proves worth about four times the reference work | A reference snapshot per level, shown by cstudy solution --level N |
| The web interface is scheduled | Closed by ADR 0015, which builds the local web UI on this boundary |
| Alternative | Why rejected |
|---|---|
A layout: project flag on progressive |
Projects differ in layout, start, grading, references, verify, bench and languages; a flag hides those branches from the exhaustive match on ProblemKind |
| Every project in all six languages, as ADR 0012 requires of other problems | Different languages suit different projects, and a folder's layout, build files and idioms do not translate the way one function does |
| A. Hand-written native visible and hidden tests | The verdict would come from a framework running over code the user can edit: the second judge ADR 0010 rejected. Examples in the statement would be written by hand a second time |
B. tests.json only, nothing to run natively |
Misses the point of the exercise: running your code with the language's own tools |
C. tests.json for grading, hand-written visible tests in the starter |
Every visible case written twice, as data and as test code; verify proves both pass the reference, not that they agree. Kept as the fallback |
Every cstudy test grades hidden cases and opens levels, as for progressive problems |
Skips the loop being practiced: testing your own edge cases before you submit |
| A level opens once its visible tests pass; submissions only score | The visible tests are editable, so a level would open on the user's own verdict |
| Every method stubbed in the starter from level 1 | Designing for changes you cannot see yet is the point of a staged project |
Project folders inside the language projects (python/projects/<slug>/) |
Inherits the venv and node_modules without configuration, but is not one folder on the JVM, and Go and Rust need a module or crate of their own anyway |
| JVM: one shared Gradle build with a source set per project (K4 route a) | As fast as a build per folder, but each new project costs 1 to 1.8 s once and invalidates the configuration cache of every JVM build, VS Code folds every project into one Eclipse project so packages clash, and Kotlin tests cannot see internal declarations |
JVM: javac and kotlinc called directly (K4 route c) |
Kotlin takes 2.6 to 4.7 s per run: a cold compiler every time, with no incremental compile |
| JVM: prefetch JUnit with a resolvable configuration in the workspace build | Misses apiguardian-api, which only JUnit's compile variant brings; building a real project from the template caches exactly what a folder needs |
A venv or node_modules per project |
Every start would need the network (NFR-6), and disk use multiplies |
| Run the native tool and parse its report (JUnit XML) | Less code per language, but loses the per-test hang guard, crash restart, output capture and debug launch the runner already has |
| Vitest or Jest for TypeScript | They need a network install and a transform of their own; node:test ships with Node 24 and runs .ts through type stripping |
| unittest for Python | Nothing to install, but pytest is what Python projects use and its failure messages are clearer; the cost is one dev dependency in the shared venv |
| Convert 0187 and 0248 into project problems | Loses their six-language single-file versions |