From cbde93c459ba6eaf037905b4e83d1712d54ab124 Mon Sep 17 00:00:00 2001 From: Cui Date: Fri, 28 Aug 2026 20:38:21 +0800 Subject: [PATCH] docs(contract-types,ffi): converge Gate comments with the published Root ABI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The architecture source published the ADR-040 Root ABI bundle (`origin/main:packages/abi/`), and `packages/index.json` now registers this repository in `rootAbi.consumers` alongside LumioCoreEngine. Six statements in this workspace still claimed no C Header exists, which is now false and would mislead the next agent reading these seams. Corrected, without binding anything and without transcribing any published value: - contract-types `generated.rs` / `lib.rs`: the bundle is published and this repo is a registered consumer of it, binding its C Header directly; it is deliberately NOT a consumer of the Rust/C# generated packages. Binding itself is still pending. - contract-types `layout.rs`: state the real reason the table stays empty. The bundle certifies exactly one `layoutProfileId` (`linux-x86_64-glibc`), so transcribing its sizes unconditionally would assert layouts on darwin and windows that the architecture source has not certified — the same red line as inventing them. Binding waits for the remaining target profiles or for a target-gated table. - native-ffi `exports.rs`: the Header exists, but its entry symbol belongs to CoreEngine root-abi, not here (ADR 0001). The provider symbol list is still unpublished. - `generated_layout_matches_manifest`: assertion message now names the real constraint (one certified layout profile) instead of "Header unpublished". Statements that are still true are left alone: ErrorCode values, Operation ids and the diagnostics RecordPort remain unpublished for this repository's needs. Comment-only plus one assertion message; no logic, no API and no behaviour change. While writing this, the source-text guard in `exports.rs` correctly rejected a first draft that spelled the Root API symbol — the comment now refers to it indirectly and the guard is untouched. Verified at this commit: cargo fmt --all -- --check exit 0 cargo clippy --workspace --all-targets -- -D warnings exit 0 cargo clippy --workspace --all-targets --all-features -- -D warnings exit 0 cargo build --workspace --benches exit 0 cargo test --workspace exit 0 90 passed/0 failed cargo test --workspace --all-features exit 0 cargo test --workspace --no-default-features exit 0 cargo xtask check-dep-dag / dump-symbols / check-baseline exit 0 node .spec/tools/spec-lint.mjs && node --test spec-lint.test.mjs exit 0 exports::tests::c_smoke_invalid_handle_returns_stable_code ... ok symbol_guard::tests::root_symbol_is_absent ... ok Co-Authored-By: Claude Opus 5 --- crates/lumio-contract-types/src/generated.rs | 15 +++++++++++---- crates/lumio-contract-types/src/layout.rs | 14 +++++++++++--- crates/lumio-contract-types/src/lib.rs | 6 ++++-- .../tests/generated_layout_matches_manifest.rs | 6 +++--- crates/lumio-native-ffi/src/exports.rs | 7 ++++++- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/crates/lumio-contract-types/src/generated.rs b/crates/lumio-contract-types/src/generated.rs index 8bd98c7..a10c183 100644 --- a/crates/lumio-contract-types/src/generated.rs +++ b/crates/lumio-contract-types/src/generated.rs @@ -1,9 +1,16 @@ //! Architecture-source generated-contract adapter. //! -//! The architecture source has published baseline id `LGE-V1.4-2026-08-27`, but -//! FOUNDATION-W1 has not published a Rust/C package or C Header. This module is -//! the internal seam only: opaque newtypes, no public numeric registries, and -//! no copied schemas. +//! The architecture source has published baseline id `LGE-V1.4-2026-08-27` and, +//! under ADR-040, the Root ABI bundle at `origin/main:packages/abi/` — this +//! repository is a registered consumer of that bundle (`rootAbi.consumers`) and +//! binds its C Header directly. It is deliberately NOT a consumer of the Rust / +//! C# generated packages. +//! +//! Binding is not done yet, so this module is still the internal seam only: +//! opaque newtypes, no public numeric registries, no copied schemas. What the +//! bundle publishes (handle / buffer / status layout, ABI version) is bindable; +//! ErrorCode, Capability bits and Operation ids are still unpublished for this +//! repository's needs. See `layout.rs` for the layout-profile caveat. /// Published architecture baseline this crate binds to. pub(crate) const ARCHITECTURE_BASELINE_ID: &str = "LGE-V1.4-2026-08-27"; diff --git a/crates/lumio-contract-types/src/layout.rs b/crates/lumio-contract-types/src/layout.rs index 24491f3..efd3800 100644 --- a/crates/lumio-contract-types/src/layout.rs +++ b/crates/lumio-contract-types/src/layout.rs @@ -1,7 +1,14 @@ //! ABI layout assertions against the architecture Header / manifest. //! -//! FOUNDATION-W1 has not published a C Header. This gate must not invent ABI -//! sizes; an empty table is a match. +//! The architecture source now publishes a C Header (ADR-040 Root ABI bundle, +//! `origin/main:packages/abi/lumio_core.h`), but its bundle certifies exactly +//! one `layoutProfileId` — `linux-x86_64-glibc`. Transcribing those sizes here +//! unconditionally would assert layouts on darwin / windows that the +//! architecture source has not certified, which is the same red line as +//! inventing them. Binding therefore stays deferred until the bundle carries +//! the remaining target profiles, or until this gate is target-gated. +//! +//! This gate must not invent ABI sizes; an empty table is a match. use crate::generated::StructSize; @@ -13,7 +20,8 @@ pub struct LayoutMismatch { pub found: StructSize, } -/// Generated Header layout rows. Empty while the Header is unpublished. +/// Generated Header layout rows. Empty until binding is target-gated (see +/// the module docs): the published bundle certifies `linux-x86_64-glibc` only. pub fn entries() -> &'static [(&'static str, StructSize)] { &[] } diff --git a/crates/lumio-contract-types/src/lib.rs b/crates/lumio-contract-types/src/lib.rs index b650d7e..46447a4 100644 --- a/crates/lumio-contract-types/src/lib.rs +++ b/crates/lumio-contract-types/src/lib.rs @@ -5,8 +5,10 @@ //! `docs/specs/native-core-module-map.md`。 //! //! Gate-0 只提供内部 seam 与负向 Gate。架构源已发布 baseline id -//! `LGE-V1.4-2026-08-27`,但尚未发布 Rust/C package 或 C Header;不得手写公共 -//! ErrorCode / Capability / Operation 数值,也不得声称公共 ABI 已完成。 +//! `LGE-V1.4-2026-08-27`,并按 ADR-040 发布了 Root ABI bundle;本仓已登记为该 +//! bundle 的 consumer,直接绑定其 C Header,**不**消费 Rust/C# 生成包。绑定本身 +//! 尚未落地:ErrorCode / Capability / Operation 数值对本仓的需求仍未发布, +//! 一律不得手写,也不得声称公共 ABI 已完成。 #![forbid(unsafe_code)] diff --git a/crates/lumio-contract-types/tests/generated_layout_matches_manifest.rs b/crates/lumio-contract-types/tests/generated_layout_matches_manifest.rs index 5434fea..79d3533 100644 --- a/crates/lumio-contract-types/tests/generated_layout_matches_manifest.rs +++ b/crates/lumio-contract-types/tests/generated_layout_matches_manifest.rs @@ -2,11 +2,11 @@ use lumio_contract_types::layout; #[test] fn generated_layout_matches_manifest() { - layout::verify_layout() - .expect("no generated Header means no structs to check, not invented ABI sizes"); + layout::verify_layout().expect("an empty layout table has no structs to check"); assert_eq!( layout::entries().len(), 0, - "must not invent ABI struct sizes while the generated Header is unpublished" + "must not assert ABI struct sizes beyond the one layout profile the \ + architecture bundle certifies (linux-x86_64-glibc)" ); } diff --git a/crates/lumio-native-ffi/src/exports.rs b/crates/lumio-native-ffi/src/exports.rs index b9822fc..e93fb96 100644 --- a/crates/lumio-native-ffi/src/exports.rs +++ b/crates/lumio-native-ffi/src/exports.rs @@ -1,6 +1,11 @@ //! Blocked-header FFI smoke helper. //! -//! Formal C Header and provider symbol list are unpublished (T-ffi-04). +//! The architecture source publishes the Root ABI C Header (ADR-040), but the +//! entry symbol it declares belongs to CoreEngine root-abi, not to this +//! repository (ADR 0001; enforced by `cargo xtask dump-symbols` and by the +//! source-text guard in this module's tests — do not spell that symbol here). +//! The provider symbol list this crate would export is still unpublished +//! (T-ffi-04). //! This module composes existing Rust seams; it is not a C ABI surface. //! Do not add `#[no_mangle]` or `extern "C"` names here.