writeonce/docs/examples/employee
shoney.arickathil 6a234c552a docs: employee-list sample -- program B's manifest pair (9c/9d target)
- docs/examples/employee-list: attaches to the running employee
  program; modes list / report (byte-identical to A's own) /
  staff <dept> / probe-write (registered read-only, insert must trap
  access-denied, exit 4, A unchanged)
- the manifests ARE the design, written as a pair: A's [share] gains
  listen = unix socket beside WO_DATA plus [[share.clients]] naming
  B's public-key fingerprint with rights = "read"; B's
  [connect.employee] carries A's ipc string, A's PINNED fingerprint,
  and project = ../employee for compile-time shapes -- the connect
  section's name is the code's namespace (employee.Employee)
- fingerprints are PASTE-HERE placeholders by design: keys generate
  into WO_DATA at first boot (9d), tomls carry fingerprints only,
  printed by --identity
- sample-first: compiles after 9/9b/9c/9d; README maps each mode to
  the acceptance line it exists for; 9c/9d stories now name this
  sample as their workload

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 12:34:19 +02:00
..
main.wo docs: employee sample (target workload) + engine moves to database/ 2026-08-15 09:49:54 +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.