Skip to content

KTL-4904: Restyle the Playground widget according to the design - #5906

Draft
Konstantin Chernenko (zoobestik) wants to merge 15 commits into
masterfrom
chernenko/ktl-4904-restyle-exercise-playground
Draft

Konstantin Chernenko (zoobestik) wants to merge 15 commits into
masterfrom
chernenko/ktl-4904-restyle-exercise-playground

Conversation

@zoobestik

Copy link
Copy Markdown
Collaborator

No description provided.

The checks verify what the output tests cannot see: explicit type declarations, string templates, if and when, for+if, expression bodies, lambdas, and .uppercase(). The junit tests of the checked exercises move next to their checks into page-named folders under tour/basics/, with the shared CircleAreaTest in the kotlin-tour-functions folder. Every exercise block drops validate="false", and the passed() notes lose the "the test doesn't check" admissions that the checks now cover.
…cises

The checks verify what the output tests cannot see: append() and the event fields in lambdas with receiver, the buildList skeleton, measureTime(), as? with ?: and takeIf(), singleOrNull(), mapNotNull(), by lazy, abstract functions, constructor overrides, by-delegation, and apply/also chained with ?./let. The junit tests of the checked exercises move next to their checks into page-named folders under tour/intermediate/.
Rename test-page-exercise-N.checks.yaml to exercise-N.checks.yaml inside the page-named test-page/ folder, matching the tour layout, and update the kotlin-checks-file paths on the page.
Give every top-level check of the 26 checks files an author's `title` — the heading
of its failed-check card (31 titles in total: basic-types carries five, libraries-2
carries two). A missing title is now a build error (CDE022); junit and nested checks
must not carry one.

Add a diagnose to libraries-2: a not-and over an error-contains for "Unresolved
reference 'measureTime'" and the missing import line. The card fires only when the
compilation fails exactly because the import is missing; compilable solutions keep
being graded by the tests as before.
Mark the code entities of the failed-check messages consistently with the prose of
their pages: the `==` operator, `.filter()`/`.map()`/`.takeIf()` with the dot their
task texts use, `repeatN()` with parentheses, `null`/`false` as literals. Link the
constructs the checks themselves require to their API pages — 17 absolute links in
the URL form of each page (core for libraries, null safety and scope functions,
latest elsewhere), never inside the code analogs. Relative links are out: the
message renders into a bare markdown piece outside the build's href validation.
…() test

The playground runs every exercise as a JUnit one, but the exercises graded by
their source checks alone used to declare no test files: the server returned no
test report for them, and a compiling solution drowned in "Couldn't run the
code" behind its unused-variable warnings.

Give each of them a dummy test that runs `main()`: the test report now
arrives and overwrites the transient error, and the program output reaches
the validation report through the captured stdout of the test. The three
demo exercises of the test page share one `TestPageTest`, the way
`CircleAreaTest` is shared by the functions exercises; `BasicTypesTest`
covers the basic-types exercise.
@zoobestik
Konstantin Chernenko (zoobestik) force-pushed the chernenko/ktl-4904-restyle-exercise-playground branch from ce9cb42 to 06d26ff Compare November 4, 2026 12:05
…se markup

Hints and solutions are now assist chips with lazy panels instead of
nested definition lists and code collapses, the run button moved to
the playground controls bar, and the validation result replaces the
program output for an unsolved starter. The deep-link test anchors by
the exercise's own id, because the solution ids only appear inside the
lazy assist panel and the chip ids are random per page load.
Never red on a correct solution:
- test-page ex. 1: any string interpolation passes, not only $name is $age
- test-page ex. 2: a surviving placeholder comment no longer reds an .equals() solution
- test-page ex. 3: filter(...) and filterNot pass, not only filter { }
- lambdas ex. 2: repeatN(count) passes, not only literals and n =
- basic types: var declarations pass, not only val
- scope functions ex. 1: anchor the expression-body check to the fun
  declaration (the old pattern matched the call in main() via !=) and
  accept the let(...) spelling

Co-Authored-By: Claude Code <noreply@anthropic.com>
…eck messages

A check message now points to the section that explains the construct,
preferring the very topic the exercise lives in:
- same tour topic: string templates, if/when/for, expression body,
  abstract/interface members, by delegation, by lazy, let/apply/also,
  singleOrNull, .map()
- /docs articles already referenced by the topics themselves:
  numbers, strings, booleans, characters, .uppercase(), .takeIf(),
  mapNotNull, .filter(), .append()
- API reference stays only where nothing explains the function:
  measureTime(), repeat() (normalized to the /api/core URL form)
@zoobestik
Konstantin Chernenko (zoobestik) force-pushed the chernenko/ktl-4904-restyle-exercise-playground branch from 7d6dbb3 to d3980ed Compare November 4, 2026 14:16
The restyled validation card shows "Validation passed" plus the
program output and nothing else. The success notes of the old
widget ("Checked: ...", behavior restatements, "the test can't see
how..." disclaimers) are noise now: the source checks validate the
constructs and explain them on the red path, and everything the
notes taught lives in the task text or the hints.

Drop the note argument from all 39 note-carrying passed() calls
(13 basics, 26 intermediate) — each already passes showOutput = true,
so the program output stays on success. Simplify ExerciseUtils.passed()
to passed(showOutput: Boolean = false): with no caller passing a note,
the note parameter and its stderr mechanism are dead code.

hint() messages and the source checks of *.checks.yaml are untouched.

Cover the success path in the practice e2e spec: enter the reference
solution through the CodeMirror instance, run the exercise, and assert
the passed card shows the heading and the program output with no note
paragraphs.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@zoobestik
Konstantin Chernenko (zoobestik) force-pushed the chernenko/ktl-4904-restyle-exercise-playground branch from 19413bc to d321cca Compare November 4, 2026 18:07
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