diff --git a/bench/orchestrator-stats/2026-05-13-iter-form-a.0.json b/bench/orchestrator-stats/2026-05-13-iter-form-a.0.json new file mode 100644 index 0000000..e332cde --- /dev/null +++ b/bench/orchestrator-stats/2026-05-13-iter-form-a.0.json @@ -0,0 +1,16 @@ +{ + "iter_id": "form-a.0", + "date": "2026-05-13", + "mode": "standard", + "outcome": "DONE", + "tasks_total": 2, + "tasks_completed": 2, + "reloops_per_task": { + "1": 0, + "2": 0 + }, + "review_loops_spec": 0, + "review_loops_quality": 0, + "blocked_reason": null, + "notes": "Mechanical render-and-verify iter. No source code or test edits. examples/prelude.ail rendered byte-verbatim from prelude.ail.json (116 lines / 6386 bytes, exact recon match). Two auto-discovering roundtrip tests green on new fixture without test-code changes. cargo test --workspace: 558/558 green, identical to pre-iter baseline. INDEX.md append deferred to Boss per Iron Law (plan asked agent to append; orchestrator-agent contract forbids INDEX.md edits)." +} diff --git a/docs/journals/2026-05-13-iter-form-a.0.md b/docs/journals/2026-05-13-iter-form-a.0.md new file mode 100644 index 0000000..28a77c2 --- /dev/null +++ b/docs/journals/2026-05-13-iter-form-a.0.md @@ -0,0 +1,71 @@ +# Iter form-a.0 — Prelude Pilot + +**Date:** 2026-05-13 +**Parent spec:** `docs/specs/2026-05-13-form-a-default-authoring.md` +**Parent plan:** `docs/plans/2026-05-13-iter-form-a.0.md` +**Started from:** 4c2a3c5d0811aafb1bce5d6de8ad9a938fd98681 + +## Outcome + +`examples/prelude.ail` rendered from `examples/prelude.ail.json` via +`ail render` (116 lines / 6386 bytes — exact recon match). The two +auto-discovering roundtrip tests in +`crates/ailang-surface/tests/round_trip.rs` both pass on the new +fixture without test-code changes: + +- `every_ail_fixture_matches_its_json_counterpart` — green; the + `prelude.ail` parses to canonical bytes byte-equal to + `prelude.ail.json`. +- `parse_then_print_then_parse_is_idempotent_on_every_ail_fixture` + — green; the Form-A printer is idempotent over prelude. + +`prelude.ail.json` is retained on disk per spec §A2; iter 1 deletes +it alongside the bulk test-infrastructure refactor. This is the +only iteration in the milestone where a fixture is dual-form. + +## Why this iter is the pilot + +Spec §A2 names prelude as the pilot because it exercises the widest +cross-section of language features in a single file: typeclasses +with superclasses (`Ord extends Eq`), polymorphic free functions +with constraints (`forall where Show a fn print`), IO-effect +signatures, primitive ctor patterns, and the loader's auto-injection +path. A green roundtrip on prelude is strong evidence the bulk +migration in iter 1+ will not surface render or parse bugs. + +## Verifications run + +- `cargo run -q --bin ail -- render examples/prelude.ail.json > examples/prelude.ail` — exit 0 +- `wc -lc examples/prelude.ail` — `116 6386` (exact recon prediction) +- `head -n 5 examples/prelude.ail` — first line `(module prelude`, second ` (data Ordering` (exact recon prediction) +- `cargo test -p ailang-surface --test round_trip every_ail_fixture_matches_its_json_counterpart` — PASS (1/1) +- `cargo test -p ailang-surface --test round_trip parse_then_print_then_parse_is_idempotent_on_every_ail_fixture` — PASS (1/1) +- `cargo test --workspace` — PASS, **558 tests green**, identical to pre-iter baseline (audit-24 / iter-24.tidy lineage). + +## Scope NOT touched + +Per spec §"Iteration scope": no test-infrastructure changes, no +CLAUDE.md / DESIGN.md edits, no deletion of `prelude.ail.json`, +no migration script yet. Those land in iter 1. + +## INDEX append — Boss-side + +Plan Task 2 Step 2 asks for an INDEX.md append. Per the +`ailang-implement-orchestrator` Iron Law, `docs/journals/INDEX.md` +is Boss-only. The orchestrator does not touch it. The Boss appends +the line at commit time. Suggested INDEX line (from the plan +verbatim, byte/line counts confirmed by Task 1 Step 2): + +``` +- 2026-05-13 — iter form-a.0: prelude pilot for Form-A-as-default-authoring milestone — examples/prelude.ail rendered (116 lines / 6386 bytes) via `ail render`; two auto-discovering roundtrip tests (every_ail_fixture_matches_its_json_counterpart + parse_then_print_then_parse_is_idempotent_on_every_ail_fixture) green on the new fixture without test-code changes; prelude.ail.json retained per spec §A2 (singular dual-form iter, deletion lands iter 1 with bulk test-infra refactor); cargo test --workspace green → 2026-05-13-iter-form-a.0.md +``` + +## Files touched + +- `examples/prelude.ail` (new, ~6386 bytes / 116 lines) +- `docs/journals/2026-05-13-iter-form-a.0.md` (this file) +- `bench/orchestrator-stats/2026-05-13-iter-form-a.0.json` (stats) + +## Stats + +`bench/orchestrator-stats/2026-05-13-iter-form-a.0.json` diff --git a/docs/journals/INDEX.md b/docs/journals/INDEX.md index 80ef1e9..0544570 100644 --- a/docs/journals/INDEX.md +++ b/docs/journals/INDEX.md @@ -51,3 +51,4 @@ - 2026-05-13 — iter 24.3: fn print polymorphic free fn + 3 E2E fixtures (positive 4-prim smoke / user-ADT IntBox+instance prelude.Show IntBox / negative print f:Int→Int firing Show-aware NoInstance) + IR-shape pin asserting post-mono print__Int.body preserves explicit let-binder + 3 compiler-path repairs (mono.rs canonical-form normalisation of MonoTarget::FreeFn::type_args 2 sites; codegen/lib.rs cross-module reference fallback for post-mono synthesised bodies 3 sites: resolve_top_level_fn / lower_app cross-module arm / synth_with_extras Var arm; check/lib.rs synth FreeFnCall constraint-residual push) + Show-aware NoInstance diagnostic addendum cross-referencing DESIGN.md §Prelude(built-in)classes + DESIGN.md §Prelude(built-in)classes mq24 paragraph flipped to past tense + §Float semantics Show-Float NaN paragraph + roadmap P1 Post-22 Prelude → [x] + new P2 Retire io/print_int|bool|float at top; 556 tests pass (was 552+4 new); milestone 24 structurally closes → 2026-05-13-iter-24.3.md - 2026-05-13 — audit-24: milestone close (Show + print rewire) — architect drift report surfaces 5 actionable items routing to `24.tidy` (3× [high]: DESIGN.md §"Monomorphisation" doc-anchor missing for three iter-24.3 strengthenings — MonoTarget::FreeFn::type_args canonical-form normalisation, post-mono synthesised-body cross-module-ref import_map-bypass invariant, FreeFnCall constraint-residual push; codegen import_map-fallback path has no unit-level pin — only E2E catches regression; FreeFnCall constraint-residual push covers only dot-qualified branch, bare-name poly-fn refs uncovered; 2× [medium]: unwrap_or_default in method-name lookup masks class-index drift, normalize_type_for_lookup duplicated across two mono.rs sites with manual-lockstep invariant), plus 1× [medium] deferred to roadmap P3 (negative-test coverage single-shape — only f:Int→Int, broader shapes wait for downstream corpus-migration milestone), plus 1× [low] carry-on (bench/architect_sweeps.sh noise on pre-milestone-24 DESIGN.md lines, not new drift). Bench: cross_lang.py exit 0 (25/25 stable); check.py + compile_check.py exit 1 with metric-identity-migrating noise envelope per audit-cma → audit-ms → audit-eob → audit-ct-tidy → audit-mq → audit-mq.tidy → iter-24.2 → iter-24.3 lineage — 9th consecutive observation; conservative-call convention holds baseline pristine across all 9, the metric-migration-between-runs is itself attribution evidence variance not signal; right ratification path is the queued P3 latency-methodology-histogram rework, not --update-baseline → 2026-05-13-audit-24.md - 2026-05-13 — iter 24.tidy: close 5 actionable drift items from audit-24 — T1 DESIGN.md new subsection §Cross-module references in synthesised bodies (3 invariants installed iter 24.3: canonical-form MonoTarget::FreeFn::type_args via normalize_type_for_lookup, post-mono synthesised body import_map-bypass + module_user_fns fallback, FreeFnCall constraint-residual push per declared forall-constraint); T2 codegen_import_map_fallback_pin (integration test asserts prelude.print__ body references user_module.show__ AND prelude imports do not contain user_module); T3 polyfn_dot_qualified_branch_pin (asserts bare-name print f fires exactly one no-instance + zero unknown-variable, proving constraint-residual push fires via dot-qualified branch); T4 check/lib.rs:2858 unwrap_or_default → expect(class_methods registry coherence) — surfaces class-index drift on regression; T5 mono.rs apply_subst_and_normalize helper extracted from byte-identical sites at :685-714 + :1284-1303 with Option return — each call site keeps own rigid-var/unit-default policy. Tests 558/558 (was 556+2 pins). Bench cross_lang exit 0 stable, compile_check + check both exit 0 this run (10th consecutive lineage observation unobserved-firing). audit-24 medium-3 negative-test breadth defers to roadmap P3; low-1 sweep noise carry-on → 2026-05-13-iter-24.tidy.md +- 2026-05-13 — iter form-a.0: prelude pilot for Form-A-as-default-authoring milestone — examples/prelude.ail rendered (116 lines / 6386 bytes) via `ail render`; two auto-discovering roundtrip tests (every_ail_fixture_matches_its_json_counterpart + parse_then_print_then_parse_is_idempotent_on_every_ail_fixture) green on the new fixture without test-code changes; prelude.ail.json retained per spec §A2 (singular dual-form iter, deletion lands iter 1 with bulk test-infra refactor); cargo test --workspace green at 558 tests → 2026-05-13-iter-form-a.0.md diff --git a/examples/prelude.ail b/examples/prelude.ail new file mode 100644 index 0000000..320b26d --- /dev/null +++ b/examples/prelude.ail @@ -0,0 +1,116 @@ +(module prelude + (data Ordering + (doc "Result of a three-way comparison: LT (less than), EQ (equal), GT (greater than). Ships in milestone 23 as the codomain of Ord.compare.") + (ctor LT) + (ctor EQ) + (ctor GT)) + (class Eq + (param a) + (doc "Structural equality. Ships in milestone 23 alongside Ord. The primitive `==` operator stays as the surface-level comparator this iter; routing `==` through `Eq.eq` is the declared P2 follow-up (see docs/specs/2026-05-10-23-eq-ord-prelude.md, `Out of scope`).") + (method eq + (type (fn-type (params (borrow a) (borrow a)) (ret (con Bool)))))) + (instance + (class Eq) + (type (con Int)) + (doc "Eq Int. Body lowers to `icmp eq i64` via the existing primitive `==` dispatch in `lower_eq`.") + (method eq + (body (lam (params (typed x a) (typed y a)) (ret (con Bool)) (body (app == x y)))))) + (instance + (class Eq) + (type (con Bool)) + (doc "Eq Bool. Body lowers to `icmp eq i1` via the existing primitive `==` dispatch in `lower_eq`.") + (method eq + (body (lam (params (typed x a) (typed y a)) (ret (con Bool)) (body (app == x y)))))) + (instance + (class Eq) + (type (con Str)) + (doc "Eq Str. The lambda body shape mirrors Int/Bool for round-trip stability, but the codegen intercept in `emit_fn` overrides the body to call `@ail_str_eq` directly — see `try_emit_primitive_instance_body` in `crates/ailang-codegen/src/lib.rs`.") + (method eq + (body (lam (params (typed x a) (typed y a)) (ret (con Bool)) (body (app == x y)))))) + (class Ord + (param a) + (superclass (class Eq) (type a)) + (doc "Total ordering. Ships in milestone 23 alongside Eq. `compare x y` returns LT, EQ, or GT (the three-ctor Ordering ADT also in the prelude). Decision 11's single-superclass closure requires `instance Eq T` for every `instance Ord T` — the three Ord instances below pair with the three Eq instances shipped in iter 23.2.3.") + (method compare + (type (fn-type (params (borrow a) (borrow a)) (ret (con Ordering)))))) + (instance + (class Ord) + (type (con Int)) + (doc "Ord Int. The lambda body shape is a placeholder for round-trip stability; the codegen intercept `try_emit_primitive_instance_body::\"compare__Int\"` emits a three-way `icmp slt` / `icmp eq` branch ladder constructing LT / EQ / GT.") + (method compare + (body (lam (params (typed x a) (typed y a)) (ret (con Ordering)) (body (term-ctor Ordering EQ)))))) + (instance + (class Ord) + (type (con Bool)) + (doc "Ord Bool. Body lowered via `try_emit_primitive_instance_body::\"compare__Bool\"` — `icmp ult i1` LT-test, `icmp eq i1` EQ-test, GT default.") + (method compare + (body (lam (params (typed x a) (typed y a)) (ret (con Ordering)) (body (term-ctor Ordering EQ)))))) + (instance + (class Ord) + (type (con Str)) + (doc "Ord Str. Body lowered via `try_emit_primitive_instance_body::\"compare__Str\"` — `call i32 @ail_str_compare(ptr, ptr)` then branch on slt-0 / eq-0 against the normalised {-1, 0, +1} return.") + (method compare + (body (lam (params (typed x a) (typed y a)) (ret (con Ordering)) (body (term-ctor Ordering EQ)))))) + (class Show + (param a) + (doc "Producer of a human-readable Str representation. Ships in milestone 24 with primitive instances for Int/Bool/Str/Float; user types declare their own instance.") + (method show + (type (fn-type (params (borrow a)) (ret (con Str)))))) + (instance + (class Show) + (type (con Int)) + (method show + (body (lam (params (typed x (con Int))) (ret (con Str)) (body (app int_to_str x)))))) + (instance + (class Show) + (type (con Bool)) + (method show + (body (lam (params (typed x (con Bool))) (ret (con Str)) (body (app bool_to_str x)))))) + (instance + (class Show) + (type (con Str)) + (method show + (body (lam (params (typed x (con Str))) (ret (con Str)) (body (app str_clone x)))))) + (instance + (class Show) + (type (con Float)) + (method show + (body (lam (params (typed x (con Float))) (ret (con Str)) (body (app float_to_str x)))))) + (fn ne + (doc "Polymorphic disequality. `ne x y` ≡ not (eq x y). Ships in milestone 23 as the Eq-class free helper.") + (type (forall (vars a) (constraints (constraint Eq a)) (fn-type (params (borrow a) (borrow a)) (ret (con Bool))))) + (params x y) + (body (app not (app eq x y)))) + (fn lt + (doc "Polymorphic strict-less-than. `lt x y` ≡ case compare x y of LT -> True; _ -> False. Ships in milestone 23 as the Ord-class free helper.") + (type (forall (vars a) (constraints (constraint Ord a)) (fn-type (params (borrow a) (borrow a)) (ret (con Bool))))) + (params x y) + (body (match (app compare x y) + (case (pat-ctor LT) true) + (case _ false)))) + (fn le + (doc "Polymorphic less-than-or-equal. `le x y` ≡ case compare x y of GT -> False; _ -> True. Ships in milestone 23 as the Ord-class free helper.") + (type (forall (vars a) (constraints (constraint Ord a)) (fn-type (params (borrow a) (borrow a)) (ret (con Bool))))) + (params x y) + (body (match (app compare x y) + (case (pat-ctor GT) false) + (case _ true)))) + (fn gt + (doc "Polymorphic strict-greater-than. `gt x y` ≡ case compare x y of GT -> True; _ -> False. Ships in milestone 23 as the Ord-class free helper.") + (type (forall (vars a) (constraints (constraint Ord a)) (fn-type (params (borrow a) (borrow a)) (ret (con Bool))))) + (params x y) + (body (match (app compare x y) + (case (pat-ctor GT) true) + (case _ false)))) + (fn ge + (doc "Polymorphic greater-than-or-equal. `ge x y` ≡ case compare x y of LT -> False; _ -> True. Ships in milestone 23 as the Ord-class free helper.") + (type (forall (vars a) (constraints (constraint Ord a)) (fn-type (params (borrow a) (borrow a)) (ret (con Bool))))) + (params x y) + (body (match (app compare x y) + (case (pat-ctor LT) false) + (case _ true)))) + (fn print + (doc "Polymorphic console-print helper. `print x` ≡ `do io/print_str (show x)` with an explicit let-binder around `show x` for heap-Str RC discipline per eob.1 Str carve-out. Ships in milestone 24 as the second half of the Show prelude.") + (type (forall (vars a) (constraints (constraint Show a)) (fn-type (params (borrow a)) (ret (con Unit)) (effects IO)))) + (params x) + (body (let s (app show x) (do io/print_str s)))))