journal: ct.4 canonical-type-names milestone close

This commit is contained in:
2026-05-11 10:12:27 +02:00
parent ba48349052
commit 72ec572c3d
+126
View File
@@ -14380,3 +14380,129 @@ Out of scope this iter, deliberately:
Workspace at iter-ct.3 close: full `cargo build --workspace` and
`cargo test --workspace` green (451 tests, 0 failed). Test count
unchanged from ct.2 — this iter is pure code deletion + doc tidy.
## 2026-05-11 — Iteration ct.4: canonical-type-names milestone close
Four tasks landed, plus one inline doc-tidy, closing the
canonical-type-names milestone:
- **ct.4.1** (`61ad3e3`): amended DESIGN.md Decision 2 with the
canonical Type::Con name scoping rule. Bare = local to the
file's owning module; qualified `<owner>.<TypeName>` =
explicit cross-module; primitives are bare. The class-name
exception is named in DESIGN with a forward pointer to the
later milestone that will retire it. The hash-stability
paragraph at the surrounding "iter19b regression-pinned by"
citation was updated to name the two new ct.4 pins.
- **ct.4.2** (`1d039b7`): added two pin tests in
`crates/ailang-core/src/hash.rs`.
`ct4_migrated_fixtures_have_canonical_form_hashes` locks the
post-migration hashes of `ordering_match.ail.json`
(`8d17235aa3d2e127`) and `test_22b1_dup_a.ail.json`
(`1c2573661ffd3da3` for the Show class def,
`cc8685f92f246e40` for the Show instance def — indexed access
because `Def::name()` returns the class name for both).
`ct4_unmigrated_fixtures_remain_bit_identical` re-asserts
`sum.sum` and `list.IntList` did not drift across the
canonical-form tightening.
- **ct.4.3** (`06bc5f0`, doc-tidy `b651b1e`): threaded
`owning_module: &str` through every recursive `write_*` fn in
`crates/ailang-prose/src/lib.rs`. Type::Con's name now gets
its qualifier trimmed when the owner matches the current
file's module. Two new unit tests pin the trim-applies and
trim-doesn't-apply directions. One new snapshot fixture
`examples/ordering_match.prose.txt` is committed.
Implementer surfaced a plan-error: the prose printer ELIDES
`Term::Ctor.type_name` entirely (the type is recoverable
from typecheck context), so the trim has no analogue there.
The fixture's `prelude.Ordering` ref is on a Term::Ctor and
therefore does not appear in the snapshot — qualifier-trim
coverage is the two unit tests, the snapshot pins
the overall print shape.
- **ct.4.4** (`ba48349`): recreated
`examples/compare_primitives_smoke.ail.json` — the
iter-23.3-Task-4 demonstration fixture. 9 calls to bare
`compare` (Int / Bool / Str × 3 pairings each), 9 prints,
expected stdout `1\n2\n3\n1\n2\n3\n1\n2\n3\n`. One new E2E
test in `crates/ail/tests/e2e.rs` asserts the stdout
verbatim. The IR-shape test originally planned was DROPPED:
`emit-ir` CLI bypasses `monomorphise_workspace`, so the
`compare__Int` / `compare__Bool` / `compare__Str` mono
symbols are unobservable via that path. The E2E stdout
assertion is the load-bearing proof — if any of the three
mono symbols were missing, the run would fail. The IR-shape
test is logged as a P3 follow-up.
Plan-level adaptation: the plan said to use qualified
`prelude.compare` for the class-method call. Implementer
correctly switched to bare `compare`. Class methods resolve
via `env.class_methods` (workspace-flat, bare-keyed); the
qualified `prelude.compare` path would route through
`env.module_globals[prelude].fns`, which does NOT contain
class methods. The bare convention matches the existing
`eq_primitives_smoke.ail.json` precedent.
The canonical-type-names milestone closes:
- The structural invariant: every `Type::Con` and
`Term::Ctor.type_name` in canonical `.ail.json` is either
bare (= local to the file's module) or qualified
(`<owner>.<TypeName>`, with primitives bare).
- The four obsolete imports-fallback / overlay mechanisms named
in the ct.1 catalogue are gone: `Pattern::Ctor`
imports-fallback (ct.2.2), `Term::Ctor` synth imports-fallback
(ct.2.3), codegen `lookup_ctor_by_type` imports-fallback
(ct.3.1), mono `apply_per_module_ctor_index_overlay`'s
`env.ctor_index` half (ct.3.2 narrowing).
- The iter-23.1 / iter-23.3-Task-4 bug-class is empirically
closed: the smoke fixture compiles, runs, and prints the
expected 9-line output end-to-end without any further
compiler changes.
Iter 23.3 Task 4 + Task 5 (the paused fixture-recreate + JOURNAL
work) are formally complete: the fixture is at
`examples/compare_primitives_smoke.ail.json`, the E2E test is at
`crates/ail/tests/e2e.rs::compare_primitives_smoke_prints_1_2_3_thrice`,
and the JOURNAL entry is this paragraph block.
Skill-system pipeline next steps:
1. `audit` (mandatory at milestone close): architect drift
review against `docs/specs/2026-05-10-canonical-type-names.md`
and DESIGN.md; bench regression diagnostics; optional
rustdoc cleanup.
2. `fieldtest` (after audit closes clean): real-world `.ailx`
examples written against DESIGN.md only, exercising the
canonical-form rule from the LLM-author surface.
Out of scope at milestone close, logged as follow-ups:
- **[P3]** Codegen `lookup_ctor_in_pattern` (lib.rs:1790) —
imports-walk with no scrutinee type to type-anchor. Plumbing
scrutinee Type through pattern lowering would type-anchor it
symmetric to the ct.2.2 typecheck-side fix.
- **[P3]** `compare_primitives_smoke` IR-shape assertion —
observe `compare__Int` / `compare__Bool` / `compare__Str`
symbols in the emitted IR. Blocked on `emit-ir` CLI not
running mono; three resolution paths (extend the CLI, use
library APIs directly in e2e.rs, add `--dump-ir` to `ail
build`) all need their own scope.
- **[P2]** Class-name canonical-form scoping — the
`MethodNameCollision` workaround at
`crates/ailang-core/src/workspace.rs:472` keeps bare class
names viable; type-driven method dispatch is a separate
milestone (already on the roadmap).
- **[P2]** `check_in_workspace`'s analogous per-module overlay
in `crates/ailang-check/src/lib.rs:1234` — the env.ctor_index
half there serves the duplicate-detection diagnostic at
workspace-build time, not the runtime ctor lookup; out of the
canonical-form scope but a clean tidy when context returns to
the typecheck pipeline.
Workspace at iter-ct.4 close: full `cargo build --workspace`
and `cargo test --workspace` green (457 tests, 0 failed — net
+6 over ct.3's 451: 2 pin tests in hash.rs, 2 prose trim unit
tests, 1 prose snapshot, 1 E2E test).