FN-5902: make mission validation AI-run all criteria

Route every mission feature through validator-backed completion checks.

- lazily restore a managed feature assertion before validation instead of auto-passing zero-assertion features
- thread milestone acceptance criteria into validator prompts and system instructions as enforced requirements
- update MissionManager copy/tests to present criteria as AI-validated runtime gates and remove informational-only/zero-assertion warnings
- document the all-criteria AI-run contract and add a changeset for @runfusion/fusion

Files changed:
 .changeset/fn-5902-mission-validation-ai-run.md    |   5 +
 AGENTS.md                                          |   2 +-
 docs/architecture.md                               |   2 +-
 docs/missions-completion-contract.md               | 198 ++++++---------------
 docs/missions.md                                   |   5 +-
 packages/core/src/__tests__/mission-store.test.ts  |  23 ++-
 packages/core/src/mission-store.ts                 |  10 ++
 packages/dashboard/app/components/MissionManager.css    |  31 ----
 packages/dashboard/app/components/MissionManager.tsx    |  86 +++------
 packages/dashboard/app/components/__tests__/MissionManager.test.tsx   |  60 +++++--
 packages/engine/src/__tests__/mission-execution-loop.test.ts   | 111 +++++++++---
 packages/engine/src/__tests__/reliability-interactions/mission-validation-trigger-gap.test.ts         |  57 +++---
 packages/engine/src/mission-execution-loop.ts      |  78 ++++----
 13 files changed, 318 insertions(+), 350 deletions(-)

Fusion-Task-Id: FN-5902

Fusion-Task-Lineage: 5f25caad-33c9-42ff-822b-1ea092afc29f
This commit is contained in:
gsxdsm
2026-06-02 18:11:26 -07:00
parent abbeaec0a8
commit cc18206bc5
13 changed files with 318 additions and 350 deletions

View File

@@ -3338,14 +3338,33 @@ describe("MissionStore", () => {
expect(linked[0].sourceFeatureId).toBe(feature.id);
});
it("lazily re-links exactly one managed assertion for legacy acceptance-criteria features", () => {
const mission = store.createMission({ title: "M" });
const milestone = store.addMilestone(mission.id, { title: "MS" });
const slice = store.addSlice(milestone.id, { title: "SL" });
const feature = store.addFeature(slice.id, { title: "Feature", acceptanceCriteria: "AC text" });
const [managed] = store.listAssertionsForFeature(feature.id);
store.unlinkFeatureFromAssertion(feature.id, managed.id);
store.deleteContractAssertion(managed.id);
const first = store.ensureFeatureAssertionLinked(feature.id);
const second = store.ensureFeatureAssertionLinked(feature.id);
expect(first).toHaveLength(1);
expect(first[0].assertion).toBe("AC text");
expect(second).toHaveLength(1);
expect(second[0].id).toBe(first[0].id);
expect(store.listAssertionsForFeature(feature.id)).toHaveLength(1);
});
it("derives managed assertion text from description or fallback", () => {
const mission = store.createMission({ title: "M" });
const milestone = store.addMilestone(mission.id, { title: "MS" });
const slice = store.addSlice(milestone.id, { title: "SL" });
const fromDescription = store.addFeature(slice.id, { title: "Desc Feature", description: "Desc text" });
const fallback = store.addFeature(slice.id, { title: "Fallback Feature" });
expect(store.listAssertionsForFeature(fromDescription.id)[0].assertion).toBe("Desc text");
expect(store.listAssertionsForFeature(fallback.id)[0].assertion).toBe("Verify implementation of: Fallback Feature");
expect(store.ensureFeatureAssertionLinked(fromDescription.id)[0].assertion).toBe("Desc text");
expect(store.ensureFeatureAssertionLinked(fallback.id)[0].assertion).toBe("Verify implementation of: Fallback Feature");
});
it("syncs managed assertion in place on acceptanceCriteria update", () => {

View File

@@ -2197,6 +2197,16 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
}
}
ensureFeatureAssertionLinked(featureId: string): MissionContractAssertion[] {
const feature = this.getFeature(featureId);
if (!feature) {
throw new Error(`Feature ${featureId} not found`);
}
this.ensureFeatureAssertion(feature);
return this.listAssertionsForFeature(featureId);
}
/**
* Idempotently seed authored contract assertions for specific features.
*