Guided Labs
Download the offline kit. It includes starter, reference, independent checks, contracts and an evidence template. Python 3.10+ and the standard library are sufficient; no network is used by the kit.
Extract, open a terminal in behavioral-patterns, and run:
python run_labs.py --impl starter --lab L01
python run_labs.py --impl reference
The untouched starter fails intentionally. Complete starter one lab at a time; do not import reference as a solution. Predict a trace before execution, then record a failure, correction, independent check and limitation. Correct code alone does not establish independent reasoning. Full contracts live in README.md and this page.
| Lab | Build and demonstrate | Independent check | Required transfer |
|---|---|---|---|
| L01 | Quote boundary, one policy call, exact units/types | 404 amount/rate cases and validation/failure traces | Callable versus stateful policy object; who owns cleanup? |
| L02 | Token subscriptions, idempotent disposal, snapshot delivery, nested rejection, reported failures | Duplicate registration and membership/error traces | Immediate removal policy and immutable versus shared payload |
| L03 | Text edits with undo/redo and immutable mementos | 1,296 four-action histories against version-list model | Cursor state, no-op edits, memory budget and outside edits |
| L04 | Workflow transition matrix and accepted-record replay | All 16 cells and 256 four-event sequences | State classes versus table; stale review-generation guard |
| L05 | Lazy pages and independent cursors | 27 three-page size configurations and fetch-failure/early-stop traces | Resource cleanup and finite versus unbounded empty pages |
| L06 | Ordered first-match decisions with explicit terminal denial | 64 three-handler outcome sequences plus malformed decisions | All-checks-required pipeline and duplicate continuation |
| L07 | Num/Add/Mul visitors for evaluation and formatting | 125 arithmetic trees plus nested-layout and dispatch cases | Add Count, then Neg; compare edit surfaces |
The checks enumerate finite domains. They do not prove arbitrary histories, crash durability, concurrency safety or absence of retained objects. Budget 24–36 focused hours including implementation, debugging and evidence. If a lab fails, repair the corresponding practice task and rerun a fresh case. The assessment requires explanations beyond these checks.
Runtime comparison: EventBus and Editor
After core L02/L03, complete this required second package. The first package's snapshot-membership and no-op expectations must not be copied unchanged into it. Read the policy comparison. Its implementation/evidence allowance is 5–8 additional focused hours when reusing the core foundations, within the 10–16-hour merged comparison allocation.
Download the lab archive, extract it and open behavioral-contracts. Python 3.10+ and the standard library suffice. Windows users can substitute py -3 for python3.
python3 check.py starter
Initial NotImplementedError is expected. Implement the public EventBus and Editor methods using the contracts in starter.py and runtime lessons R1–R4. Choose your representation; a class per command or state is not required. The API is single-threaded, synchronous and in-memory.
Before runtime implementation
Write expected traces for cancellation before a callback’s turn, registration during dispatch, nested publication, ordinary callback failure and close during dispatch. For the editor, draw the history after undo followed by invalid edit, no-op and real edit. Complete the trace practice first.
python3 run.py starter > results.json
Retain this report and additional traces from your failure cases. After an attempt compare reference.py and run python3 check.py reference. Checks include a separate past/present/future model over 1,296 four-action editor sequences, immutable snapshots, argument boundaries, subscription release and event lifecycle policies. Finite test success does not prove arbitrary callback behavior or thread safety.
Runtime submission
Provide your implementation, actual traces, a repaired failure, help/source record and a brief decision note. Compare one alternative policy (for example callback snapshots versus token snapshots with live cancellation), explain which test must change, and state the ownership and storage costs. Reproduce from a fresh extraction and defend a changed case without the reference.
Reuse this packet as a semester-project appendix and assess it with BD1–BD6. The original broader pattern practice remains required. Do not use this local lab to claim durable delivery, atomic external effects or safe remote retries.