Repository navigation
Description
Request
A check-only build of the crate that does not embed the preservation library, with the language-1.1 and 1.2 compiler-semantics IDs as constants checked into the repository instead of computed in every process.
Follows #494 (build and run check on wasm32-wasip1), and is useful without it.
Why
language/preservation-1.2/library/ is 31 of the 37 MB the crate embeds. Only production export reads it. Yet every process that touches a language-1.2 project reads all of it into its data form to compute the compiler-semantics ID (lib.rs embedded_digest). On native threads that cost is hidden. In WebAssembly it is not.
Measured on LexLean 0.3.0 as vendored in PrismPM 35e9f01d5415ed4b0b64c152238f291546957ec4, built for wasm32-wasip1, in a Chrome worker:
| Embedded | Left out | |
|---|---|---|
| Module, raw | 47.4 MB | 15.1 MB |
| Module, gzip | 7.1 MB | 3.5 MB |
| Start to ready, median | 942 ms | 91 ms |
| of which computing the ID | 806 ms | 0.1 ms |
| Linear memory | 214 MB | 90 MB |
| One check | 46 ms | 50 ms |
Both builds give the same verdict, codes, messages, lines and columns as the native binary on 17 files, and write the same lexlean.lock.
Proposed form
- A cargo feature, on by default, that embeds the production data. With it off,
build.rsleaves those bytes out and production commands fail with a typed diagnostic. - The language-1.1 and 1.2 IDs as constants in the repository. The existing conformance test that recomputes the ID from disk (RP-10) must equal them, so a stale constant fails the suite.
A native process could then skip the read too: the ID is a constant of the build.
A risk the constant must be held against
The demonstration below takes the ID from an environment variable at build time. I built it once with a wrong ID on purpose. It still agreed with the native binary on every verdict and diagnostic, because it locks and checks with the same wrong value. Only comparing its lexlean.lock bytes with a native lock showed the fault. So agreement on verdicts does not protect this constant; a test that recomputes it does.
Not tested
- The crate's own test suite with the change applied.
- Any LexLean newer than 0.3.0.
- Whether anything outside production export reads the preservation library on a path the 17 files do not reach.
The demonstration (17 lines, on top of the patch in #494; not the proposed form)
diff --git a/vendor/lexlean/build.rs b/vendor/lexlean/build.rs
index ddac668a..693ebdf5 100644
--- a/vendor/lexlean/build.rs
+++ b/vendor/lexlean/build.rs
@@ -52,8 +52,19 @@ fn main() {
/// in bytewise-sorted path order.\n\
pub static FILES: &[(&str, &[u8])] = &[\n",
);
+ // A check-only build leaves out the bytes of the preservation library,
+ // which only production export reads, and carries the language-1.2
+ // compiler-semantics ID those bytes give instead of computing it. The ID
+ // is the one a full build reports; a wrong one makes every lock stale.
+ println!("cargo:rerun-if-env-changed=LEXLEAN_CHECK_ONLY_SEMANTICS_1_2");
+ let check_only = env::var("LEXLEAN_CHECK_ONLY_SEMANTICS_1_2").is_ok();
for (rel, abs) in &files {
println!("cargo:rerun-if-changed={}", abs.display());
+ if check_only && rel.starts_with("language/preservation-1.2/library/") {
+ out.push_str(&format!(" ({rel:?}, b\"\"),
+"));
+ continue;
+ }
out.push_str(&format!(
" ({:?}, include_bytes!({:?})),\n",
rel,
diff --git a/vendor/lexlean/src/lib.rs b/vendor/lexlean/src/lib.rs
index 59360533..791f2541 100644
--- a/vendor/lexlean/src/lib.rs
+++ b/vendor/lexlean/src/lib.rs
@@ -276,7 +276,12 @@ pub fn compiler_semantics_id_for(language: &str) -> Sha256Digest {
*V1_0.get_or_init(|| embedded_digest(|path| !is_v1_1_file(path) && !is_v1_2_file(path)))
}
LANGUAGE_1_1 => *V1_1.get_or_init(|| embedded_digest(|path| !is_v1_2_file(path))),
- LANGUAGE_1_2 => *V1_2.get_or_init(|| embedded_digest(|_| true)),
+ LANGUAGE_1_2 => *V1_2.get_or_init(|| {
+ // A check-only build carries the ID of the full tree (build.rs).
+ option_env!("LEXLEAN_CHECK_ONLY_SEMANTICS_1_2")
+ .map(|hex| Sha256Digest::from_hex(hex).expect("a SHA-256 digest in hex"))
+ .unwrap_or_else(|| embedded_digest(|_| true))
+ }),
// An unsupported language never shares an identity with a supported
// one; configuration rejects it before any identity is published.
other => Sha256Digest::of(format!("unsupported-language\0{other}").as_bytes()),
Activity
afflom commentedon Nov 12, 2026
Bounded identity review: computing the canonical ID once and carrying it as a checked constant can preserve the semantics identity, but the complete source-to-constant and constant-to-built-variant bindings must remain independent. Your deliberately wrong-ID example correctly shows why verdict agreement is insufficient; the environment override/empty embedded placeholders are demonstration code, not an accepted implementation.
The proposal should retain the existing language partitions and identity data-form rules, independently recompute against the complete normative tree, and bind each qualified full/reduced binary to the matching source, constant, features and target. A full-feature RP10 pass alone does not authenticate a different reduced executable. Production operations unavailable in the reduced variant must refuse through explicit typed capability behavior before partial work or a success claim.
A shared semantics ID is not interchangeable executable identity: a reduced binary cannot replace a full production writer just because the ID matches. #468's producer custody and #316's frozen tools/evidence remain unchanged. Please keep the first decision focused on check-only capability and identity correspondence; no current-build, new-variant, identity-wave or cleanup admission follows from this review, and this issue is not a new prerequisite for the initial factory build.
humuhumu33 commentedon Nov 12, 2026
Thank you. A draft proposal is up as #499, scoped to check-only capability and identity correspondence. How it answers each point:
Partitions and data-form rules. Unchanged. A default build computes all three IDs exactly as before. A reduced build computes 1.0 and 1.1 the same way (§21.2 already excludes every
language/preservation-1.2/file from them) and takes only 1.2 fromLANGUAGE_1_2_SEMANTICS_ID. No environment override and no empty placeholders: the library's files are absent from the reduced build'sembedded::FILES.Source to constant.
RP-10recomputes the 1.2 ID from the complete normative tree on disk, with the identity data-form rule, independently of the compiler, and requires the constant to equal it. Changing one digit of the constant fails it, and the message names the correct value.Constant to built variant. A full-feature
RP-10pass does not authenticate the reduced executable, soRP-19builds that executable (--no-default-features) and holds it to the full build: no library source in its image;lexlean.lockbytes, exit codes and JSON diagnostics equal to the full build's forlockandcheckon a 1.0, a 1.1 and two 1.2 projects and three 1.2 negative fixtures. Lock bytes are where a wrong constant shows, and the same one-digit plant failsRP-19at the first language-1.2 lock. The binding is to the host target the gate builds; a wasm target is not bound by this PR (it needs #494 first).Typed refusal before partial work.
production build, andverifyof a project with a production root, refuse with a new registeredLLC0205(exit 2) before any build, verification or export is published.RP-19asserts no.lexlean/build,verifiedorproductionexists afterwards.Not interchangeable. The reduced build's version report adds a fifth line,
variant check-only, and SPEC §8.4 and §30.3 state it is never a release binary and replaces a full binary for no certifying or producing use. #468's custody and #316's frozen tools and evidence are untouched.The one normative question is in the PR: SPEC §8.4 forbids a feature that disables a normative capability, so the PR amends §8.4 to name
production-dataas the single exception. That is yours to accept or refuse.RP-19: bind the whole excluded inventory, and the counts and ID the m…
Merge pull request #499 from UOR-Foundation/feat/check-only-build
afflom commentedon Nov 13, 2026
PR #499 was merged externally at b4ac72e. This issue stays open pending final acceptance of that actual tree.
The exact84ca PR gate43414162623 passed all70 jobs/772 steps, same-run honesty and repro. Its qualified tree was c72f. Actual merge parents are15d66a76 +84ca191c and actual tree is d2bdcf2031c11362cd761c5ae0ec84d33da56ac3, differing only by #516's six-line regenerate.yml repair. Therefore old PR success alone does not establish actual merged-tree equality. I found retained source reviews but no submitted final-gate acceptance review before the external merge. This records the timing accurately; it does not require replaying completed source/producer work.
The existing push gate43432076539 is qualifying actualb4ac now; exact actual-head repro43432076411 passed. Await all dynamically materialized jobs and final exact-tree review before closure. No rerun, writer, native measurement or planted defect was repeated.
The full request is mapped to the accepted native capability and identity correspondence: default-on production-data, absent library inventory in reduced builds, checked1.2 constant, independent RP10 plus built-variant RP19 lock/refusal checks. Preserving1.1's existing computation is the accepted refinement because its selected data remains present. The single named non-release/non-producer exception is scoped accordingly; #494 WASM and #468/#316 qualified tools remain separate.
afflom commentedon Nov 13, 2026
Delivered by merged PR #499 on release/v0.4, actual commit b4ac72e.
The actual merged tree d2bdcf2031c11362cd761c5ae0ec84d33da56ac3 now has complete acceptance: full CI4343207653970/70 jobs and772/772 steps, same-run honesty, and exact-head reproducibility43432076411. Final postlanding review5893971211 and independent audit04d6de32 confirm actual tree/history and the full accepted native scope. This supersedes the pending-actual-gate status above; no premerge review or old-tree equality is retroactively claimed.
The delivered design excludes the preservation library in the explicit check-only build, independently checks the1.2 constant, binds the built reduced variant through complete inventory/default-lock comparisons, and refuses production work with LLC0205 before publication. The accepted refinement preserves1.1's existing calculation because none of its selected inputs is excluded. Full/default release proof guarantees remain unchanged. WASM #494 remains open separately, and reduced binaries do not replace qualified #316/#468 producers.
Closing this issue explicitly because the delivery landed on a non-default release branch. No completed writer, gate, measurement or plant was repeated.