mirror of
https://github.com/instructkr/claw-code.git
synced 2026-05-18 21:41:26 +08:00
Stabilize G004 contract integration after worker merges
Constraint: G004 worker integrations introduced unparseable approval-token tests and a conformance path bug that blocked leader verification.\nRejected: waiting for another auto-integration cycle | local leader verification had exact parse and fixture failures to repair safely.\nConfidence: high\nScope-risk: moderate\nDirective: Keep approval-token regression tests in cfg(test) modules or integration tests, never inside type definitions.\nTested: cargo fmt --manifest-path rust/Cargo.toml --all -- --check; cargo check --manifest-path rust/Cargo.toml -p runtime; cargo test --manifest-path rust/Cargo.toml -p runtime approval_token -- --nocapture; cargo test --manifest-path rust/Cargo.toml -p runtime --test g004_conformance -- --nocapture; python3 .github/scripts/check_doc_source_of_truth.py\nNot-tested: full workspace test suite; remaining G004 tasks 1-5 still non-terminal.\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
@@ -42,19 +42,10 @@ impl G004ConformanceError {
|
|||||||
pub fn validate_g004_contract_bundle(bundle: &Value) -> Vec<G004ConformanceError> {
|
pub fn validate_g004_contract_bundle(bundle: &Value) -> Vec<G004ConformanceError> {
|
||||||
let mut errors = Vec::new();
|
let mut errors = Vec::new();
|
||||||
|
|
||||||
require_string_eq(
|
require_string_eq(bundle, "/schemaVersion", BUNDLE_SCHEMA_VERSION, &mut errors);
|
||||||
bundle,
|
|
||||||
"/schemaVersion",
|
|
||||||
BUNDLE_SCHEMA_VERSION,
|
|
||||||
&mut errors,
|
|
||||||
);
|
|
||||||
validate_lane_events(bundle.get("laneEvents"), "/laneEvents", &mut errors);
|
validate_lane_events(bundle.get("laneEvents"), "/laneEvents", &mut errors);
|
||||||
validate_reports(bundle.get("reports"), "/reports", &mut errors);
|
validate_reports(bundle.get("reports"), "/reports", &mut errors);
|
||||||
validate_approval_tokens(
|
validate_approval_tokens(bundle.get("approvalTokens"), "/approvalTokens", &mut errors);
|
||||||
bundle.get("approvalTokens"),
|
|
||||||
"/approvalTokens",
|
|
||||||
&mut errors,
|
|
||||||
);
|
|
||||||
|
|
||||||
errors
|
errors
|
||||||
}
|
}
|
||||||
@@ -64,11 +55,7 @@ pub fn is_g004_contract_bundle_valid(bundle: &Value) -> bool {
|
|||||||
validate_g004_contract_bundle(bundle).is_empty()
|
validate_g004_contract_bundle(bundle).is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_lane_events(
|
fn validate_lane_events(value: Option<&Value>, path: &str, errors: &mut Vec<G004ConformanceError>) {
|
||||||
value: Option<&Value>,
|
|
||||||
path: &str,
|
|
||||||
errors: &mut Vec<G004ConformanceError>,
|
|
||||||
) {
|
|
||||||
let Some(events) = non_empty_array(value, path, errors) else {
|
let Some(events) = non_empty_array(value, path, errors) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -315,5 +302,16 @@ fn is_terminal_event_value(value: Option<&Value>) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_path<'a>(root: &'a Value, path: &str) -> Option<&'a Value> {
|
fn get_path<'a>(root: &'a Value, path: &str) -> Option<&'a Value> {
|
||||||
root.pointer(path)
|
if let Some(value) = root.pointer(path) {
|
||||||
|
return Some(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
let segments = path.trim_start_matches('/').split('/').collect::<Vec<_>>();
|
||||||
|
for index in 1..segments.len() {
|
||||||
|
let relative = format!("/{}", segments[index..].join("/"));
|
||||||
|
if let Some(value) = root.pointer(&relative) {
|
||||||
|
return Some(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ pub use oauth::{
|
|||||||
};
|
};
|
||||||
pub use permissions::{
|
pub use permissions::{
|
||||||
ApprovalDelegationHop, ApprovalScope, ApprovalTokenAudit, ApprovalTokenError,
|
ApprovalDelegationHop, ApprovalScope, ApprovalTokenAudit, ApprovalTokenError,
|
||||||
ApprovalTokenGrant, ApprovalTokenLedger, ApprovalTokenStatus, PermissionContext, PermissionMode,
|
ApprovalTokenGrant, ApprovalTokenLedger, ApprovalTokenStatus, PermissionContext,
|
||||||
PermissionOutcome, PermissionOverride, PermissionPolicy, PermissionPromptDecision,
|
PermissionMode, PermissionOutcome, PermissionOverride, PermissionPolicy,
|
||||||
PermissionPrompter, PermissionRequest,
|
PermissionPromptDecision, PermissionPrompter, PermissionRequest,
|
||||||
};
|
};
|
||||||
pub use plugin_lifecycle::{
|
pub use plugin_lifecycle::{
|
||||||
DegradedMode, DiscoveryResult, PluginHealthcheck, PluginLifecycle, PluginLifecycleEvent,
|
DegradedMode, DiscoveryResult, PluginHealthcheck, PluginLifecycle, PluginLifecycleEvent,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,4 @@
|
|||||||
use runtime::g004_conformance::{
|
use runtime::g004_conformance::{is_g004_contract_bundle_valid, validate_g004_contract_bundle};
|
||||||
is_g004_contract_bundle_valid, validate_g004_contract_bundle,
|
|
||||||
};
|
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
fn valid_bundle() -> Value {
|
fn valid_bundle() -> Value {
|
||||||
@@ -14,7 +12,10 @@ fn valid_g004_contract_bundle_fixture_passes_conformance() {
|
|||||||
|
|
||||||
let errors = validate_g004_contract_bundle(&fixture);
|
let errors = validate_g004_contract_bundle(&fixture);
|
||||||
|
|
||||||
assert!(errors.is_empty(), "unexpected conformance errors: {errors:?}");
|
assert!(
|
||||||
|
errors.is_empty(),
|
||||||
|
"unexpected conformance errors: {errors:?}"
|
||||||
|
);
|
||||||
assert!(is_g004_contract_bundle_valid(&fixture));
|
assert!(is_g004_contract_bundle_valid(&fixture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user