writeonce/docs/stories/language-runtime-database/06-program-mode-stdlib.md
shoney.arickathil 1fe808b7a4 docs(stories): add readiness, retire status: refine, sweep all 47 iterations
- `readiness: ready | refine` is a SECOND axis, orthogonal to status.
  `ready` = the brainstorm is complete and the decisions are LOCKED (a spec
  approved, or the forks explicitly confirmed). `refine` = open forks remain
  and it cannot be planned yet
- `status: refine` RETIRED because it carried both meanings at once, so a held
  iteration with an approved spec (language 18, 26) was indistinguishable from
  one nobody had thought about. status is now purely where the WORK is:
  done | in-progress | pending | hold — `pending` was already the board's own
  rendering word, so nothing new was invented
- all 47 iterations classified from EVIDENCE in their own text, not by guess:
  "the four forks are SETTLED" / "spec + plan approved" / "Approved spec:" for
  ready; "Forks the spec must settle" / "no spec exists yet" for refine. Every
  shipped iteration is ready by definition. 19 done, 5 in-progress, 15
  pending, 8 hold; 27 ready, 20 refine
- two iterations moved refine -> in-progress rather than -> pending: language
  31 and 34 are absorbed into 24 and work on them is literally happening, which
  the board already showed as 🔄 while their frontmatter said otherwise. That
  disagreement is now gone
- board legend, board-views' frontmatter contract, and two new Dataview
  queries updated — the useful one being `readiness: ready AND status:
  pending`, the startable set

WHAT THE NEW AXIS IMMEDIATELY SURFACED: of 15 pending iterations, exactly ONE
is startable — databasev2 4, io_uring group-commit, whose forks were confirmed
settled 2026-08-20. Everything else pending needs a brainstorm first. That was
invisible while one key carried both meanings, and it is now on the board.

Also caught by the sweep, unrelated to readiness but found by cross-checking
frontmatter against the board: SIX duplicate rows. Every iteration moved into
databasev2 was still listed in the LANGUAGE pending table under its retired id
(23, 32, 33, 20, 21, 27) as well as its new one. Stale copies removed. And two
databasev2 rows made claims the sweep contradicts — iteration 1 was billed
"startable today" while its forks are open, and 6 still called itself the
ceiling-raiser after 2 took that role.

Docs only. linkcheck 0 broken / 0 anchors.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 16:54:45 +02:00

72 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
iteration: "6"
status: done
readiness: ready
---
# Iteration 6 — program mode + systems stdlib
> Format: `product/story-iteration-template`. Part of
> [Story — one language, one runtime, one database, one binary](00-story.md).
> **Status (2026-08-14):** ✅ landed for the surface the driving workload uses —
> program mode (`fn main(args: multi Text) -> Int`, argv from the runtime, the
> return value as the exit code), the text/container builtins, and the OS half
> (`fs`, `time`, `env`, `net`, `proc`) with predeclared `Stat`/`TimeParts`/
> `Proc` records, plus `json` encode/decode over `.wob` v2 class metadata.
> What the workload never calls was not written. Two lifetime defects found
> here are being fixed as part of
> [`plan/compiler/2026-08-14-logwatcher-executable.md`](../../plan/compiler/2026-08-14-logwatcher-executable.md):
> the runtime's own argv container is never freed, and blocking `accept`/`read`
> ignore the stop signal.
## Goals
- writeonce stops being server-only: a project with a free
`fn main(args) -> Int` compiles as a CLI program with exit codes — the
daemon/tool shape log-watcher represents.
- Five typed builtin modules — `fs`, `proc`, `net`, `time`, `json` — give
programs system access with no FFI hole: bounded reads, args-array-only
process runs, TCP listen/accept, monotonic time, typed JSON decode.
- Every handle is an owned object whose drop closes it: RAII from the
ownership model, leaked fds impossible by construction.
## Acceptance Criteria
- What to achieve?
- **Given** a program with `fn main`,
- **when** `wo run` executes it and `woc build` packages it,
- **then** the return value propagates as the process exit code in both
forms, and SIGTERM flips `env.stopping()` without any callback
machinery.
- What to achieve?
- **Given** the stdlib corpus against real resources (tempdir files,
rename-simulated rotation, spawned trivial processes, loopback
sockets),
- **when** the suite runs under ASan,
- **then** all fixtures pass, and the fd-battery fixture (open many
handles in a loop) shows no fd-count growth.
- What to achieve?
- **Given** a JSON document missing optional fields or shaped wrongly,
- **when** `json.decode … as Record` runs,
- **then** missing optionals decode as nil, shape mismatches yield nil
overall, and no trap fires — expected absence is data, not error.
## Out Of Scope
- The log-watcher sample itself (iteration 7 proves this slice).
- UDP/TLS, fs mutation beyond append, signal callbacks, worker threads.
## Info
- One API, two disciplines: the same stdlib calls are blocking in program
mode and loop-integrated on server shards — no `async` keyword exists.
- Spec: `docs/superpowers/specs/2026-08-01-systems-track-design.md` Parts 2–3.
## Proposed Solution
- Execute the existing plan: `docs/superpowers/plans/2026-08-01-program-mode-stdlib.md`
(program entry + env module, time, fs with inode stat + bounded
`read_at`, proc.run with capped capture, net RAII handles, typed json,
sys corpus battery in the `oop-accept` gate).