- docs/examples/employee: Department/Employee @table classes with
@unique, [dept] and [dept, salary] indexes, ref/backlink pair;
modes seed/report/staff/raise/drop per the 9b spec section 6 —
written AHEAD of the features (sample-first, like log-watcher);
README states it does not compile on today's toolchain and links
the plans that compile toward it
- report mode is the GroupBy showcase: group-and-reduce projection
{headcount, avg, min, max} ordered by avg desc, whole-query sum
for payroll; staff proves both navigation directions + index probe;
drop proves delete restrict (trap asserted)
- engine directory decision (user, 2026-08-15): database/ is its own
top-level dir, statically linked into wovm — file structures updated
in the iteration-9 plan and the 9b plan
- gap found by writing the sample: iteration 9's subset lacks a
`delete` statement and restrict needs one — added to 9b plan Task 3
- 9b plan Task 6 notes the sample is pre-authored and authoritative
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| main.wo | ||
| README.md | ||
| types.wo | ||
| wo.toml | ||
employee — the database track's acceptance workload
Status: target workload — does not compile on today's toolchain. This sample is written ahead of the features it exercises, exactly as log-watcher was written ahead of iterations 5–7: the sample is the test, and the plans compile toward it. It becomes buildable when iteration 9 (engine:
2026-08-01-db-engine-binding.md) and iteration 9b (query surface:2026-08-15-employee-relations-query.md) land. Normative semantics: the 9b spec.
Two @table classes and every 9b feature load-bearing:
| Mode | What it proves |
|---|---|
employee seed |
insert + WAL-before-ack; a second run catches the departments.name @unique trap (SEED-DUP, exit 3) |
employee report |
group … by … into g lowered as one hash pass; count/avg/min/max per department; order by avg(g.salary) desc; whole-query sum for payroll |
employee staff <dept> |
unique-name index probe (asserted via the engine's probe counter, not assumed), backlink scan one way, e.dept.name ref navigation the other |
employee raise <dept> <pct> |
update through a query result; a missing department takes the empty-query path |
employee drop <dept> |
delete restrict: a department with staff traps (exit 4); the trap code is the acceptance's assertion |
The engine lives in database/ (statically linked into wovm — still one
binary). Rows are RAM-authoritative, WAL-durable; a kill -9 between seed
and report followed by an identical report is part of the acceptance
script (iteration 9's replay, proven on this workload).
Data shape: Department { name @unique, staff: backlink Employee.dept },
Employee { name, salary (cents), hired (epoch ms), dept: ref Department },
indexes [name], [dept], [dept, salary]. Salaries wrap like all language
arithmetic; avg/min/max are ?Int because an empty group is data, not
a fault.