Skip to content

Commit e8f0147

Browse files
committed
merge: restore resource profile ABI v3 history
2 parents c2f3fac + 9d76655 commit e8f0147

12 files changed

Lines changed: 1022 additions & 229 deletions

File tree

crates/agent-spec/src/profile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub const AGENT_GOAL_SCHEME: &str = "dev.schickling.agent-goal";
3636
/// Maximum resolver module bytes admitted by both catalog transactions and the wasm runtime.
3737
pub const DEFAULT_MODULE_LIMIT_BYTES: usize = 16 * 1024 * 1024;
3838
/// Descriptor ABI implemented by this host.
39-
pub const PROFILE_DESCRIPTOR_ABI_VERSION: u32 = 2;
39+
pub const PROFILE_DESCRIPTOR_ABI_VERSION: u32 = 3;
4040
/// Maximum canonical compact JSON bytes accepted for one binding selector.
4141
pub const DEFAULT_SELECTOR_LIMIT_BYTES: usize = 16 * 1024;
4242

@@ -1091,7 +1091,7 @@ mod tests {
10911091
use super::*;
10921092

10931093
const VALID_DESCRIPTOR_JSON: &str = r#"{
1094-
"abiVersion": 2,
1094+
"abiVersion": 3,
10951095
"capabilities": ["resolve", "read", "observe"],
10961096
"selectorSchema": {
10971097
"type": "object",
@@ -1157,7 +1157,7 @@ mod tests {
11571157
}
11581158

11591159
#[test]
1160-
fn valid_v2_descriptor_and_nested_selector_validate() {
1160+
fn valid_v3_descriptor_and_nested_selector_validate() {
11611161
let descriptor = valid_descriptor();
11621162
assert_eq!(descriptor.abi_version, PROFILE_DESCRIPTOR_ABI_VERSION);
11631163
assert_eq!(descriptor.runtime.topology, RuntimeTopology::Shared);
@@ -1171,7 +1171,7 @@ mod tests {
11711171

11721172
#[test]
11731173
fn descriptor_rejects_unknown_abi_capability_and_fields() {
1174-
let unknown_abi = VALID_DESCRIPTOR_JSON.replace("\"abiVersion\": 2", "\"abiVersion\": 9");
1174+
let unknown_abi = VALID_DESCRIPTOR_JSON.replace("\"abiVersion\": 3", "\"abiVersion\": 9");
11751175
assert!(
11761176
ProfileDescriptor::from_json(unknown_abi.as_bytes())
11771177
.unwrap_err()
@@ -1187,7 +1187,7 @@ mod tests {
11871187
);
11881188

11891189
let unknown_field =
1190-
VALID_DESCRIPTOR_JSON.replace("\"abiVersion\": 2,", "\"abiVersion\": 2, \"extra\": true,");
1190+
VALID_DESCRIPTOR_JSON.replace("\"abiVersion\": 3,", "\"abiVersion\": 3, \"extra\": true,");
11911191
assert!(
11921192
ProfileDescriptor::from_json(unknown_field.as_bytes())
11931193
.unwrap_err()

crates/agent-spec/src/spec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ impl AgentSpec {
363363
.or_else(|| self.driver.as_ref().map(Driver::session_driver))
364364
}
365365
}
366-
367366
fn deserialize_optional_selector<'de, D>(
368367
deserializer: D,
369368
) -> Result<Option<serde_json::Value>, D::Error>

crates/agent-spec/tests/profile_wasm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn descriptor_module(payload: &[u8], reported_len: usize) -> WasmResolver {
7474
}
7575

7676
const VALID_DESCRIPTOR: &str = r#"{
77-
"abiVersion": 2,
77+
"abiVersion": 3,
7878
"capabilities": ["resolve", "read", "observe"],
7979
"selectorSchema": {
8080
"type": "object",
@@ -112,12 +112,12 @@ fn current_rss_bytes() -> u64 {
112112
}
113113

114114
#[test]
115-
fn valid_v2_descriptor_executes_and_resolve_only_module_stays_passive() {
115+
fn valid_v3_descriptor_executes_and_resolve_only_module_stays_passive() {
116116
let descriptor = descriptor_module(VALID_DESCRIPTOR.as_bytes(), VALID_DESCRIPTOR.len())
117117
.describe_once()
118118
.expect("describe call succeeds")
119119
.expect("descriptor is present");
120-
assert_eq!(descriptor.abi_version, 2);
120+
assert_eq!(descriptor.abi_version, 3);
121121

122122
assert!(
123123
WasmResolver::load(Path::new(DEMO_WASM_PATH))

0 commit comments

Comments
 (0)