This guide covers changes to coding-study itself: the cstudy CLI, the runners, and the bundled content. To practice, or to write problems only for yourself, use an installed cstudy and a workspace instead (README).
-
Clone the repository and install the development environment:
git clone https://github.com/bkuberek/coding-study cd coding-study uv sync # creates .venv at the repository root
-
Create a development workspace outside the checkout and point
cstudyat it:uv run cstudy init ~/cstudy-dev-workspace export CSTUDY_WORKSPACE=~/cstudy-dev-workspace uv run cstudy doctor --fix
-
Make your change, run the checks, and commit with a Conventional Commit message.
uv run cstudy in a checkout reads the checkout's problems/, runners/ and schemas/, and builds with the workspace's toolchains. To put the checkout's cstudy on your PATH, run uv tool install --editable ..
This repository holds code and content only, never a workspace. Your practice files, notes, attempts and progress.db belong in your own workspace repository.
cstudy initrefuses to create a workspace inside the checkout unless you pass--force.- The root
.gitignoreignores.cs/,.statements/,progress.db*,progress-export.json, and practice directories at the root (python/,typescript/,jvm/,notes/,.archive/,workspace/) as a second guard. - Reference solutions under
problems/<slug>/solutions/are content, not practice: they are the answerscstudy solutionshows.
Run the CLI checks from cli/; its tool settings live there (ruff.toml, pyrightconfig.json, pytest.ini, .importlinter). Every check must pass before you commit.
| Check | Command |
|---|---|
| Lint | uv run ruff check . |
| Format | uv run ruff format --check . |
Types (strict on src/) |
uv run pyright |
| Layer contracts | uv run lint-imports |
| Fast tests | uv run pytest -q -m "not slow" |
| JVM tests | uv run pytest -q -m jvm (the slow tests that drive Gradle, javac, kotlinc or a JVM runner on the JDK your shell selects) |
| All tests | uv run pytest -q (the slow tests drive real Gradle, Node, tsc and a workspace venv in a temporary workspace) |
To run the whole suite as four disjoint lanes (fast, slow-core, browser, docker), each test once, with logs, JUnit XML and a one-line summary per lane, use tools/gate/lanes.sh (README). The content half, cstudy verify over the whole catalog as concurrent groups, is tools/gate/verify.sh.
The fast tests include the contract tests in cli/tests/contract/: a change of a command, flag, exit code, config key, environment variable or the workspace marker fails them until you write the snapshots again with CSTUDY_WRITE_SNAPSHOTS=1 uv run pytest -q tests/contract and commit them with the change, and a --json document must validate against its schema in schemas/cli/ (compatibility).
CI runs on Linux for every push to a branch and every pull request (versioning). The fast checks are the first six rows, plus cstudy verify --static. The JVM job runs the JVM tests and cstudy verify --conformance for --lang java and for --lang kotlin, on JDK 21 and on JDK 26, the two ends of the supported range. Two more jobs run only when the changes job finds that the diff can affect them: the browser tests on Chromium, and the sandbox job, pytest -m "docker and not docker_jvm and not docker_go" on a real Docker engine. The real-engine JVM tests carry the docker_jvm marker and the real-engine Go tests the docker_go marker, each together with docker, and both stay a local gate so that the job fits its 15 minutes: uv run pytest -q -m docker is the full local run and includes them (about 20 minutes under load), and a new test that builds a JVM or Go project on a real engine takes the matching marker too. The other slow tests, and cstudy verify of a catalog service project over real stacks, stay a local gate. A test belongs to the JVM job when it carries the jvm marker, together with slow: mark a new test that drives the JVM the same way, and a row of a test over every language with jvm_marked from cli/tests/toolchains.py.
Changes to content, runners or code generation also need cstudy verify (with CSTUDY_WORKSPACE set):
| Change | Gate |
|---|---|
| Runners or stub generation | uv run cstudy verify --conformance, then a full uv run cstudy verify |
Problems in problems/ |
uv run cstudy verify --changed --oracle --ladder --require-ready |
Rubric problems (system-design, code-review) |
uv run cstudy verify --track system-design --require-ready (or --track code-review) |
--ladder measures timing, so run it on an idle machine on AC power; a busy machine reports lower confidence. Optional: run the problem gate in a pre-push git hook.
Java and Kotlin build and run with the JDK your shell selects, 21 to 26 (toolchains guide), so the slow tests and cstudy verify use that one. To try another JDK for one command, set JAVA_HOME for it, for example with SDKMAN: JAVA_HOME="$HOME/.sdkman/candidates/java/<identifier>" uv run pytest -q -m slow. CI runs the JVM tests and the Java and Kotlin conformance suites on JDK 21 and on JDK 26 on every push. Before a release that changes the range or the JVM build, the local gate also runs a full cstudy verify of the Java and Kotlin references on both (ADR 0016).
One build wants an exact JDK: tools/ide-launcher/build.sh, which rebuilds the IntelliJ launcher jar, needs javac 21, since javac 17 and 21 emit other bytes for the same --release 17, and a slow test compares the committed jar with a rebuild. The script uses the JDK that JAVA_HOME names, else the first javac on PATH, and says how to select a 21 when it finds another: JAVA_HOME="$HOME/.sdkman/candidates/java/<identifier of a 21>" tools/ide-launcher/build.sh. The test skips itself on any other JDK, so run it with JAVA_HOME at a 21 to check the jar.
Problem statements, tests, hints and solutions must be original (ADR 0004); a LeetCode problem appears only as a link in references.leetcode.
-
Scaffold the problem in the checkout:
uv run cstudy new <slug> --from-template array|tree|design|progressive|concurrent. Run from a development checkout,cstudy newwrites into the repository'sproblems/, not into the workspace named byCSTUDY_WORKSPACE(a follow-up to know about when you test with a scratch workspace). -
Follow the authoring workflow: the statement in
problem.md, the signature inmeta.yaml, the cases intests.json, a brute-force Python oracle,generator.py, the optimal approaches in every language the problem lists, Go and Rust included, andsolutions/explanation.md. The problem format defines every file. -
Set
status: readyonce the problem passes the ready gate:uv run cstudy verify <slug> --oracle --ladder --require-ready
Rubric problems (system design, code review) follow the rubric problem workflow. Slugs are unique and never change once merged, because progress is keyed on the slug.
Commit messages follow Conventional Commits, and the commit types drive the version (versioning):
| Commit | Version change while 0.x |
|---|---|
fix:, perf: |
Patch |
feat:, and breaking changes (feat!:, BREAKING CHANGE:) |
Minor |
docs:, chore:, ci:, build:, refactor:, style:, test: |
None |
Examples: feat(cli): add cstudy stats --since, fix(runners): report a missing symbol as a load error, docs: clarify the workspace layout. Once CI passes on a push to main, a GitHub workflow bumps pyproject.toml, updates CHANGELOG.md, and tags the release; a commit that fails CI is never released. Never edit the version by hand.
A change of a public surface (compatibility) is also recorded in UPGRADING.md, and one that breaks it is a feat!: or fix!: commit with a BREAKING CHANGE: footer.
Keep tests and docs in the same commit as the behavior they cover. Specs in docs/specs/ are normative: when the code and a spec disagree, fix one of them in the same change.
Issues open through the forms in .github/ISSUE_TEMPLATE/; blank issues are off. A link can open a form prefilled through URL query parameters: template=<file>.yml, title=, and one parameter per field id. Labels come from each form, not the URL. The field ids are a contract with such links, so do not rename them.
| Form | Labels | Field ids |
|---|---|---|
bug.yml |
bug, triage |
what-happened, steps, expected, page, content, version, os, logs |
missing.yml |
enhancement, triage |
kind, description, page, content, version, os |
content-error.yml |
content, triage |
content, language, problem, suggestion, version |
| Read | For |
|---|---|
| Architecture | Hexagonal boundaries, ports and adapters, data flows |
cli/README.md |
The CLI's package layout |
| Documentation index | Every spec and decision record |