6ccc756c0f
Milestone close for intrinsic-bodies (.1 mechanism52ff873+ .2 migration/lockcaa3618). Architect drift review over c42034b^..caa3618 plus the regression scripts. Both gates assessed; four drift items resolved (3 fixed inline here, 1 filed to backlog). Regression: both scripts exit 0. bench/check.py → 34 metrics, 0 regressed, 2 improved beyond tolerance (bench_hof_pipeline.bump_s -10.76%, bench_list_sum_explicit.bump_s -12.27%), 32 stable. bench/compile_check.py → 24 metrics, 0 regressed, 24 stable. The milestone is behaviour-preserving; the two throughput improvements are noise within the bench's run-to-run band, not a milestone effect. Drift items (architect): 1. [FIXED] examples/prelude.ail — the 13 migrated defs' doc strings still said "Body is placeholder for round-trip stability" and named `try_emit_primitive_instance_body` (the pre-raw-buf.1 dispatch fn). Post-migration the body IS an honest (intrinsic) marker, not a placeholder, and dispatch is `intercepts::lookup`. The docs lied about the very artefact the milestone exists to de-lie — an active honesty-rule infraction on main. Rewritten to present-tense "compiler-supplied (intrinsic) body; codegen emits <IR> via the intercept registry" across all 13 (7 Eq/Ord instance methods + 6 float_* fns). 2. [FIXED] design/models/0007-kernel-extensions.md — claimed the `try_emit_primitive_instance_body` hardcoded list is "not yet migrated into a plugin registry ... deferred to the Series milestone". Stale since raw-buf.1 (the registry shipped) and intrinsic-bodies (the (intrinsic) marker + bijection pin). Rewritten to the present state: the registry exists, (intrinsic) declares membership, the bijection pin locks marker<->entry, and the optimisation-only class is named. 3. [FIXED] CLAUDE.md "Lockstep-invariant pairs" — added the third pair: INTERCEPTS entries <-> (intrinsic) markers, guarded by intercepts_bijection_with_intrinsic_markers, with the optimisation-only allowlist carve-out. Same class as the two existing tabled pairs; ships silently broken if one side moves without the other. 4. [BACKLOG #41, label idea] INTERCEPTS conflates two concepts — intrinsic-backed (compiler-supplied body) vs optimisation-of-a- real-body (the 5 *__Int icmp family). The .2 bijection pin contains it with a hardcoded OPTIMISATION_ONLY allowlist + a stale-allowlist guard; a structural split (an Intercept kind field) is the forward direction but is its own focused change, out of scope here. What holds (architect confirmed): data-model contract matches the shipped Term::Intrinsic (design_schema_drift gates it); no INDEX row needed (data-model addition, not a new contract); both existing lockstep pairs untouched (answer lowers via the ordinary qualified-fn path, no new lower_app arm; no Pattern::Lit reject); 0007-honesty-rule correctly needed no edit (general rule, never named the dummies). RATIFY — baseline move: the prelude module hash pin (crates/ailang-surface/tests/prelude_module_hash_pin.rs) moves 2ea61ef21ebc1913 -> b1373a2c69e70a3f. Cause: this tidy's 13 doc-string rewrites (item 1). doc is part of the canonical JSON, so the module hash shifts; behaviour is unchanged. The 6 mono eq/compare def-hashes do NOT move (synthesise_mono_fn sets doc: None, so instance-method docs never reach the synthesised symbol). Full workspace test green post-rebaseline. Milestone intrinsic-bodies is closed. It unblocks the raw-buf.2 redo (the polymorphic kernel-tier fns RawBuf needs now have an honest body form). raw-buf (#7) remains parked; resuming it is a fresh decision.
55 lines
2.7 KiB
Rust
55 lines
2.7 KiB
Rust
//! Pin the canonical identity of the parsed prelude as a literal
|
|
//! hex hash. Updates intentionally on prelude-content changes
|
|
//! (record the why in the commit body); accidental drift trips
|
|
//! immediately.
|
|
|
|
use ailang_core::workspace::module_hash;
|
|
use ailang_surface::parse_prelude;
|
|
|
|
#[test]
|
|
fn prelude_parse_yields_canonical_hash() {
|
|
let m = parse_prelude();
|
|
let h = module_hash(&m);
|
|
// The expected hex updates intentionally on prelude-content
|
|
// changes; record the why in the commit body.
|
|
// 2026-05-21 operator-routing-eq-ord re-pinned (prior:
|
|
// 3abe0d3fa3c11c99): Eq Int/Bool/Str bodies flip to placeholder
|
|
// `false`; Eq Unit added; six float_* fns added; class-Eq doc
|
|
// rewritten away from the "P2 follow-up" comment.
|
|
// 2026-05-21 schema-camelcase-fix re-pinned (prior:
|
|
// 6d0577ff0d4e50ac): `Term::Lam`'s JSON tags renamed from
|
|
// `paramTypes`/`retType` to `param-types`/`ret-type`. The
|
|
// prelude contains 11 `(lam ...)` forms, so each lambda's
|
|
// canonical-JSON bytes change and the module hash drifts.
|
|
// Form-A surface unchanged — only the canonical-JSON byte
|
|
// stream differs, which is what the rename targets.
|
|
// 2026-05-28 prep.3 (kernel-extension-mechanics) re-pinned
|
|
// (prior: 562a03fc57e7e017): prelude becomes kernel-tier —
|
|
// `examples/prelude.ail` gains the `(kernel)` module-header
|
|
// attribute, which serialises as `"kernel": true` in the
|
|
// canonical JSON. This changes the prelude's content hash
|
|
// deterministically; the behaviour `prelude_free_fns.rs`
|
|
// protects (12 free fns callable bare in every consumer) is
|
|
// unchanged — only the code path migrates from the hardcoded
|
|
// `&["prelude"]` literal to the kernel-flag filter.
|
|
// 2026-05-29 intrinsic-bodies.2 re-pinned (prior:
|
|
// af372f28c726f29f): the 13 authored prelude dummy bodies
|
|
// (7 Eq/Ord instance methods + 6 float_* fns) migrate from
|
|
// placeholder terms ((body false)/(body true)/
|
|
// (body (term-ctor Ordering EQ))) to Term::Intrinsic. The
|
|
// canonical-JSON byte stream changes; behaviour is unchanged
|
|
// (codegen intercepts by name before the body is inspected).
|
|
// 2026-05-29 intrinsic-bodies audit-tidy re-pinned (prior:
|
|
// 2ea61ef21ebc1913): the same 13 defs' doc strings were
|
|
// rewritten from the stale "placeholder / try_emit_primitive_instance_body"
|
|
// wording to honest "compiler-supplied (intrinsic)" wording.
|
|
// doc is part of the canonical JSON, so the module hash moves;
|
|
// the synthesised mono def-hashes do NOT (synthesise_mono_fn
|
|
// sets doc: None).
|
|
assert_eq!(
|
|
h, "b1373a2c69e70a3f",
|
|
"prelude module hash drifted; if intentional, capture the new \
|
|
hex below + record the why in the commit body."
|
|
);
|
|
}
|