iter raw-buf.2-kernel-rename (DONE 2/2): ailang-kernel-stub → ailang-kernel family-crate (refs #7)

Pure crate rename, zero behavioural change. ailang-kernel-stub becomes
the ailang-kernel family-crate: a re-export hub (src/lib.rs) plus one
submodule per kernel-tier module (today only kernel_stub:
src/kernel_stub/{mod.rs, source.ail}). raw-buf.3 plugs raw_buf in as a
sibling submodule; this iter only builds the home.

Task 1 (atomic — the rename breaks the build until every site is
threaded):
- git mv crates/ailang-kernel-stub → crates/ailang-kernel.
- Carved the STUB_AIL Form-A body verbatim (byte-identical, verified
  via diff against HEAD's raw string) into src/kernel_stub/source.ail,
  loaded by mod.rs via include_str!. The answer (intrinsic) fn is
  byte-preserved — its INTERCEPTS bijection partner stays pinned.
- lib.rs is now the hub: `pub use kernel_stub::SOURCE as STUB_AIL;`.
  The public symbol STUB_AIL is preserved, so ailang-surface and the
  bijection test bind to it unchanged.
- 8 compile sites threaded across 6 files: Cargo package name,
  workspace member + dep-alias, ailang-surface dep, loader.rs
  use-paths (ailang_kernel_stub → ailang_kernel). Cargo.lock
  auto-regenerated.

Task 2 (doc/ledger honesty, no build impact):
- design/INDEX.md, CLAUDE.md code-layout row + lockstep-pair row,
  design/models/0007 ×2 — crate-path strings updated to the new
  ailang-kernel/src/kernel_stub path.
- Scope note: the spec's raw-buf.2 Components row named only
  design/INDEX.md + the CLAUDE.md code-layout row. plan-recon found two
  more present-tense crate-path refs (CLAUDE.md:312 lockstep row,
  model 0007:8/235). Folded them in per the honesty-rule — a rename
  that leaves stale present-state paths is an incomplete rename.
  Path-only; the retirement narrative stays for raw-buf.4.

The AILang module name kernel_stub (the Form-A string + parse_kernel_stub
fn) is deliberately unchanged — only the crate identifier moved.

Verification (orchestrator, this session): cargo build --workspace
clean; cargo test --workspace 669 passed / 0 failed / 2 ignored
(baseline held exactly — no test added/removed). Carve byte-identity
confirmed by diff; no stale ailang-kernel-stub / ailang_kernel_stub
refs remain in-tree (git grep, excl. history + lockfile). The four
rename-invisible ratifiers (kernel_stub_module_round_trips,
intercepts_bijection_with_intrinsic_markers, .ll snapshots,
workspace_pin) all green via the preserved re-export.
This commit is contained in:
2026-05-29 18:39:36 +02:00
parent 395a40f3e7
commit fbdbe740e6
12 changed files with 59 additions and 57 deletions
-42
View File
@@ -1,42 +0,0 @@
//! Kernel-tier stub module — minimal ratifying fixture for the
//! kernel-extension-mechanics milestone (prep.3).
//!
//! The stub exists solely to exercise the shipped mechanisms
//! end-to-end: `Module.kernel`, `TypeDef.param-in`, and type-scoped
//! resolution (the stub's type is visible to every consumer without
//! an `(import …)` declaration).
//!
//! No domain content. The stub may be retired or repositioned when
//! a real second kernel-tier consumer (the `raw-buf` milestone) lands.
//!
//! This crate carries ONLY the embedded Form-A text and the parsed
//! `Module` value. The parse hop itself lives in `ailang-surface`
//! (see `ailang_surface::parse_kernel_stub`) so the
//! crate-dependency graph stays acyclic: `ailang-surface →
//! ailang-kernel-stub → ailang-core` (no back-edge from
//! `ailang-kernel-stub` to `ailang-surface`).
/// Source-of-truth Form-A text for the stub kernel module. Parsed
/// by `ailang_surface::parse_kernel_stub` (and round-trip-pinned by
/// `kernel_stub_module_round_trips` in `design_schema_drift.rs`).
///
/// Ships a `(fn new ...)` def so consumers can spell `(new StubT 42)`,
/// the worked-consumer example from prep.3 of the spec — without it,
/// the stub's `Term::New` end-to-end ratification story is broken
/// (per fieldtest F4, 2026-05-28).
pub const STUB_AIL: &str = r#"(module kernel_stub
(kernel)
(data StubT (vars a)
(ctor Stub a)
(param-in (a Int Float)))
(fn new
(doc "Construct StubT<Int> from an Int. Exercises Term::New end-to-end.")
(type (fn-type (params (con Int)) (ret (con StubT (con Int)))))
(params x)
(body (term-ctor StubT Stub x)))
(fn answer
(doc "Ratifies the intrinsic mechanism end-to-end: codegen intercept answer emits ret i64 42.")
(type (fn-type (params) (ret (con Int))))
(params)
(intrinsic)))
"#;
@@ -1,5 +1,5 @@
[package]
name = "ailang-kernel-stub"
name = "ailang-kernel"
version.workspace = true
edition.workspace = true
license.workspace = true
@@ -0,0 +1,16 @@
//! Kernel-stub submodule — minimal ratifying fixture for the
//! kernel-extension-mechanics milestone (prep.3). The Form-A text
//! lives in the sibling `source.ail`.
//!
//! No domain content. Retired when the `raw-buf` milestone lands
//! its real kernel-tier consumer (raw-buf.4); until then it stays
//! as the ratifying-fixture anchor.
/// Source-of-truth Form-A text for the stub kernel module. Parsed
/// by `ailang_surface::parse_kernel_stub` (and round-trip-pinned by
/// `kernel_stub_module_round_trips` in `design_schema_drift.rs`).
///
/// Ships a `(fn new ...)` def so consumers can spell `(new StubT 42)`
/// (Term::New end-to-end, per prep.3 fieldtest F4) and an `answer`
/// `(intrinsic)` fn whose `INTERCEPTS` entry the bijection test pins.
pub const SOURCE: &str = include_str!("source.ail");
@@ -0,0 +1,15 @@
(module kernel_stub
(kernel)
(data StubT (vars a)
(ctor Stub a)
(param-in (a Int Float)))
(fn new
(doc "Construct StubT<Int> from an Int. Exercises Term::New end-to-end.")
(type (fn-type (params (con Int)) (ret (con StubT (con Int)))))
(params x)
(body (term-ctor StubT Stub x)))
(fn answer
(doc "Ratifies the intrinsic mechanism end-to-end: codegen intercept answer emits ret i64 42.")
(type (fn-type (params) (ret (con Int))))
(params)
(intrinsic)))
+13
View File
@@ -0,0 +1,13 @@
//! Kernel-tier modules — family-crate hosting the Form-A source of
//! every kernel-tier `.ail` module the AILang workspace
//! auto-injects. One Cargo crate, one Rust submodule per
//! kernel-tier module, one `pub const SOURCE` per submodule.
//!
//! The acyclic dependency chain is preserved:
//! `ailang-surface → ailang-kernel → ailang-core`. Per-module parse
//! hops live in `ailang-surface` (`parse_kernel_stub`, …) so this
//! crate carries zero parser code.
mod kernel_stub;
pub use kernel_stub::SOURCE as STUB_AIL;
+1 -1
View File
@@ -6,7 +6,7 @@ license.workspace = true
[dependencies]
ailang-core.workspace = true
ailang-kernel-stub.workspace = true
ailang-kernel.workspace = true
serde_json.workspace = true
thiserror.workspace = true
+3 -3
View File
@@ -45,15 +45,15 @@ pub fn parse_prelude() -> Module {
/// prep.3 (kernel-extension-mechanics): parse the embedded
/// kernel-stub bytes into a `Module`. Mirror of [`parse_prelude`].
///
/// Source-of-truth: `ailang_kernel_stub::STUB_AIL`. The stub
/// Source-of-truth: `ailang_kernel::STUB_AIL`. The stub
/// ratifies the end-to-end kernel-tier path: `Module.kernel`,
/// `TypeDef.param-in`, and auto-import without `(import …)`.
///
/// Panics on parse failure — the stub is build-time-validated by
/// every drift test run.
pub fn parse_kernel_stub() -> Module {
crate::parse(ailang_kernel_stub::STUB_AIL)
.expect("ailang_kernel_stub::STUB_AIL must parse as a Module")
crate::parse(ailang_kernel::STUB_AIL)
.expect("ailang_kernel::STUB_AIL must parse as a Module")
}
fn is_ail_source(path: &Path) -> bool {