- overview.md, core.md, emit.md, targets.md: modular spec set for the generalized engine (contexts + templates + partials -> text), with the three targets (ssr-html, bast-rust-codecs, call-handlers, wgsl-jit) as template sets plus emit postures - ADRs 001-010: one core/template-set split, handlebars 6.4 strict substrate, sync/wasm/deterministic posture, typed contexts with builders, per-registry escaper, SSR library posture, typed direct codecs output contract, template-set ownership, feature gating, library-only v1 - open-questions.md: OQ-01..OQ-08 centralized tracker carrying phase-0 residue (GN-01/02/07/09) with three deferred(scope) entries plus a resolved disposition for phase-0 OQ-GN-04 - tasks/architecture/: external-trigger tracker tasks paired with the deferred OQs (taskgraph validate passes) - phase-0.md checklist dispositioned for OQ-GN-04; AGENTS.md lifecycle updated to phase 1 Verification: taskgraph validate (4 tasks OK), cargo fmt --check, cargo test, em-dash grep clean; architecture-reviewer pass returned zero critical issues
2.4 KiB
2.4 KiB
ADR-003: Core posture: synchronous, wasm-clean, deterministic
Status
Accepted
Context
alkgen links into wasm-bound runtimes (alkjs), wasm browsers via handlebars' own playground precedent, and Rust services serving hostile traffic (alkforge, alkcall consumers). Three properties are prerequisites for all of those and far cheaper to keep than to retrofit: synchronous execution, wasm-cleanliness, and deterministic output.
Decision
The core (and everything engine-owned) is:
- Synchronous: no async, no tokio, no threads. Template rendering and context building are CPU-bound; there is no await anywhere.
- Wasm-clean: compiles to
wasm32-unknown-unknown. No filesystem access in lib code (templates embedded,dir_sourceoff-limits), nostd::time, no environment reads, no platform deps; the dep set is validated by an actual wasm build of every relevant dependency combination (skeleton verified 2026-11-06). - Deterministic: same registry contents plus same context values
produce byte-identical text. No hash-map iteration order leaks into
output; contexts preserve document order where order is semantic
(serde_json
preserve_order, AGENTS.md convention 5); no time or randomness in rendering. - Panic-free on inputs: typed errors instead of panics for malformed templates and malformed inputs.
Consequences
- Positive: determinism is what makes consumer-side caching safe to build (SSR content hashing), regeneration diff-quiet (posture A), and render output compilable (posture C); it is one property paying three ways.
- Positive: wasm-cleanliness is a supply-chain and deployment posture for the family (minimal, auditable build), not just a capability.
- Negative: no background refresh, no async caching, no wall-clock features. Consumers wanting those build them on their side; the engine's purity is the point, not a gap.
- Negative:
preserve_ordercosts allocation and must be preserved by every dependency that touches schema JSON; it is pinned because packed byte order depends on it downstream.