edu/ast_lol: formatter capstone track - #1453
Conversation
Tier 6 forks after Tier 3: a lesson on width-aware layout, sql-expr-print (minimal parens over SQL's precedence system, the -- comment trap included), and the sql-format capstone — flat when the query fits, canonical clause-per-line breaking when it doesn't, graded exact-match with failures diagnosed by reparsing the learner's text. Reference formatter in lang/sql/format.ts with round-trip and width-battery tests; 298 tests total. The welcome lesson drops the ambiguous 'all week' framing and describes both capstone tracks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7snNHsXg6msYZkBUHsViv
Chain splitting kept no position context, so a split operand lost required parens — WHERE p AND (q OR r) rejoined as a different query, and one capstone test shipped that wrong answer as expected. Split operands now wrap under the printer's own rule (first operand at the chain level, the rest one tighter), pinned by literals and a corpus-times-widths round-trip sweep. Numbers render as plain digits (String() goes exponential at the extremes, which the tokenizer cannot read back), LIMIT included. The printExpr solution and the capstone prelude are one constant, tier5-style. Plus panel wording fixes across the lesson, statements, and docs; 303 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7snNHsXg6msYZkBUHsViv
The graded challenges were contract-tested but the failure diagnoses — the debugging layer the track leans on — had no pins: exprPrintCheck's non-string / unparseable / wrong-style / wrong-tree layers, formatCheck's reparse / wrong-query / line-diff / width-callout layers, the tier2 parser-message surfacing, the sql-format width default, and plainNumber. Nineteen tests; 322 total. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7snNHsXg6msYZkBUHsViv
Custom tests persisted and re-ran but nothing told learners, and every mention framed them as exploration. The welcome lesson now states the habit by name — a bug-catching input becomes a custom test — with matching nudges at the round-trip printer and both capstones. Pinned by a content test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7snNHsXg6msYZkBUHsViv
Review: edu/ast_lol formatter capstone trackVerdict: Approve. This is a strong, well-tested addition. Tier 6 fills a real pedagogical gap (formatting as the mirror capstone to optimization), the reference implementation is cleanly separated from curriculum wiring, and the grading/diagnostic layers match the patterns established in Tier 2. What works wellArchitecture. Putting the oracle in Single source for expression printing. The panel fix was real. The split-operand paren bug ( Diagnostic pinning. Test depth. 323 tests locally ( Content/docs. Welcome rewrite around two capstone bookends reads cleanly. The Beyoncé rule nudge is on-brand for a course that grades against contracts. ROADMAP deferring comment-preserving formatting is honest about scope. Nits (non-blocking)
Verification
Nice work — ship it. |
The tokenizer reads newlines as whitespace and keeps them inside string literals, so formatCheck's newline collapse was corrupting newline-bearing literals — a layout mistake on such a query was misdiagnosed as a different query. Reparse the output as-is; pinned. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C7snNHsXg6msYZkBUHsViv
|
Addressed the nits: 3 — newline collapse: fixed and pushed ( 1 — tier ordering: keeping as is. Inserting tier 6 between tiers 3 and 4 would either display tiers as 0-1-2-3-6-4-5 or force renumbering the optimizer tiers. The fork is instead signposted at the decision point — the 2 — 4 — thanks; noted. Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
iili | b7b540b | Commit Preview URL Branch Preview URL |
Aug 25 2026, 09:41 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ast-lol | b7b540b | Commit Preview URL Branch Preview URL |
Aug 25 2026, 09:42 PM |
Adds Tier 6 to ast.lol — a parallel capstone track forking after Tier 3: a layout lesson,
sql-expr-print(minimal parens over SQL's precedence system), and thesql-formatcapstone (width-aware canonical SQL under a reparse-identity obligation), graded against a new reference formatter (src/lang/sql/format.ts). Also rewrites the Why ASTs intro around the two capstone bookends.The four-lens review panel ran against the track head; its fixes landed as
1192f39(split chain operands keep position-required parens, pinned by literals and a corpus×widths reparse sweep; numbers render as plain digits, LIMIT included; the printExpr solution and capstone prelude are one constant). The two commits after that — checker-diagnostic test pins and Beyoncé-rule content — were not panel-reviewed.323 tests; tsc, vitest, build, and the Playwright E2E pass (both new challenges solvable start to finish, custom tests included, mobile clean).
Generated by Claude Code