gpui-cc Course handbook
REFERENCE / FIELD NOTES

Course execution plan

How the book, checker, and release evidence fit together.

On this page

Status: The HTML handbook now contains all 20 stages through the two-app capstone, written after the beginner audit. The verification guide distinguishes independent checks for native startup and pixels from later learner-authored CTest fixtures. Worked examples were verified; the full course has not completed a beginner rehearsal or an end-to-end learner framework run. COURSE.md is the superseded draft.

Pilot approval: The learner approved the HTML handbook design. This closes the design review, not the learner implementation or walkthrough gates.

Companion: FRAMEWORK-PLAN.md defines the learner’s implementation stages, architecture and ownership boundaries, per-stage checks, and capstone acceptance. This file defines the production process for the book and checker.

1. Define the actual task

Deliver a complete, self-paced, project-based course in the style of CodeCrafters’ Build your own HTTP server, applied to a GPUI-CE-inspired C++20 UI framework. “Complete” means the learner can start in an empty directory and reach a working capstone using the written course and local checks without waiting for another chapter or asking what to implement. The book may be available all at once; the mentorship still works one active stage at a time.

The learner writes the framework. Course authoring can provide setup, test fixtures, starter scaffolding, small API examples, and progressively more specific hints. It does not populate a stage’s solution in the learner’s source tree. No CodeTrain, background watcher, hosted grader, or required Git push.

Proposed first-edition scope

  • Starting point: one named C++20 executable; Linux, CMake, Unix Makefiles, build/ for build metadata and target/ for executables. Include instructions from an empty directory and a shortcut for the learner’s existing 4c2a788 baseline. Leave CMAKE_BUILD_TYPE unset in the normal course build.
  • Finish line: a small counter app with a text label, two controls, pointer input, visibly tracked keyboard focus, and redraw after relevant state changes and resize. A tiny second app exercises the same public API; neither app imports XCB or handles pixel storage. This is a reasonable minimum for demonstrating a framework, not just a working demo.
  • Implementation baseline: one Linux backend, initially X11/XCB; CPU rendering before optimization; enough layout, input, state, and text to support the capstone. Use a text library if needed rather than quietly expanding into writing a font engine. Decide the exact text subset during design and document it. Wayland, GPU acceleration, full Flexbox, rich text editing/IME, asynchronous scheduling, and accessibility parity are explicitly outside this edition unless commissioned as extensions.

2. What to deliver

Deliverable Done when
Complete beginner course All core stages through the capstone teach the new mechanisms with runnable C++20 examples, then ask the learner to apply them to the framework. Include starter state, exact run commands, expected behavior, progressive hints, and common-error recovery. No “to be written” chapters or implicit framework prerequisites.
Stage contract catalog Every stage has a stable ID, prior-stage prerequisites, observable inputs and outputs, and named checks. The book and runner agree on IDs, commands, and expected behavior.
Runnable local checker One documented command lists stages and one runs a selected stage. It reports what it tried, expected versus actual evidence, and a non-success result for missing dependencies or failed checks. Checkpoints and failure messages are verified before publication.
Starter and fixtures Empty-repository setup is documented and repeatable. Any provided skeleton has no stage solution. Course-owned tests, event traces, and geometry fixtures are separate from learner code. Font fixtures, if any, have a known license and a fixed version.
Source companion Each mechanism has a relevant GPUI-CE permalink with file and symbol, a short execution trace, and an explicit note on what the course borrows or changes. Generic tooling stages are marked as such rather than forced into a GPUI comparison.
Release verification report Names the revision tested, dependencies, commands, passing and failing fixtures, and blocked or untested lanes. No “complete” claim until the core book and checker pass the release gates below.

3. Match the reference by behavior, not branding

CodeCrafters’ official workflow says checks initially fail and submissions pass stages by satisfying tests. Its published HTTP challenge definition shows narrow, behavior-named stages such as “Bind to a port” and “Respond with 200,” not one large networking assignment. Its writing guide specifies Hook → Explanation → Tests → optional Notes, and its public tester checks real behavior and tests the checker itself. The direct adaptation is a small contract, a red run, a learner change, and a green run. Replace remote submission with a local checker; do not imply hosted infrastructure or equivalence to CodeCrafters’ full editorial review.

The Learn WebGPU reference is a second, distinct target: explain unfamiliar primitives at the point of use, give a minimal working context for the next edit, and make the outcome visible quickly. Its first-triangle chapter is a concrete example. Use it for instructional depth and quick feedback, not as a reason to turn the course into a guided copy of the solution. COURSE-RESEARCH.md captures the detailed comparison and access limits.

Beginner teaching standard

Assume the learner can program and has some C/C++ experience. Assume no prior XCB, desktop windowing, render pipeline, layout-engine, UI routing, or Rust knowledge. Teach a C++ or systems concept when first used, not in a detached prerequisite lecture. A description such as “fetch the screen, allocate an ID, map and flush” lists requirements; it does not teach someone to use those APIs.

Give each stage this learning path:

  1. See the outcome. Show a tiny transcript, diagram, visual, or before/after. Name the one behavior the stage adds and what the learner already has. A checker contract can be visible early; it is not the first required action when the learner lacks the foundation.
  2. Learn one mechanism. Trace a concrete example: who owns what, what goes in, what comes out, what can fail, and how to observe it. Explain only the vocabulary that the example needs. Mark prerequisites that were actually taught in an earlier stage.
  3. Run a worked C++20 example. Give runnable code for a smaller or related operation, outside the learner's framework source. Include file names, includes, build/link commands, and output, then explain the important calls, arguments, status checks, ordering, and cleanup. Show one change the learner can make and immediately observe. Examples may be complete; they must not be drop-in solutions for the framework challenge.
  4. Apply it to the framework. Specify the learner's starting code and where the change belongs. Give one independent implementation task with an observable contract; split it into stages if it requires several unfamiliar mechanisms at once. Run the starter check, make the change, and rerun. Keep GPUI-CE source traces as optional comparisons rather than prerequisites.
  5. Get unstuck. Offer hints in order: what to inspect → relevant mechanism or API and how to observe it → pseudocode or a small related code fragment. Include common errors with likely causes and a quick diagnostic. Keep actual framework solutions out of the main path; don't hide a prerequisite explanation in a hint.
  6. Verify and connect. Show expected failing and passing observations, what the check does not prove, and how this increment will be reused. In mentoring, wait for the learner's result before moving on.
Area Beginners must have been shown before the challenge
Native platform Client, server, display, screen, and root window are distinct; how a resource ID and checked request behave; why create, map, and flush are separate; how to release owned handles and received events.
Frame and paint Where a frame's pixels live and what presents them; coordinate direction, row stride and bounds; why clipping is a memory-safety rule as well as a drawing rule.
Elements and layout How one parent supplies a constraint and one child returns a size; the difference between measuring, placing, clipping and drawing; a concrete nested example before a general tree.
Input and state Where one raw event enters, how it finds a target, and what focus changes; why model state outlives an element; why a state change requests, rather than immediately performs, drawing.
Text How one character maps to a glyph, what an advance and a baseline are, and how a glyph mask reaches the frame; the difference between this course's text subset and a general text engine.

Stage acceptance has two independent gates. The checker must distinguish correct and plausible incorrect implementations. Separately, the example must build and produce the documented output from a clean start, and a reader with no subsystem experience must be able to start the stage, interpret a failure, and attempt the framework task without relying on the chat to supply missing setup or API usage. Checker verification does not substitute for learner review.

Keep the course usable offline: external links substantiate design claims, not replace instructions. Maintain Markdown sources and generate the HTML handbook from them. In the HTML, keep the worked example, framework task, check, and hints easy to distinguish. Benchmark quality with an actual learner walkthrough of the vertical slice before scaling prose. If no learner has piloted it, call it untested with learners, not CodeCrafters-equivalent.

4. Execution sequence with gates

Phase Work Gate: do not move on until…
A. Freeze the edition Define the learner profile, platform/tooling, capstone behavior, and explicit exclusions. Record preserved project decisions and the isolated GUI-test approach. Every promised feature serves the capstone or a named prerequisite. Every uncertain dependency has a probe or a fallback.
B. Design the stage contracts Work backward from the capstone, then order small increments: bootstrap → display connection → visible window → close event → frame and resize → clipped paint → layout → hit testing → focus → invalidation → text and app integration. Split stages if a failure would have multiple plausible causes. Each stage adds one identifiable behavior and can be checked independently of any later chapter. Every earlier check is assigned a regression policy.
C. Build and prove a vertical slice Author bootstrap, the first substantive stage, and at least one window lifecycle stage. Implement only course infrastructure: preflight, runner, fixtures, and diagnostics. Use disposable verification fixtures, not learner files. Untouched starter goes red for the expected behavior; a known-good fixture goes green; missing dependencies, wrong binary paths, and missing display produce correct non-pass diagnostics. Demonstrate one actual isolated desktop check before committing to more GUI-dependent stages.
D. Write and verify the entire track Draft remaining stages in dependency order, adding executable checks with each stage. Verify authoritative sources and pin links. Use prose walkthroughs for engineering concepts and targeted examples, not complete learner implementations. Every written contract has a runnable check or is explicitly a supplemental manual observation. A later stage can be reached from the previous accepted state without an undocumented edit.
E. Clean-room rehearsal and release Run from a clean environment and the current baseline, exercise the checker with known-good and intentionally wrong fixtures, build the teaching examples, and rehearse the capstone. Have a beginner to the subsystem follow early, middle, and late lessons without chat context. First-time setup, example runs, ordering, failure recovery, regression policy, and capstone checks are demonstrated. Resolve reader blockers. If learner evidence is missing, keep the release status provisional.

Candidate regression policy: When an early interface must remain stable, rerun the early checks in later stages. When a probe is intentionally replaced by a larger behavior, name the replacement, preserve an explicit probe mode if useful, or test the invariant at a lower-level seam. Do not make a learner keep an obsolete startup message merely to satisfy a stale test.

Proposed Phase C proof: a stage contract, not another lesson draft

Stage Checker action Required observation
setup-build Configure using Unix Makefiles, build, resolve the configured artifact, and run the bootstrap program with a timeout. Exit 0 and gpui-cc ready. Later stages retain the build check, not that literal greeting.
display-connect Run the program with DISPLAY removed, then on a verified isolated X server. Capture separate streams and exit statuses. Without a display: exit 1 and diagnostic on stderr. With a usable display: exit 0. The failure lane is runnable even if the success lane is blocked.
window-map Start the program on the isolated server and query that server for the agreed window identity and viewable state. A real mapped, viewable window exists before the deadline. Simply printing a title or exiting with 0 fails.
window-close After the window is observable, deliver the agreed close event in isolation and wait for the same child process. The child exits 0 before a deadline. Detection of a hanging or missing child is reported separately from window creation.

For each candidate, capture a baseline failure and a known-good pass before expanding the course. Test at least one near miss too: a program that always exits successfully, a program that logs a window title but does not map a window, or one that ignores the close event. Fixture code used to verify the checker is separate from student code. The rows above specify proposed checks, not observed results or assignments to start now.

5. Built-in failsafes

Failure mode Control and verification
Another outline is presented as the book. Maintain a stage inventory with contract / prose / checker / verified fields; release only when every core entry is complete. A vertical slice is a prototype, not the book.
An environment error looks like a C++ bug. Preflight reports the generator, dependencies, configured executable path, and display/test capability. Distinguish FAIL (behavior observed and wrong) from BLOCKED (could not run); neither is a pass. Print remediation alongside the diagnostic.
A stale executable passes. Build first, stop on build failure, and run the exact executable from the selected configure tree/output configuration. Test this by pairing a broken compile with an existing binary. Use scratch paths for verification to avoid mixing project artifacts.
GUI tests are flaky or affect the real desktop. Run automated windows and input under a dedicated X server. Use readiness events or bounded checks, not fixed sleeps. Run under a test window manager if the test needs WM behavior; otherwise send the documented protocol event directly. On timeout, report the last observation and clean up only runner-owned children. Never inject input into the user’s regular DISPLAY.
GUI tests quietly don’t run. Headless tests run separately. GUI checks report BLOCKED if isolation is missing; manual desktop checks may help diagnose but do not replace the release gate.
The test rewards a print statement or one hard-coded fixture. Observe real window/protocol behavior where practical. For pure logic, exercise the same core as the native demo and use multiple cases; if using generated inputs, report a replayable seed. Prove checks reject plausible wrong implementations: one-sided clipping, stale hit bounds after resize, and a missing redraw or an idle redraw loop.
Visual checks differ by host. Use exact pixels for controlled CPU fixtures, not the compositor desktop or system fonts. Pin font assets when exact text behavior matters; otherwise check invariant metrics or visible outcomes rather than fragile full screenshots.
A stage tests implementation details instead of teaching a contract. Test public behavior or a documented narrow test seam. Accept equivalent ownership, data structures, or traversal that preserves behavior. Review lifetimes and failure cleanup separately where they are not directly observable.
The reference drifts or an analogy becomes a false claim. Pin GPUI-CE links, read the implementation before making comparisons, and label facts versus course design. “GPUI does this” and “we choose this” must be separate statements.
The course writes the answer or leaks it through tests. Keep checking infrastructure separate; public fixtures describe observable behavior. Review starter files and escalating hints against the stage objective before publishing. Never overwrite learner source to introduce a new chapter.

6. Verified inputs and what still needs proof

  • The current baseline is a Git project on main; the previous course draft is untracked. The executable, CMake setup, and chosen output convention are already in place. This planning pass does not change them.
  • This workspace has C++, CMake, Make, GDB, Python 3, and pkg-config; XCB, xkbcommon, FreeType, and HarfBuzz are discoverable. DISPLAY and WAYLAND_DISPLAY are set. This does not establish that either display is usable for testing.
  • Xvfb and xvfb-run were not on PATH. The Phase C pilot proved isolated mapping and closing using a signature-verified Xvfb executable extracted to scratch; see the verification report. This is not evidence for later GUI stages or a window-manager close button.
  • At GPUI-CE commit 1fe3d947698287f3ba50ef074a3eadd1ad46b84c, initial anchors were located for X11 connection, Element lifecycle, mouse dispatch, and Context::notify. These are starting points for stage-specific traces, not proof of full subsystem analysis.

Next execution gate: Rehearse the published lessons from a clean start, one stage at a time. Record beginner blockers, observed results, and capstone evidence rather than assuming checker and example QA proves the course teaches well.