Ground proposal frontiers in canonical claims

This commit is contained in:
Meta Vens 2026-08-07 02:09:43 +01:00
commit 744c6f9511
5 changed files with 45 additions and 6 deletions

View file

@ -75,13 +75,13 @@ pub fn epiphany_role_label(role_id: EpiphanyRoleResultRoleId) -> &'static str {
fn repo_frontier_item_output_schema() -> serde_json::Value {
serde_json::json!({
"type": "object",
"required": ["id", "migration_body", "question", "gap", "recommended_next_organ", "status"],
"required": ["id", "migration_body", "question", "gap", "target_claim_ids", "recommended_next_organ", "status"],
"properties": {
"id": {"type": "string", "minLength": 1},
"migration_body": {"type": "string", "minLength": 1},
"question": {"type": "string", "minLength": 1},
"gap": {"type": "string", "minLength": 1},
"target_claim_ids": {"type": "array", "items": {"type": "string"}},
"target_claim_ids": {"type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}},
"source_scope": {"type": "array", "items": {"type": "string"}},
"recommended_next_organ": {"type": "string", "minLength": 1},
"dependency_item_ids": {"type": "array", "items": {"type": "string"}},
@ -1529,6 +1529,16 @@ mod tests {
schema["properties"]["repositoryBodyObservationBasis"]["additionalProperties"],
false
);
let frontier_item = &schema["properties"]["repoModelPatch"]["properties"]["operations"]
["items"]["anyOf"][6]["properties"]["item"];
assert!(
frontier_item["required"]
.as_array()
.unwrap()
.iter()
.any(|value| value == "target_claim_ids")
);
assert_eq!(frontier_item["properties"]["target_claim_ids"]["minItems"], 1);
let purposes = schema["properties"]["repoModelPatch"]["properties"]["purpose"]["oneOf"]
.as_array()
.expect("typed Modeling purpose alternatives");

View file

@ -414,6 +414,16 @@ fn run_native_status(args: &Args) -> Result<Value> {
verification_finding.as_ref(),
reorient_finding.as_ref(),
);
let modeling_result_proposal_bound = latest_runtime_job_id_for_binding(
state_ref,
MODELING_BINDING_ID,
)
.and_then(|job_id| {
epiphany_core::runtime_role_worker_result(&runtime_store_path, job_id)
.ok()
.flatten()
})
.is_some_and(|result| result.proposal_modeling_request_id.is_some());
let hands_frontier_ready = runtime_has_actionable_hands_frontier(&runtime_store_path)
.context("failed to derive actionable Hands frontier from runtime-spine state")?;
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
@ -436,7 +446,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
modeling_result_accepted: finding_signals.modeling_result_accepted,
modeling_result_reviewable: finding_signals.modeling_result_reviewable,
modeling_result_failure_reviewed: finding_signals.modeling_result_failure_reviewed,
modeling_result_proposal_bound: finding_signals.modeling_result_proposal_bound,
modeling_result_proposal_bound,
modeling_result_accepted_after_verification: finding_signals
.modeling_result_accepted_after_verification,
implementation_evidence_after_verification: finding_signals
@ -531,6 +541,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
"modelingResultAccepted": finding_signals.modeling_result_accepted,
"modelingResultReviewable": finding_signals.modeling_result_reviewable,
"modelingResultFailureReviewed": finding_signals.modeling_result_failure_reviewed,
"modelingResultProposalBound": modeling_result_proposal_bound,
"verificationResultAccepted": finding_signals.verification_result_accepted,
"verificationResultFailureReviewed": finding_signals.verification_result_failure_reviewed,
},

View file

@ -276,7 +276,14 @@ pub fn append_modeling_repo_model_shape_context(
domain.id, profile, lifecycle, domain.title
));
}
context.push_str("New nodes must reference one exact existing domain id; RepoArchitecture and RepoDataflow nodes/edges may use only observed, proposed, accepted, stale, or retired lifecycle. Prefer accepted for a source-grounded current claim. Do not invent a domain because RepoModel patches have no domain mutation operation.\n");
context.push_str("existingClaims:\n");
for node in &snapshot.nodes {
context.push_str(&format!(
"- id={} domain={} title={}\n",
node.id, node.domain_id, node.title
));
}
context.push_str("New nodes must reference one exact existing domain id. Every unresolved frontier item must target at least one exact existing claim id from existingClaims, or a claim id created by the same patch. RepoArchitecture and RepoDataflow nodes/edges may use only observed, proposed, accepted, stale, or retired lifecycle. Prefer accepted for a source-grounded current claim. Do not invent a domain because RepoModel patches have no domain mutation operation.\n");
context.push_str("</canonical_repo_model_shape>");
Ok(context)
}
@ -1176,6 +1183,8 @@ mod tests {
.map_err(anyhow::Error::msg)?;
assert!(shape.contains("<canonical_repo_model_shape>"));
assert!(shape.contains("id=repo"));
assert!(shape.contains("existingClaims:"));
assert!(shape.contains("id=claim-modeling-authority domain=repo"));
assert!(shape.contains("Prefer accepted"));
fs::remove_dir_all(&temp)?;
Ok(())

View file

@ -101,7 +101,7 @@ If you emit an `anchor`, it must include its own stable `id`, `kind`, and `targe
The launch context includes `<canonical_repo_model_shape>`. Every new node must use one exact `existingDomains` id from that packet, and repo architecture/dataflow nodes and edges must use one of the listed legal lifecycles. Never derive a domain id from the workspace path; patches cannot create domains.
When `<repo_frontier_modeling_request>` is present, echo its exact `modelingRequestId` as `repoFrontierModelingRequestId`, use `purpose.kind=incorporate_frontier_verdict` with its exact `frontierRouteId` and `soulVerdictReceiptId`, and revise only its routed frontier item to its allowed disposition. The typed request is authority; nearby telemetry, timestamps, and prose are not substitutes. When that request is absent, use `purpose.kind=evolution` and do not invent verdict-incorporation authority.
An ordinary `purpose.kind=evolution` patch without `proposalModelingContext` may mutate nodes and edges only. It must not upsert, revise, retire, or adopt frontier items. Describe an observed frontier wound in `summary`, `evidenceGaps`, or `nextSafeMove` when no typed frontier authority exists.
When the typed launch document contains `proposalModelingContext`, echo its exact `requestId` as `proposalModelingRequestId` and use `purpose.kind=evolution`. This is the one evolution frontier exception: emit exactly one `upsert_frontier` operation grounded in the proposal, cite the exact `proposalId` in both top-level `evidenceIds` and the frontier item's `evidence_refs`, preserve the proposal's exact `scopeHints` as `source_scope`, and route a user proposal to `Hands` as an `active` item. You may also update source-grounded anatomy, but must not emit any other frontier operation. Read only that immutable typed projection against its exact canonical `modelRevision` and `modelHash`. The proposal is evidence, not campaign truth: Mind still owns admission, and Hands still owns execution. Do not substitute adjacent proposals, infer service intake, parse proposal authority from prose, or claim admission or execution authority.
When the typed launch document contains `proposalModelingContext`, echo its exact `requestId` as `proposalModelingRequestId` and use `purpose.kind=evolution`. This is the one evolution frontier exception: emit exactly one `upsert_frontier` operation grounded in the proposal, target at least one exact claim id from `<canonical_repo_model_shape>.existingClaims` (or a claim created by the same patch), cite the exact `proposalId` in both top-level `evidenceIds` and the frontier item's `evidence_refs`, preserve the proposal's exact `scopeHints` as `source_scope`, and route a user proposal to `Hands` as an `active` item. You may also update source-grounded anatomy, but must not emit any other frontier operation. Read only that immutable typed projection against its exact canonical `modelRevision` and `modelHash`. The proposal is evidence, not campaign truth: Mind still owns admission, and Hands still owns execution. Do not substitute adjacent proposals, infer service intake, parse proposal authority from prose, or claim admission or execution authority.
Generic `statePatch` is optional and has been stripped of repository-anatomy authority. If present, it may contain only coherent `observations` and `evidence`. Never put graphs, graph frontier, graph checkpoint, scratch, investigation checkpoint, planning, objectives, jobs, or other anatomy in `statePatch`; those old paths are demoted and will be rejected.
Do not edit files, do not implement product code, do not verify as if you were the reviewer, do not change jobs/subgoals/objective/invariants/churn/mode, and do not promote or accept your own output.
'''

View file

@ -1090,7 +1090,8 @@ mod tests {
"evidenceIds": ["ev-1"],
"artifactRefs": ["artifact:role"],
"runtimeResultId": "result-1",
"runtimeJobId": "job-1"
"runtimeJobId": "job-1",
"proposalModelingRequestId": "proposal-request-1"
}),
None,
None,
@ -1100,6 +1101,14 @@ mod tests {
assert_eq!(finding.verdict.as_deref(), Some("pass"));
assert_eq!(finding.files_inspected, vec!["src/lib.rs"]);
assert_eq!(finding.runtime_result_id.as_deref(), Some("result-1"));
assert_eq!(
finding.proposal_modeling_request_id.as_deref(),
Some("proposal-request-1")
);
assert_eq!(
serde_json::to_value(&finding).unwrap()["proposalModelingRequestId"],
"proposal-request-1"
);
}
#[test]