diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 073b56b..f3a6ac3 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,8 +9,8 @@ license = "GPL-3.0-only" # repository structure — no crates.io publishing at this stage). Pinned to the # same generation rev `comline-typescript` uses, so a CLI build has one # `comline-codegen`. Local iteration: add a `[patch]` onto a sibling checkout. -comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "c70336dcc9485cea2c99b0f1db3789e420deaeda" } -comline-core = { git = "https://github.com/ComlineProject/core", rev = "47ac5f10a36b587d14d1b9672fba65d8f3712962" } +comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "d901db42d094ea9e2f59a310e6e885767abcae6b" } +comline-core = { git = "https://github.com/ComlineProject/core", rev = "50c17cc740676416e945582dd6e2547e8535ac03" } eyre = "0.6.8" diff --git a/codegen/src/generator.rs b/codegen/src/generator.rs index 732cc40..646d265 100644 --- a/codegen/src/generator.rs +++ b/codegen/src/generator.rs @@ -11,6 +11,7 @@ use std::collections::HashMap; use std::path::PathBuf; use comline_core::schema::ir::compiler::interpreted::kind_search::KindValue; +use comline_core::schema::ir::frozen::schema_ir_hash; use comline_core::schema::ir::frozen::unit::{FrozenArgument, FrozenUnit}; use eyre::{bail, Result}; @@ -173,10 +174,10 @@ fn schema_source(units: &[FrozenUnit], default_framing: Option<&str>) -> String if has_protocol { output.push_str(&format!( - "/// Fingerprint of the frozen IR this file was generated from — the two\n\ - /// ends of a connection [`Handshake`] must agree on it.\n\ + "/// Canonical digest of the frozen IR this file was generated from — the\n\ + /// two ends of a connection [`Handshake`] must agree on it.\n\ pub const IR_HASH: u64 = {:#018x};\n\n", - ir_hash(units) + schema_ir_hash(units) )); } @@ -212,20 +213,6 @@ fn schema_source(units: &[FrozenUnit], default_framing: Option<&str>) -> String output } -/// A deterministic fingerprint of the schema's frozen units — FNV-1a over their -/// `Debug` form. Stable for a given generator version; a generator bump changes -/// it, which is correct (different codegen ⇒ a new handshake identity). A -/// canonical cross-language hash from `core`'s CAS, threaded through -/// `GenRequest`, is the eventual form. -fn ir_hash(units: &[FrozenUnit]) -> u64 { - let mut h: u64 = 0xcbf2_9ce4_8422_2325; - for b in format!("{units:?}").as_bytes() { - h ^= u64::from(*b); - h = h.wrapping_mul(0x0000_0100_0000_01b3); - } - h -} - // ── data types ───────────────────────────────────────────────────────────── fn field_lines(fields: &[FrozenUnit]) -> String {