Require canonical proposal frontier organs

This commit is contained in:
Meta Vens 2026-08-07 18:03:56 +01:00
commit 4338b0331a
8 changed files with 99 additions and 277 deletions

View file

@ -411,7 +411,7 @@ pub fn append_modeling_repo_model_shape_context(
item.source_scope.join(" | "),
));
}
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. Every frontier source_scope must be non-empty and contain safe relative paths in strict lexicographic ascending order with no duplicates; proposal scope hints are evidence to normalize into that canonical order, not an instruction to preserve unsafe or unsorted serialization. A proposal Evolution upsert must use status active: Mind acceptance is the admission decision, and proposed state is not routeable by Self. Use upsert_frontier only for a genuinely new frontier id not listed in existingFrontier. Use revise_frontier when changing an id listed in existingFrontier; an existing frontier id cannot be upserted again. 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("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. Every frontier source_scope must be non-empty and contain safe relative paths in strict lexicographic ascending order with no duplicates; proposal scope hints are evidence to normalize into that canonical order, not an instruction to preserve unsafe or unsorted serialization. A proposal Evolution upsert must use status active: Mind acceptance is the admission decision, and proposed state is not routeable by Self. Its recommended_next_organ must be exactly one routeable canonical value with exact case: Hands, Eyes, or Imagination; lowercase labels are dead documents and Mind will refuse them. Use upsert_frontier only for a genuinely new frontier id not listed in existingFrontier. Use revise_frontier when changing an id listed in existingFrontier; an existing frontier id cannot be upserted again. 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)
}
@ -1380,6 +1380,7 @@ mod tests {
);
assert!(shape.contains("strict lexicographic ascending order with no duplicates"));
assert!(shape.contains("proposal Evolution upsert must use status active"));
assert!(shape.contains("recommended_next_organ must be exactly one routeable canonical value"));
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, 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`, set the unresolved frontier `status` to `active`, and normalize the proposal's relevant `scopeHints` into a non-empty `source_scope` of safe relative paths in strict lexicographic ascending order with no duplicates. Choose `recommended_next_organ` from the actual unresolved work; a user proposal is not automatically Hands-ready. 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`, set the unresolved frontier `status` to `active`, and normalize the proposal's relevant `scopeHints` into a non-empty `source_scope` of safe relative paths in strict lexicographic ascending order with no duplicates. Choose `recommended_next_organ` from the actual unresolved work using exactly one canonical routeable value with exact case: `Hands`, `Eyes`, or `Imagination`; a user proposal is not automatically Hands-ready. 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

@ -596,6 +596,7 @@ pub struct RepoFrontierPlanningCandidateEligibility {
pub frontier_item_id: String,
pub eligible: bool,
pub status_valid: bool,
pub recommended_next_organ_valid: bool,
pub source_scope_valid: bool,
pub challenged_target_claim_ids: Vec<String>,
pub unresolved_dependency_item_ids: Vec<String>,

View file

@ -3142,6 +3142,14 @@ pub fn commit_repo_model_admission(
"proposal Evolution frontier must be active so accepted unresolved work is immediately routeable"
));
}
if !matches!(
upserts[0].recommended_next_organ.as_str(),
"Hands" | "Eyes" | "Imagination"
) {
return Err(anyhow!(
"proposal Evolution frontier recommended_next_organ must be one exact routeable organ: Hands, Eyes, or Imagination"
));
}
if proposal.source_kind == crate::RepoFrontierProposalSourceKind::Imagination
&& (upserts[0].recommended_next_organ != "Imagination"
|| upserts[0].adopted_plan.is_some())
@ -6153,10 +6161,13 @@ pub fn runtime_repo_frontier_planning_eligibility(
matches!(
item.status,
crate::RepoFrontierStatus::Active | crate::RepoFrontierStatus::Proposed
) && item.recommended_next_organ == "Imagination"
) && item
.recommended_next_organ
.eq_ignore_ascii_case("Imagination")
})
.map(|item| {
let status_valid = item.status == crate::RepoFrontierStatus::Active;
let recommended_next_organ_valid = item.recommended_next_organ == "Imagination";
let source_scope_valid =
!item.source_scope.is_empty() && safe_sorted_unique_paths(&item.source_scope);
let mut challenged_target_claim_ids = challenges
@ -6184,10 +6195,12 @@ pub fn runtime_repo_frontier_planning_eligibility(
frontier_item_id: item.id.clone(),
eligible: admission_count == 1
&& status_valid
&& recommended_next_organ_valid
&& source_scope_valid
&& challenged_target_claim_ids.is_empty()
&& unresolved_dependency_item_ids.is_empty(),
status_valid,
recommended_next_organ_valid,
source_scope_valid,
challenged_target_claim_ids,
unresolved_dependency_item_ids,
@ -10611,6 +10624,7 @@ pub(crate) mod tests {
("unrelated-job", 7),
("unsorted-source-scope", 8),
("proposed-status", 9),
("noncanonical-next-organ", 10),
] {
let (store, mut result, mut review) = proposal_admission_fixture(root.path(), suffix)?;
match mutate {
@ -10665,6 +10679,19 @@ pub(crate) mod tests {
result.repo_model_patch_msgpack = Some(bytes.clone());
review.patch_sha256 = format!("{:x}", Sha256::digest(bytes));
}
10 => {
let mut patch: crate::RepoModelPatch =
rmp_serde::from_slice(result.repo_model_patch_msgpack.as_deref().unwrap())?;
let crate::RepoModelPatchOperation::UpsertFrontier { item } =
&mut patch.operations[0]
else {
unreachable!()
};
item.recommended_next_organ = "imagination".into();
let bytes = rmp_serde::to_vec_named(&patch)?;
result.repo_model_patch_msgpack = Some(bytes.clone());
review.patch_sha256 = format!("{:x}", Sha256::digest(bytes));
}
_ => unreachable!(),
}
if matches!(mutate, 6 | 7) {
@ -11124,6 +11151,7 @@ pub(crate) mod tests {
assert_eq!(eligibility.candidates.len(), 1);
assert!(!eligibility.candidates[0].eligible);
assert!(eligibility.candidates[0].status_valid);
assert!(eligibility.candidates[0].recommended_next_organ_valid);
assert!(eligibility.candidates[0].source_scope_valid);
assert_eq!(
eligibility.candidates[0].challenged_target_claim_ids,