Skip to content

Commit da61dab

Browse files
committed
fix: bind interpreter identities to the upgraded Rhai engine
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
1 parent c1b3d23 commit da61dab

23 files changed

Lines changed: 167 additions & 141 deletions

File tree

‎crates/registry-breg/src/plan.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub const MAX_PLAN_TARGETS: u16 = 16;
113113
pub const MAX_PLAN_FIELD_MUTATIONS: u16 = 128;
114114
pub const MAX_PLAN_SNAPSHOT_BYTES: u32 = 2_097_152;
115115
pub const MAX_PLAN_SOURCE_BYTES: usize = 65_536;
116-
pub const PLAN_RHAI_VERSION: &str = "1.26.1";
116+
pub const PLAN_RHAI_VERSION: &str = "1.27.0";
117117
pub(crate) fn valid_function_path(path: &str) -> bool {
118118
!path.is_empty()
119119
&& path.len() <= 256

‎crates/registry-breg/tests/compiled_handler_wire.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn current_plan_inventory_round_trips_canonically() {
5555
.expect("the frozen action declares a handler");
5656
assert_eq!(handler.kind, CompiledPlanFunctionKind::Rhai);
5757
assert_eq!(handler.abi, registry_breg::contract::ACTION_PLAN_ABI_V1);
58-
assert_eq!(handler.rhai_version.as_deref(), Some("1.26.1"));
58+
assert_eq!(handler.rhai_version.as_deref(), Some("1.27.0"));
5959

6060
let rendered = canonicalize_json(&serde_json::to_value(&inventory).unwrap()).unwrap();
6161
let decoded: CompiledActionInventory = serde_json::from_slice(&rendered).unwrap();

‎crates/registry-coordinator/src/functions.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{CoordinatorError, Result};
1717
/// Changing this identity requires a new Workflow revision.
1818
pub const PURE_PROFILE: &str = "coordinator/bounded-pure/v1";
1919

20-
pub const INTERPRETER_ABI: &str = "coordinator/pure-rhai-1.26.1/v1;named-input-object;raw-arithmetic-logic-string-array-map-iterator-instant;ops=100000;calls=32;expr=64;string=16384;array=256;map=256;source=65536;json=131072;depth=32";
20+
pub const INTERPRETER_ABI: &str = "coordinator/pure-rhai-1.27.0/v1;named-input-object;raw-arithmetic-logic-string-array-map-iterator-instant;ops=100000;calls=32;expr=64;string=16384;array=256;map=256;source=65536;json=131072;depth=32";
2121

2222
pub(crate) const MAXIMUM_FUNCTION_OPERATIONS: u32 = 100_000;
2323
pub(crate) const MAXIMUM_FUNCTION_CALL_LEVELS: u32 = 32;

‎crates/registry-coordinator/tests/authoring.rs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,19 @@ fn snapshots_refuse_unsupported_abi_duplicate_fields_and_mutation() {
456456
);
457457
}
458458

459+
#[test]
460+
fn snapshot_restore_refuses_retired_rhai_1_26_1_interpreter() {
461+
let snapshot = fixture().snapshot().unwrap();
462+
let mut value: Value = serde_json::from_str(&snapshot).unwrap();
463+
value["interpreterAbi"] = json!(
464+
"coordinator/pure-rhai-1.26.1/v1;named-input-object;raw-arithmetic-logic-string-array-map-iterator-instant;ops=100000;calls=32;expr=64;string=16384;array=256;map=256;source=65536;json=131072;depth=32"
465+
);
466+
assert_eq!(
467+
refused(Definition::from_snapshot(&value.to_string())).code,
468+
"definition.abi"
469+
);
470+
}
471+
459472
fn canonical(value: &Value) -> String {
460473
String::from_utf8(registry_platform_canonical_json::canonicalize_json(value).unwrap()).unwrap()
461474
}

‎crates/registry-evidence-authoring/src/derivation.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::finding::{FieldPath, Finding};
1818
///
1919
/// `Engine::new` hands out three capabilities this crate must not have. Its
2020
/// module resolver opens the file an `import` statement names. Its print and
21-
/// debug handlers are `println!` (rhai 1.26.1, `src/engine.rs:305-318`), so an
21+
/// debug handlers print to standard output, so an
2222
/// authored `print` or `debug` writes to file descriptor 1, which in the editor
2323
/// process this crate is linked into is the JSON-RPC channel itself. Parsing
2424
/// asks for none of the three, so the engine as built would reach nothing, but

‎crates/registry-evidence-authoring/tests/no_io.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const FORBIDDEN: &[(&str, &str)] = &[
175175
"resolves an imported module by reading a file",
176176
),
177177
// Every other way of getting an engine. `Engine::default` is `Engine::new`
178-
// (rhai 1.26.1, `src/engine.rs`), so it arrives carrying the file-reading
178+
// in Rhai, so it arrives carrying the file-reading
179179
// resolver under a name the guard below does not read; the raw pair arrives
180180
// without one, which is safe but equally unread. Leaving one spelling is
181181
// what lets the guard speak for every engine this crate builds.
@@ -752,8 +752,8 @@ fn the_source_sweep_reads_an_import_however_it_is_wrapped() {
752752
///
753753
/// With the default features this workspace pins, a new engine carries a
754754
/// `FileModuleResolver`, which opens whatever path an `import` statement names,
755-
/// and a print and a debug handler that are `println!` (rhai 1.26.1,
756-
/// `src/engine.rs:305-318`). The resolver turns an editor into a file reader
755+
/// and print and debug handlers that write to standard output. The resolver
756+
/// turns an editor into a file reader
757757
/// driven by an author's own text; the other two put author-controlled text on
758758
/// the file descriptor the editor's JSON-RPC conversation runs over. Nothing in
759759
/// this crate asks for a module or evaluates a program today, but "nothing asks
@@ -1179,7 +1179,7 @@ fn the_lint_disallows_the_engine_and_every_way_of_running_one() {
11791179
fn the_source_sweep_reads_prose_as_prose() {
11801180
// The comment above `parser` names the handler an engine arrives with,
11811181
// because saying which one is the point of it.
1182-
assert!(refusals("/// arrives carrying `println!` (rhai 1.26.1)").is_empty());
1182+
assert!(refusals("/// arrives carrying `println!` in Rhai").is_empty());
11831183
assert!(refusals("// let bytes = fs::read(path)?;").is_empty());
11841184
// A comment at the end of a line does not cover the line.
11851185
assert!(!refusals("let bytes = fs::read(path)?; // the hazard").is_empty());

‎crates/registry-evidence/src/rhai_runtime.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ fn validate_top_level_functions(source: &str) -> Result<(), RhaiRuntimeError> {
15841584
Ok(())
15851585
}
15861586

1587-
/// Walks the script the way Rhai 1.25.1 tokenizes it, rejects the forbidden constructs,
1587+
/// Walks the script the way Rhai tokenizes it, rejects the forbidden constructs,
15881588
/// and reports where the index guard must wrap an index operand.
15891589
fn review_script_bytes(source: &str) -> Result<Vec<(usize, IndexGuard)>, RhaiRuntimeError> {
15901590
let mut cursor = ScriptCursor::new(source);
@@ -1800,7 +1800,7 @@ impl<'a> ScriptCursor<'a> {
18001800
}
18011801
}
18021802

1803-
/// Rhai 1.25.1 reads `#"..."#` and `##"..."##` as raw strings, whose bodies may
1803+
/// Rhai reads `#"..."#` and `##"..."##` as raw strings, whose bodies may
18041804
/// contain quotes. Only `#{` stays inside the reviewed language, so every other `#`
18051805
/// fails rather than letting this scanner and the Rhai tokenizer disagree about
18061806
/// where a string ends.

‎products/breg/SECURITY-REVIEW-NOTES.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4678,6 +4678,12 @@ collection method. A separately governed action or hook script that does use
46784678
one may reach the unchanged ceiling sooner and should be compiled and
46794679
evaluated before activation.
46804680

4681+
The compiled Rhai handler inventory now records 1.27.0, so recompiling a
4682+
project with a Rhai handler produces a new behavior revision for each affected
4683+
Action. Operators must regenerate and reseal governed packages, review those
4684+
revisions, and activate them through the existing migration boundary rather
4685+
than reusing a package compiled for 1.26.1.
4686+
46814687
The shared platform test
46824688
`rhai_maps_use_compact_string_keys_and_owned_unicode_round_trips` guards the
46834689
backend selection. `native_plan_security` retains the BReg resource,

‎products/breg/examples/formats/ctl-report.json‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@
271271
},
272272
"systemApplyGrant": {
273273
"actionId": "correct-address",
274-
"actionRevision": "sha256:70318e95008100a9871aef80bb45eef7f5eed9e98ea65d5ee3ee6bf2d74a6402",
275-
"revision": "sha256:1afeab9fd55185d7ec5b63c8cc57fd20685c8801b7b688f60aeccaedb75e882c",
274+
"actionRevision": "sha256:efb20d40704ae6c133b660f2fe3d556b4a00ee5478a5871cf1fd026e7d7b6b7a",
275+
"revision": "sha256:b09c24636b3d208832104a44747d02487181ee91ed74305e6fe0db2fba63c6f6",
276276
"targets": [
277277
{
278278
"fields": [],
@@ -375,7 +375,7 @@
375375
}
376376
}
377377
],
378-
"migrationReviewRevision": "sha256:0c2bfdcc4d48d0b8e7143ee4679c54c7e7a7265ade70c7c50b7c6b5fc4ccb495",
378+
"migrationReviewRevision": "sha256:bf6bf99b13e7fe02e0a71b79b86847509d0d7311bc1e52cda533b7815753a16b",
379379
"permissions": [
380380
{
381381
"default": false,
@@ -452,7 +452,7 @@
452452
"refusals": {
453453
"invalid-postal-code": "Postal code is invalid"
454454
},
455-
"rhaiVersion": "1.26.1",
455+
"rhaiVersion": "1.27.0",
456456
"scriptSha256": "sha256:0270538e561991ed35b7fa004f47fd98b744e626bd395fec3f073d61bc02b830",
457457
"source": "plans/correct-address.rhai",
458458
"sourceModule": null,
@@ -495,7 +495,7 @@
495495
},
496496
"type": "function"
497497
},
498-
"revision": "sha256:70318e95008100a9871aef80bb45eef7f5eed9e98ea65d5ee3ee6bf2d74a6402"
498+
"revision": "sha256:efb20d40704ae6c133b660f2fe3d556b4a00ee5478a5871cf1fd026e7d7b6b7a"
499499
},
500500
{
501501
"apiName": "deactivateFacility",
@@ -1644,7 +1644,7 @@
16441644
"protocol": "id.registrystack.org/protocols/review/v1"
16451645
}
16461646
],
1647-
"revision": "sha256:65be0c99c9c90400f8b7ea1652c721fa5a929db6e8bda6d3f9134e4d966a0f4e",
1647+
"revision": "sha256:a2ccebffbd8f763267a3e40b10c00ad1d34e0db09078e1a1e5f7a17788628c08",
16481648
"statisticalDatasets": []
16491649
},
16501650
"findings": [
@@ -1670,5 +1670,5 @@
16701670
"kind": "BRegCtlReport",
16711671
"ok": true,
16721672
"profile": "authoring",
1673-
"revision": "sha256:65be0c99c9c90400f8b7ea1652c721fa5a929db6e8bda6d3f9134e4d966a0f4e"
1673+
"revision": "sha256:a2ccebffbd8f763267a3e40b10c00ad1d34e0db09078e1a1e5f7a17788628c08"
16741674
}

‎products/breg/examples/formats/explain/access-explanation.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@
307307
},
308308
"systemApplyGrant": {
309309
"actionId": "correct-address",
310-
"actionRevision": "sha256:70318e95008100a9871aef80bb45eef7f5eed9e98ea65d5ee3ee6bf2d74a6402",
311-
"revision": "sha256:1afeab9fd55185d7ec5b63c8cc57fd20685c8801b7b688f60aeccaedb75e882c",
310+
"actionRevision": "sha256:efb20d40704ae6c133b660f2fe3d556b4a00ee5478a5871cf1fd026e7d7b6b7a",
311+
"revision": "sha256:b09c24636b3d208832104a44747d02487181ee91ed74305e6fe0db2fba63c6f6",
312312
"targets": [
313313
{
314314
"fields": [],
@@ -411,7 +411,7 @@
411411
}
412412
}
413413
],
414-
"migrationReviewRevision": "sha256:0c2bfdcc4d48d0b8e7143ee4679c54c7e7a7265ade70c7c50b7c6b5fc4ccb495",
414+
"migrationReviewRevision": "sha256:bf6bf99b13e7fe02e0a71b79b86847509d0d7311bc1e52cda533b7815753a16b",
415415
"permissions": [
416416
{
417417
"default": false,
@@ -488,7 +488,7 @@
488488
"refusals": {
489489
"invalid-postal-code": "Postal code is invalid"
490490
},
491-
"rhaiVersion": "1.26.1",
491+
"rhaiVersion": "1.27.0",
492492
"scriptSha256": "sha256:0270538e561991ed35b7fa004f47fd98b744e626bd395fec3f073d61bc02b830",
493493
"source": "plans/correct-address.rhai",
494494
"sourceModule": null,
@@ -531,7 +531,7 @@
531531
},
532532
"type": "function"
533533
},
534-
"revision": "sha256:70318e95008100a9871aef80bb45eef7f5eed9e98ea65d5ee3ee6bf2d74a6402"
534+
"revision": "sha256:efb20d40704ae6c133b660f2fe3d556b4a00ee5478a5871cf1fd026e7d7b6b7a"
535535
},
536536
{
537537
"apiName": "deactivateFacility",

0 commit comments

Comments
 (0)