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:
bellman
2026-05-14 18:06:14 +09:00
parent f8d744bb37
commit ff37d395bb
4 changed files with 309 additions and 4956 deletions

View File

@@ -42,19 +42,10 @@ impl G004ConformanceError {
pub fn validate_g004_contract_bundle(bundle: &Value) -> Vec<G004ConformanceError> {
let mut errors = Vec::new();
require_string_eq(
bundle,
"/schemaVersion",
BUNDLE_SCHEMA_VERSION,
&mut errors,
);
require_string_eq(bundle, "/schemaVersion", BUNDLE_SCHEMA_VERSION, &mut errors);
validate_lane_events(bundle.get("laneEvents"), "/laneEvents", &mut errors);
validate_reports(bundle.get("reports"), "/reports", &mut errors);
validate_approval_tokens(
bundle.get("approvalTokens"),
"/approvalTokens",
&mut errors,
);
validate_approval_tokens(bundle.get("approvalTokens"), "/approvalTokens", &mut errors);
errors
}
@@ -64,11 +55,7 @@ pub fn is_g004_contract_bundle_valid(bundle: &Value) -> bool {
validate_g004_contract_bundle(bundle).is_empty()
}
fn validate_lane_events(
value: Option<&Value>,
path: &str,
errors: &mut Vec<G004ConformanceError>,
) {
fn validate_lane_events(value: Option<&Value>, path: &str, errors: &mut Vec<G004ConformanceError>) {
let Some(events) = non_empty_array(value, path, errors) else {
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> {
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
}

View File

@@ -122,9 +122,9 @@ pub use oauth::{
};
pub use permissions::{
ApprovalDelegationHop, ApprovalScope, ApprovalTokenAudit, ApprovalTokenError,
ApprovalTokenGrant, ApprovalTokenLedger, ApprovalTokenStatus, PermissionContext, PermissionMode,
PermissionOutcome, PermissionOverride, PermissionPolicy, PermissionPromptDecision,
PermissionPrompter, PermissionRequest,
ApprovalTokenGrant, ApprovalTokenLedger, ApprovalTokenStatus, PermissionContext,
PermissionMode, PermissionOutcome, PermissionOverride, PermissionPolicy,
PermissionPromptDecision, PermissionPrompter, PermissionRequest,
};
pub use plugin_lifecycle::{
DegradedMode, DiscoveryResult, PluginHealthcheck, PluginLifecycle, PluginLifecycleEvent,

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,4 @@
use runtime::g004_conformance::{
is_g004_contract_bundle_valid, validate_g004_contract_bundle,
};
use runtime::g004_conformance::{is_g004_contract_bundle_valid, validate_g004_contract_bundle};
use serde_json::{json, Value};
fn valid_bundle() -> Value {
@@ -14,7 +12,10 @@ fn valid_g004_contract_bundle_fixture_passes_conformance() {
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));
}