writeonce/docs/examples/employee
shoney.arickathil 0a8ca03ccd chore: untrack employee build artifact, gitignore its target/
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 19:01:33 +02:00
..
justfile feat: FK restrict on delete + employee sample runs; group-by parked (9b) 2026-08-16 18:37:23 +02:00
main.wo feat: FK restrict on delete + employee sample runs; group-by parked (9b) 2026-08-16 18:37:23 +02:00
README.md docs: employee sample (target workload) + engine moves to database/ 2026-08-15 09:49:54 +02:00
types.wo docs: employee sample (target workload) + engine moves to database/ 2026-08-15 09:49:54 +02:00
wo.toml docs: employee-list sample -- program B's manifest pair (9c/9d target) 2026-08-15 12:34:19 +02:00

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.