From 5700475f4f1f1938f23e2a158bc22f833a52dc0d Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 21:44:13 -0600 Subject: [PATCH 1/2] id(world-manifest): accept total_memory_bytes in [profile] (#5268) The #2876 ProfileKeysProbe is a hand mirror of WorldExecutionProfile and never gained the total_memory_bytes field #557 added, so world_manifest::parse rejected any world.toml naming it as an unknown field. Add the field to the probe, document the mirror obligation on reject_unknown_profile_keys, and add regression coverage: the key parses and round-trips, zero is still refused by validate(), and profile_probe_covers_every_profile_field pins the probe to the struct (a no-rest-pattern literal naming every field, serialized through parse) so the mirror cannot drift silently again. cargo test -p id world_manifest: 32 pass; -p id-core world_limits: 16 pass. --- pkgs/id/src/world_manifest.rs | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/pkgs/id/src/world_manifest.rs b/pkgs/id/src/world_manifest.rs index 0141f5e17b..281ff99040 100644 --- a/pkgs/id/src/world_manifest.rs +++ b/pkgs/id/src/world_manifest.rs @@ -171,6 +171,13 @@ pub fn parse(text: &str) -> Result { /// instead: a typo'd limit key (`wasm_fuell = 1`) must fail loudly /// instead of silently leaving the live profile alone (#2876). /// +/// This probe is a hand-maintained mirror of `WorldExecutionProfile`'s +/// fields and MUST gain a line for every field that struct gains: +/// #5268 was exactly the drift where `total_memory_bytes` (#557) never +/// got its line and every manifest naming it failed as "unknown field". +/// The `profile_probe_covers_every_profile_field` test below pins the +/// mirror to the struct so the drift cannot recur silently. +/// /// The probe deserializes through the typed TOML deserializer, never /// `toml::Value` — whose integers are `i64`-capped — so full-width /// `u64` values the real types accept (a `seed` or `wasm_fuel` above @@ -199,6 +206,8 @@ fn reject_unknown_profile_keys(text: &str) -> Result<()> { native_cpu_seconds: Option, #[serde(default)] native_call_deadline_ms: Option, + #[serde(default)] + total_memory_bytes: Option, } let _: ProfileProbe = toml::from_str(text).map_err(anyhow::Error::new)?; @@ -602,6 +611,45 @@ wasm_fuel = 5_000_000 assert!(format!("{err}").contains("wasm_fuell"), "{err}"); } + #[test] + fn total_memory_bytes_profile_key_parses_and_round_trips() { + // #5268: total_memory_bytes is a real WorldExecutionProfile + // field (#557) that the #2876 probe never learned, so any + // manifest naming it failed parse as an unknown field. + let manifest = parse("[profile]\ntotal_memory_bytes = 268435456").unwrap(); + assert_eq!(manifest.profile.total_memory_bytes, Some(268_435_456)); + assert_eq!(round_trip(&manifest).unwrap(), manifest); + } + + #[test] + fn total_memory_bytes_zero_is_rejected() { + // The value the probe now admits still goes through + // WorldExecutionProfile::validate: a zero budget is refused. + assert!(parse("[profile]\ntotal_memory_bytes = 0").is_err()); + } + + #[test] + fn profile_probe_covers_every_profile_field() { + // #5268 drift guard: this literal names EVERY field of + // WorldExecutionProfile with no `..` rest pattern, so adding a + // field to that struct breaks this test's compilation until + // the author also adds the field to ProfileKeysProbe above — + // the probe is a hand mirror, and this is what keeps it + // honest. Values sit exactly on the validate() floors. + let profile = WorldExecutionProfile { + wasm_fuel: Some(1), + wasm_memory_bytes: Some(65_536), + wasm_message_bytes: Some(1), + native_memory_bytes: Some(16_777_216), + native_cpu_seconds: Some(1), + native_call_deadline_ms: Some(1), + total_memory_bytes: Some(1), + }; + let table = toml::to_string(&profile).unwrap(); + let manifest = parse(&format!("[profile]\n{table}")).unwrap(); + assert_eq!(manifest.profile, profile); + } + #[test] fn test_invalid_profile_bounds_are_rejected() { // #3015: each bound resolve() refuses at apply time must already From ee8e4e96bc4b8228d871977d7d28b2c183129c2c Mon Sep 17 00:00:00 2001 From: repo-worker-code-k Date: Sun, 8 Nov 2026 06:50:15 -0600 Subject: [PATCH 2/2] style(id): test_ prefix on the #5268 profile-probe tests (#5268) pkgs/id/AGENTS.md requires a test_ prefix on test functions; the three tests added in dd64a23 omitted it (Codex review P1). Rename them and update the doc-comment reference to the drift guard. cargo test -p id world_manifest::tests: 32 passed, 0 failed. --- pkgs/id/src/world_manifest.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/id/src/world_manifest.rs b/pkgs/id/src/world_manifest.rs index 281ff99040..d6ed3c1521 100644 --- a/pkgs/id/src/world_manifest.rs +++ b/pkgs/id/src/world_manifest.rs @@ -175,7 +175,7 @@ pub fn parse(text: &str) -> Result { /// fields and MUST gain a line for every field that struct gains: /// #5268 was exactly the drift where `total_memory_bytes` (#557) never /// got its line and every manifest naming it failed as "unknown field". -/// The `profile_probe_covers_every_profile_field` test below pins the +/// The `test_profile_probe_covers_every_profile_field` test below pins the /// mirror to the struct so the drift cannot recur silently. /// /// The probe deserializes through the typed TOML deserializer, never @@ -612,7 +612,7 @@ wasm_fuel = 5_000_000 } #[test] - fn total_memory_bytes_profile_key_parses_and_round_trips() { + fn test_total_memory_bytes_profile_key_parses_and_round_trips() { // #5268: total_memory_bytes is a real WorldExecutionProfile // field (#557) that the #2876 probe never learned, so any // manifest naming it failed parse as an unknown field. @@ -622,14 +622,14 @@ wasm_fuel = 5_000_000 } #[test] - fn total_memory_bytes_zero_is_rejected() { + fn test_total_memory_bytes_zero_is_rejected() { // The value the probe now admits still goes through // WorldExecutionProfile::validate: a zero budget is refused. assert!(parse("[profile]\ntotal_memory_bytes = 0").is_err()); } #[test] - fn profile_probe_covers_every_profile_field() { + fn test_profile_probe_covers_every_profile_field() { // #5268 drift guard: this literal names EVERY field of // WorldExecutionProfile with no `..` rest pattern, so adding a // field to that struct breaks this test's compilation until