Skip to content

Commit 1f96bca

Browse files
committed
docs(adr-015): settle the S4 / S5 / S6c numbering drift (#180)
The ADR's staged plan in META.a2ml and its mirrors in TECH-DEBT.adoc / ECOSYSTEM.adoc / SETTLED-DECISIONS.adoc had drifted into a confused state where S5 was described in two contradictory ways: * ADR-015 (canonical, META.a2ml): S5 = `wasi:filesystem` (unblocks INT-06). Original S4 wording: "native `wasi:clocks` + environment + argv via preview2, replacing the preview1 shims behind the component path." * TECH-DEBT + ECOSYSTEM (post-S4b): "Remaining: S5 (native preview2 clocks/env/argv replacing the preview1 shims)" — i.e. the ledger had quietly re-purposed S5 to mean what the ADR's S4 originally promised, and pushed `wasi:filesystem` off the visible plan. Root cause: what shipped as `S4a` (clock_now_ms) and `S4b` (env_count, arg_count) did NOT fulfil the ADR's original S4 — those slices emitted preview1 shims (clock_time_get, environ_sizes_get, args_sizes_get) and rely on the preview1->preview2 adapter to bridge to wasi:clocks / wasi:cli, instead of having codegen emit native preview2 calls. That's a defensible choice (the bridging is free, preview1 stays the default until S6c, source-to-source targets are untouched), but it left the ADR's S4 wording untrue and pulled the ledger into a half-baked S5-redefinition to compensate. Resolution: amend ADR-015 to record what S4 actually shipped, restore S5 = `wasi:filesystem` everywhere, and document the native-preview2 codegen cleanup as a bundled step inside S6c (since switching from `wasi_snapshot_preview1.*` imports to `wasi:clocks/monotonic-clock` / `wasi:cli/environment` / `wasi:sockets/tcp` calls only pays off once preview2 is the default). The amendment is explicit — the ADR is honest about the divergence rather than pretending it didn't happen. Files: - .machine_readable/6a2/META.a2ml (ADR-015 canonical): S4 rewritten to "DONE, preview1-shim, NOT native preview2"; S6c gains the native-preview2 bundled cleanup; consequences line corrected ("preview1 retained as the default through S6b; flip at S6c"). - docs/TECH-DEBT.adoc INT-03 row: "Remaining: S5 (filesystem) + S6c (flip + native cleanup bundle)" replaces the S5 = native- preview2 framing. Notes ADR-015 in META.a2ml is canonical. - docs/ECOSYSTEM.adoc INT-03 row: same correction. - docs/specs/SETTLED-DECISIONS.adoc staged-plan summary line: S4 / S5 / S6c restated to match the ADR. No code changes; numbering only. The shipped S4a, S4b, S6a, S6b slice labels in prior commit messages remain accurate — this commit only changes how the *remaining* plan is described, plus the ADR's historical record of S4. Refs #180
1 parent 81d9fc7 commit 1f96bca

4 files changed

Lines changed: 64 additions & 22 deletions

File tree

.machine_readable/6a2/META.a2ml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,22 @@ Staged plan (ledger INT-03; each row = one gated PR):
985985
post-codegen step wraps it with the standard preview1->preview2
986986
adapter into a component; ownership section survival asserted;
987987
wasmtime component-run smoke. Codegen unchanged ⇒ reversible.
988-
- S4: native `wasi:clocks` + environment + argv via preview2 (wasmtime
989-
host-testable), replacing the preview1 shims behind the component path.
988+
- S4 (DONE, slices S4a clock + S4b env_count/arg_count): on-demand
989+
preview1 imports (`wasi_snapshot_preview1.clock_time_get`,
990+
`environ_sizes_get`, `args_sizes_get`) via the Effect_sites
991+
pre-scan, canonical-order indexing through
992+
`ctx.wasi_func_indices`. NOTE divergence from this ADR's original
993+
S4 wording ("native `wasi:clocks` + environment + argv via
994+
preview2"): the slice shipped as preview1-shim, NOT native
995+
preview2 calls. This is sufficient under the component path
996+
because both adapters bridge the preview1 imports to
997+
`wasi:clocks` / `wasi:cli` internally; switching the codegen
998+
to emit `wasi:clocks/monotonic-clock@0.2.x.now()` directly only
999+
pays off once preview2 is the default (deferred into S6c). The
1000+
ADR is amended here to record what actually shipped rather than
1001+
pretending S4 fulfilled the original wording. String accessors
1002+
(env_at/arg_at) need byte-level wasm IR (I32Load8U/I32Store8) for
1003+
buffer marshalling and remain a tracked follow-up.
9901004
- S5: `wasi:filesystem` (open/read/write/close) — unblocks INT-06.
9911005
- S6a (WIT export lifting, DONE): codegen emits a `_start : () -> ()`
9921006
shim that calls `main` and drops its i32 result whenever a
@@ -1013,11 +1027,19 @@ Staged plan (ledger INT-03; each row = one gated PR):
10131027
/ network-address marshalling and remain a tracked follow-up
10141028
alongside env_at/arg_at.
10151029
- S6c: flip the default wasm target to component and demote the
1016-
preview1 stdout path to a named legacy target.
1030+
preview1 stdout path to a named legacy target. Bundled cleanup:
1031+
replace the on-demand preview1 shims emitted by S4a/S4b/S6b
1032+
(clock_time_get, environ_sizes_get, args_sizes_get,
1033+
sock_shutdown) with native preview2 calls
1034+
(`wasi:clocks/monotonic-clock`, `wasi:cli/environment`,
1035+
`wasi:sockets/tcp`) — this only pays off once preview2 is the
1036+
default, hence its placement here rather than as a standalone
1037+
pre-flip slice.
10171038
"""
10181039
consequences = """
10191040
- End-state is one-way (the component model becomes the canonical wasm
1020-
target) but reversible-in-progress: preview1 retained through S5.
1041+
target) but reversible-in-progress: preview1 retained as the default
1042+
through S6b; the flip happens at S6c.
10211043
- S3..S6 are HARD-GATED on S2 (toolchain). Tracked as a follow-up
10221044
issue; this is disclosed, not hidden.
10231045
- typed-wasm ownership-section ABI is unchanged; the coordination

docs/ECOSYSTEM.adoc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,16 @@ wasmtime real-host invoke exits 0 on `net_shutdown(stdin, RDWR)`
242242
network-address marshalling — tracked alongside env_at/arg_at.**
243243
String accessors (env_at/arg_at) gated on a
244244
byte-level wasm-IR extension (I32Load8U/I32Store8 absent today)
245-
— tracked as the next slice before/with S5 filesystem. Remaining
246-
sub-slices: S5 (native clocks/env/argv via preview2), S6c
247-
(flip the default wasm target from preview1 → component). WIT
248-
world of record: `wit/affinescript.wit`
245+
— tracked as the next slice before/with S5. Remaining sub-slices
246+
(per ADR-015 canonical numbering in META.a2ml): S5 — bring up
247+
`wasi:filesystem` (open/read/write/close), which unblocks INT-06
248+
(server-side runtime profile); S6c — flip the default wasm
249+
target from preview1 → component, bundled with the optional
250+
native-preview2 cleanup that replaces the on-demand preview1
251+
shims emitted by S4a/S4b/S6b with direct `wasi:clocks` /
252+
`wasi:cli` / `wasi:sockets` calls (only pays off once preview2
253+
is the default, hence the bundling). WIT world of record:
254+
`wit/affinescript.wit`
249255
|INT-04 |Publish compiler + runtime to JSR (then npm) |#181 |runtime
250256
packaging READY (affine-js + affinescript-tea JSR dry-run green;
251257
manual-only `publish-jsr.yml`; docs/PACKAGING.adoc). INT-01 dep

docs/TECH-DEBT.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,15 @@ regression; wasmtime real-host invoke exits 0 on
220220
`net_shutdown(stdin, RDWR)` (returns ENOTSOCK, dropped). Larger
221221
socket primitives (recv/send/accept) need byte-level wasm IR for
222222
buffer / network-address marshalling and remain a tracked
223-
follow-up alongside env_at/arg_at.** Remaining: S5 (native
224-
preview2 clocks/env/argv replacing the preview1 shims), S6c
225-
(flip the default wasm target from preview1 → component)
223+
follow-up alongside env_at/arg_at.** Remaining: S5
224+
(`wasi:filesystem` — open/read/write/close; unblocks INT-06
225+
server-side runtime), S6c (flip the default wasm target from
226+
preview1 → component, bundled with the optional native-preview2
227+
cleanup that replaces the on-demand preview1 shims emitted by
228+
S4a/S4b/S6b with direct `wasi:clocks` / `wasi:cli` /
229+
`wasi:sockets` calls — only pays off once preview2 is the
230+
default, hence the bundling). ADR-015 in META.a2ml is the
231+
canonical numbering — TECH-DEBT mirrors it.
226232
|INT-04 |Publish to JSR/npm |S2 |#181 packaging READY (dry-run green,
227233
manual workflow); compiler-binary distribution decided = **ADR-019**
228234
(#260, Releases + thin Deno/JSR shim, staged S1..S4) — S1/S2/S3

docs/specs/SETTLED-DECISIONS.adoc

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,25 @@ change; *S2* toolchain provisioning (`wasm-tools`, `wasm-component-ld`,
301301
`wac`) — ABSENT today, a hard gate on S3+; *S3* componentize on-ramp
302302
(codegen still emits core wasm; post-step wraps it via the standard
303303
preview1→preview2 adapter; ownership-section survival asserted; wasmtime
304-
component-run smoke); *S4* native `wasi:clocks`/environment/argv; *S5*
305-
`wasi:filesystem` (unblocks INT-06); *S6a* (WIT export lifting) codegen
306-
auto-emits a `_start : () -> ()` shim around a parameter-less `fn main()`
307-
so `tools/componentize.sh --command` (preview1→preview2 *command*
308-
adapter) produces a real `wasi:cli/run`-exporting component that any
309-
WASI 0.2 host can invoke; *S6b* (sockets on-ramp) the `net_shutdown`
310-
builtin lowers to `wasi_snapshot_preview1.sock_shutdown` and the
311-
command adapter bridges to `wasi:sockets/tcp` internally — recv/send/
312-
accept gated on the same byte-level wasm-IR follow-up as env_at/arg_at;
313-
*S6c* flip the default wasm target to component and demote preview1 to
314-
a legacy target.
304+
component-run smoke); *S4* (slices S4a clock + S4b env_count/arg_count)
305+
on-demand preview1 imports for `clock_time_get`, `environ_sizes_get`,
306+
`args_sizes_get` via the Effect_sites pre-scan — the ADR is amended in
307+
META.a2ml to record this as preview1-shim (NOT native preview2 as
308+
originally worded); both adapters bridge to `wasi:clocks`/`wasi:cli`
309+
internally, native-preview2 codegen is deferred into S6c since it only
310+
pays off once preview2 is the default; *S5* `wasi:filesystem`
311+
(open/read/write/close — unblocks INT-06); *S6a* (WIT export lifting)
312+
codegen auto-emits a `_start : () -> ()` shim around a parameter-less
313+
`fn main()` so `tools/componentize.sh --command` (preview1→preview2
314+
*command* adapter) produces a real `wasi:cli/run`-exporting component
315+
that any WASI 0.2 host can invoke; *S6b* (sockets on-ramp) the
316+
`net_shutdown` builtin lowers to `wasi_snapshot_preview1.sock_shutdown`
317+
and the command adapter bridges to `wasi:sockets/tcp` internally —
318+
recv/send/accept gated on the same byte-level wasm-IR follow-up as
319+
env_at/arg_at; *S6c* flip the default wasm target to component and
320+
demote preview1 to a legacy target, bundled with the optional
321+
native-preview2 cleanup that replaces the on-demand preview1 shims
322+
emitted by S4a/S4b/S6b with direct `wasi:*` calls.
315323

316324
This decision is settled; do not reopen without amending the ADR. Full
317325
ADR in `.machine_readable/6a2/META.a2ml` (ADR-015); ledger INT-03 in

0 commit comments

Comments
 (0)