Delete duplicate schema and source tests
This commit is contained in:
parent
8907faa873
commit
16d85b1bdf
2 changed files with 0 additions and 209 deletions
|
|
@ -789,191 +789,3 @@ fn extend_unique_strings(target: &mut Vec<String>, values: impl IntoIterator<Ite
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn frontier_schema_separates_repository_authority_from_observed_sources() {
|
||||
let schema = repo_frontier_item_output_schema();
|
||||
let properties = schema["properties"]
|
||||
.as_object()
|
||||
.expect("frontier properties");
|
||||
assert!(properties.contains_key("repository_scope"));
|
||||
assert!(!properties.contains_key("source_scope"));
|
||||
assert!(
|
||||
properties["repository_scope"]["description"]
|
||||
.as_str()
|
||||
.is_some_and(|description| {
|
||||
description.contains("not-yet-created outputs")
|
||||
&& description.contains("evidence files")
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn role_schema_has_no_generic_self_patch_mouth() {
|
||||
let schema = epiphany_role_launch_output_schema(EpiphanyRoleResultRoleId::Verification);
|
||||
assert!(schema["properties"].get("selfPatch").is_none());
|
||||
assert_eq!(schema["additionalProperties"], false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn research_schema_reuses_complete_typed_evidence_shapes() {
|
||||
let schema = epiphany_role_launch_output_schema(EpiphanyRoleResultRoleId::Research);
|
||||
let decision = &schema["properties"]["researchDecision"];
|
||||
let observation = &decision["properties"]["observations"]["items"];
|
||||
let evidence = &decision["properties"]["evidence"]["items"];
|
||||
|
||||
assert_eq!(decision["additionalProperties"], false);
|
||||
assert_eq!(observation, &observation_output_schema());
|
||||
assert_eq!(evidence, &evidence_output_schema());
|
||||
assert!(
|
||||
observation["required"]
|
||||
.as_array()
|
||||
.is_some_and(|required| required.iter().any(|field| field == "source_kind"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frontier_planning_schema_exposes_candidate_without_generic_patch_mouths() {
|
||||
let schema = epiphany_frontier_planning_output_schema();
|
||||
assert!(
|
||||
schema["properties"]
|
||||
.get("frontierPlanningRequestId")
|
||||
.is_none()
|
||||
);
|
||||
assert!(schema["properties"].get("frontierPlanCandidate").is_some());
|
||||
assert!(schema["properties"].get("researchDecision").is_none());
|
||||
assert!(schema["properties"].get("selfPatch").is_none());
|
||||
assert!(schema["properties"].get("repoModelPatch").is_none());
|
||||
for runtime_owned in [
|
||||
"planning_request_id",
|
||||
"model_revision",
|
||||
"model_hash",
|
||||
"frontier_item_id",
|
||||
"frontier_item_hash",
|
||||
"proposed_at",
|
||||
] {
|
||||
assert!(
|
||||
schema["properties"]["frontierPlanCandidate"]["properties"]
|
||||
.get(runtime_owned)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
schema["properties"]["frontierPlanCandidate"]["properties"]["safe_paths"]
|
||||
["description"]
|
||||
.as_str()
|
||||
.is_some_and(|description| description.contains("never add an adjacent"))
|
||||
);
|
||||
assert_eq!(schema["additionalProperties"], false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn consideration_schema_has_only_proposal_candidate_cargo() {
|
||||
let schema = epiphany_imagination_consideration_output_schema();
|
||||
assert!(
|
||||
schema["properties"]
|
||||
.get("imaginationConsiderationRequestId")
|
||||
.is_none()
|
||||
);
|
||||
assert!(
|
||||
schema["properties"]
|
||||
.get("imaginationConsiderationCandidate")
|
||||
.is_some()
|
||||
);
|
||||
for runtime_owned in [
|
||||
"request_id",
|
||||
"feedback_id",
|
||||
"feedback_packet_sha256",
|
||||
"source_room_id",
|
||||
"source_visibility",
|
||||
"data_classification",
|
||||
"model_revision",
|
||||
"model_hash",
|
||||
"evidence_refs",
|
||||
"proposed_at",
|
||||
"contract",
|
||||
] {
|
||||
assert!(
|
||||
schema["properties"]["imaginationConsiderationCandidate"]["properties"]
|
||||
.get(runtime_owned)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
for forbidden in [
|
||||
"researchDecision",
|
||||
"selfPatch",
|
||||
"repoModelPatch",
|
||||
"frontierPlanCandidate",
|
||||
] {
|
||||
assert!(schema["properties"].get(forbidden).is_none());
|
||||
}
|
||||
assert_eq!(schema["additionalProperties"], false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proposal_modeling_schema_exposes_only_strict_semantic_frontier_draft() {
|
||||
let schema =
|
||||
epiphany_proposal_modeling_output_schema(crate::RepoFrontierProposalSourceKind::User);
|
||||
assert_eq!(schema["additionalProperties"], false);
|
||||
assert!(schema["properties"].get("proposalFrontierDraft").is_some());
|
||||
for runtime_owned in [
|
||||
"repoModelPatch",
|
||||
"proposalModelingRequestId",
|
||||
"repositoryBodyObservationBasis",
|
||||
"researchDecision",
|
||||
"selfPatch",
|
||||
] {
|
||||
assert!(schema["properties"].get(runtime_owned).is_none());
|
||||
}
|
||||
let properties = schema["properties"].as_object().expect("root properties");
|
||||
let required = schema["required"].as_array().expect("root required");
|
||||
assert!(
|
||||
properties
|
||||
.keys()
|
||||
.all(|key| required.iter().any(|item| item.as_str() == Some(key)))
|
||||
);
|
||||
let draft = &schema["properties"]["proposalFrontierDraft"];
|
||||
let draft_properties = draft["properties"].as_object().expect("draft properties");
|
||||
let draft_required = draft["required"].as_array().expect("draft required");
|
||||
assert!(draft_properties.contains_key("repositoryScope"));
|
||||
assert!(!draft_properties.contains_key("sourceScope"));
|
||||
assert!(
|
||||
draft_properties["repositoryScope"]["description"]
|
||||
.as_str()
|
||||
.is_some_and(|description| description.contains("intended outputs"))
|
||||
);
|
||||
assert!(
|
||||
draft_properties
|
||||
.keys()
|
||||
.all(|key| draft_required.iter().any(|item| item.as_str() == Some(key)))
|
||||
);
|
||||
fn every_const_has_a_type(value: &serde_json::Value) -> bool {
|
||||
match value {
|
||||
serde_json::Value::Object(map) => {
|
||||
(!map.contains_key("const") || map.contains_key("type"))
|
||||
&& map.values().all(every_const_has_a_type)
|
||||
}
|
||||
serde_json::Value::Array(values) => values.iter().all(every_const_has_a_type),
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
assert!(every_const_has_a_type(&schema));
|
||||
|
||||
let imagination = epiphany_proposal_modeling_output_schema(
|
||||
crate::RepoFrontierProposalSourceKind::Imagination,
|
||||
);
|
||||
assert!(
|
||||
!imagination["properties"]["proposalFrontierDraft"]["properties"]
|
||||
["recommendedNextOrgan"]["enum"]
|
||||
.as_array()
|
||||
.expect("organ enum")
|
||||
.iter()
|
||||
.any(|organ| organ == "Hands")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2926,27 +2926,6 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_source_has_no_generic_role_patch_parser() {
|
||||
let retired_field = ["state", "Patch"].concat();
|
||||
let production = include_str!("lib.rs")
|
||||
.split("#[cfg(test)]")
|
||||
.next()
|
||||
.unwrap_or_default();
|
||||
assert!(!production.contains(&retired_field));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_source_exposes_no_caller_authored_provider_request_store() {
|
||||
let production = include_str!("lib.rs")
|
||||
.split("#[cfg(test)]")
|
||||
.next()
|
||||
.unwrap_or_default();
|
||||
assert!(!production.contains("pub fn store_openai_request"));
|
||||
assert!(!production.contains("pub fn record_openai_events"));
|
||||
assert!(production.contains("pub fn record_native_model_events"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn role_ingress_rejects_duplicate_top_level_fields() {
|
||||
let error = parse_assistant_json::<RoleWorkerResultIngress>(
|
||||
|
|
|
|||
Reference in a new issue