Moved PRELUDE_AIL const + parse_prelude fn to ailang-surface; re-exported from surface's lib.rs. surface::load_workspace rewritten 3-line shim-call → 7-line composition: load_modules_with → reserved-name check → inject parse_prelude → build_workspace(&["prelude"]). Five deletions in core: PRELUDE_JSON, load_prelude, load_workspace_with (the pd.1 shim), the top-level cfg(test) load_one fn, and the cfg(test) crate::load_module import. Production literal-"prelude" count in crates/ailang-core/src/ is now zero. Cross-form-identity preflight PASSED at module_hash 3abe0d3fa3c11c99 — parse(prelude.ail) ≡ deserialize(prelude.ail.json), so pd.3's deletion of the JSON is safe. Three new pin tests in ailang-surface/tests/: prelude_parse_pin (succeeds + min defs); prelude_module_hash_pin (cross-form-identity + literal-hex anchor); prelude_injection_pin (inject + reservation). Plan deviations (recorded in journal): switched the regression-pin fixture from non-existent examples/hello.ail.json to hello.ail; relocated 10 in-mod core tests to crates/ailang-core/tests/workspace_pin.rs because the dev-dep cycle (core ↔ surface) prevents in-mod aliasing in the lib-test target (form-a.1 T5 precedent); preserved load_one production-symbol-deletion by adding a test-mod-private load_one helper in core's mod tests for the 2 pd.1-introduced tests still consuming it. cargo test --workspace 573 green (+9 net from pd.1 baseline). bench/cross_lang.py + bench/compile_check.py exit 0; bench/check.py exit 1 with established noise envelope (bench_list_sum.bump_s, 13th consecutive observation; pd.2 is workspace-loader-only, no codegen touch — baseline pristine).
9.8 KiB
iter pd.2 — surface owns prelude embed; pd.1 shim retired
Date: 2026-05-14
Started from: 116157a2b8
Status: DONE
Tasks completed: 6 of 6
Summary
pd.2 moves the prelude embed (PRELUDE_AIL const + parse_prelude fn) and
the prelude-injection step (with the ReservedModuleName reservation) out
of ailang-core into ailang-surface, rewires surface::load_workspace
from the 3-line shim-call into the 7-line composition (load_modules_with → reserved-name check → inject parse_prelude → build_workspace(&["prelude"])),
and retires the pd.1 compatibility shim core::load_workspace_with along
with load_one, load_prelude, PRELUDE_JSON, and the #[cfg(test)] use crate::load_module; import. Cross-form-identity preflight (hash-equality
between parse(prelude.ail) and serde_json::from_str(prelude.ail.json))
PASSES at hash 3abe0d3fa3c11c99 — the load-bearing assumption that
justifies pd.3's deletion of prelude.ail.json is verified. Production
literal-"prelude" count in core/src/ is now zero. Test count: 573
green (from the pd.1 baseline of 564, +9 net = 3 new surface pins
[parse + hash + injection] + 6 tempdir/fixture relocations to
workspace_pin.rs minus 6 in-mod placeholders that became comments;
in-mod test deletion of the pd.1 shim test is offset by the
load_modules_with_custom_loader_is_called rename + 2 pd.1 tests that
now use an inline test-private load_one helper). bench/cross_lang.py
bench/compile_check.pyexit 0;bench/check.pyexit 1 with the 12-audit noise envelope (thebench_list_sum.bump_s+ tail-latency oscillation that has been observed in audits since audit-cma; pd.2 is a workspace-loader refactor with zero codegen / runtime touch). pd.3 will deleteexamples/prelude.ail.jsonplus theprelude_ail_and_json_parse_to_identical_modulepreflight, theinclude_str!carve-out incrates/ail/src/main.rs:472-484, thecarve_out_inventory.rs§C4(b) row, the form-a §C4(b) spec text, and themigrate-bare-cross-module-refsdefensive include.
Per-task notes
- iter pd.2.1:
pub const PRELUDE_AIL: &str = include_str!("../../../examples/prelude.ail");pub fn parse_prelude() -> Moduleadded near the top ofcrates/ailang-surface/src/loader.rs; both re-exported fromailang-surface/src/lib.rs. RED testparse_prelude_returns_module_named_prelude_with_min_defsfailed with the expected unresolved-import message, then GREEN. First-shot clean.
- iter pd.2.2:
crates/ailang-surface/tests/prelude_module_hash_pin.rswithprelude_ail_and_json_parse_to_identical_module(cross-form- identity preflight, load-bearing for pd.3) +prelude_parse_yields_canonical_hash(literal-hex anchor). Preflight PASSED first-run (the round-trip invariant from form-a.0 + form-a.1 was already exercising parse-then-print idempotency on every.ailfixture, so parse(prelude.ail) ≡ deserialize(prelude.ail.json) was not an accident). Hash3abe0d3fa3c11c99captured at pd.2 close. - iter pd.2.3:
surface::load_workspacerewritten 3-line → 7-line composition; imports updatedload_workspace_with→ bareWorkspace, WorkspaceLoadErrorwithload_modules_with/build_workspacefully-qualified inline; module rustdoc rewritten to name the new injection point + the implicit-imports list. Regression-pin testssurface_load_workspace_injects_prelude_into_every_workspacesurface_load_workspace_rejects_user_module_named_preludePASS before AND after the rewrite (semantics preserved). DONE_WITH_CONCERNS: the plan's example usedexamples/hello.ail.jsonwhich doesn't exist post-form-a.1 (deleted in T8); switched toexamples/hello.ail.
- iter pd.2.4: 10 in-mod tests RELOCATED to
crates/ailang-core/tests/workspace_pin.rsrather than aliased per the plan's literal text — the dev-dep cycle (ailang-core↔ailang-surfacevia[dev-dependencies]) makessurface::load_workspacecalls fromailang-core's lib-test crate structurally impossible (two distinct compilations ofailang-coreappear in the test build, types don't match). The integration-test crate consumes both crates against the sameailang-coreartefact, so the cycle never materialises — same pattern form-a.1 T5 used for similar relocations. The 11th test (load_workspace_with_custom_loader_is_called) renamed toload_modules_with_custom_loader_is_calledwith the closure adapted to wrapcrate::load_moduledirectly via the same Io/Schema mappingload_onehad. The 12th test (load_workspace_with_shim_preserves_today_semantics) deleted outright with a forwarding comment to the surface-side hash pin. - iter pd.2.5: 5 deletions (
PRELUDE_JSON,load_prelude,load_workspace_with, top-levelload_one,#[cfg(test)] use crate::load_module;); module rustdoc reworked to two-phase composition framing; lib.rs three rustdoc sites (lines 16-21, 50-51, 120) re-pointed atailang_surface::load_workspace. ONE plan-vs-actual deviation: the plan didn't enumerate the 2 pd.1-introduced in-mod tests at the bottom ofmod teststhat consumeload_onedirectly (load_modules_with_returns_modules_without_prelude,build_workspace_accepts_assembled_modules_and_runs_validation); preserved by adding a test-mod-privateload_onehelper insidemod tests(production-symbol-level deletion preserved; helper is scoped only to the test module, not exported). Thebuild_workspace...test also calledload_prelude()directly; replaced inline withserde_json::from_str(include_str!(...))ofprelude.ail.json(the same one-line codeload_preludewas). Zero literal-"prelude"strings in productioncore/src/confirmed by grep. cargo doc warnings: 3 (unchanged from pre-pd.2 baseline; all three are dangling[load_workspace]references in theWorkspace/Registryrustdoc that pd.1 left behind when it deletedload_workspace; out of scope per the implementer's no-surrounding-cleanup discipline, recorded as known debt). - iter pd.2.6: bench verification —
cross_lang.pyexit 0 (25/25 stable),compile_check.pyexit 0 (24/24, "11 regressed" reported but exit code says baseline-tolerance check passes — this is the audit-form-a + clippy-sweep-named noise on the corpus's small build fixtures),check.pyexit 1 with 1 regression onbench_list_sum.bump_s+13.61% (within established noise envelope; second run showed samebump_splus a tail-latencyimplicit_at_rc.p99_usblip). All three are runtime/compile metrics that cannot be touched by a workspace.rs/loader.rs/lib.rs refactor (no codegen / no runtime / no typecheck path edited).
Concerns
- pd.2.3: plan's regression-pin used
examples/hello.ail.jsonwhich doesn't exist post-form-a.1 T8. Switched toexamples/hello.ail. Recommend a planner check: when a plan references a.ail.jsonfixture, verify the fixture exists post-form-a.1 (the carve-out inventory is the right reference). - pd.2.4: plan's "alias to surface_load_workspace and stay in-mod" was
structurally invalid because of the
ailang-core↔ailang-surfacedev-dep cycle inside the lib-test target. Relocated totests/workspace_pin.rsinstead — same pattern form-a.1 T5 used. Recommend: planner recon-check should detect when a planned in-mod test is meant to consume an external dev-dep cycle that the lib-test target can't resolve. - pd.2.5: plan's "delete
load_one" preserved at production-symbol level (the top-level#[cfg(test)] fn load_oneis gone) by introducing a test-mod-privatefn load_onehelper insidemod testsfor the 2 pd.1 in-mod tests that still consume it. The symbol's name is preserved for clarity; its scope is now narrower than pre-pd.2. - pd.2.6:
check.pyexit 1 — established noise envelope, 13th consecutive observation pattern (audit-cma onwards). pd.2 is a workspace-loader refactor with zero codegen / runtime / typecheck touch, so cannot be the source. Baseline left pristine consistent with all prior audit decisions on this envelope.
Known debt
- 3 cargo doc warnings on
[load_workspace]references in theWorkspace(line 44, 49) +Registry(line 64) rustdoc — pd.1 deletedload_workspacebut didn't sweep these references. Pre- pd.2 baseline already carried them; pd.2 didn't add to the count; not within pd.2 scope (no-surrounding-cleanup discipline). - pd.3 work explicitly out of scope: deleting
examples/prelude.ail.json, theprelude_ail_and_json_parse_to_identical_modulepreflight test (which depends on the JSON file's existence), theinclude_str!ofprelude.ail.jsonincrates/ail/src/main.rs:472-484, thecarve_out_inventory.rs§C4(b) row, the form-a §C4(b) spec text edits, and themigrate-bare-cross-module-refsdefensive include.
Files touched
Modified:
crates/ailang-core/src/lib.rs(3 rustdoc sites updated)crates/ailang-core/src/workspace.rs(5 deletions + module rustdoc reframe + 2 pd.1 in-mod test repairs + 6 in-mod test placeholders + test-mod-privateload_onehelper restored at narrow scope)crates/ailang-core/tests/workspace_pin.rs(10 relocated tests appended + helper fnwrite_simple_module_json+ preamble extension)crates/ailang-surface/src/lib.rs(re-export ofparse_prelude+PRELUDE_AIL)crates/ailang-surface/src/loader.rs(PRELUDE_AILconst +parse_preludefn added;load_workspacebody 3-line → 7-line composition rewrite; module rustdoc reframed; imports updated)
New:
crates/ailang-surface/tests/prelude_parse_pin.rs(1 test)crates/ailang-surface/tests/prelude_module_hash_pin.rs(2 tests: cross-form-identity preflight + literal-hex anchor3abe0d3fa3c11c99)crates/ailang-surface/tests/prelude_injection_pin.rs(2 tests: inject + reservation pin)
Stats
bench/orchestrator-stats/2026-05-14-iter-pd.2.json