feat(FN-1787): merge fusion/fn-1787

This commit is contained in:
gsxdsm
2026-04-15 00:46:08 -07:00
parent 336c9c4fdf
commit 889fd169e1
4 changed files with 96 additions and 0 deletions

View File

@@ -1044,6 +1044,8 @@ describe("MissionStore", () => {
expect(linked.taskId).toBe("FN-001");
expect(linked.status).toBe("triaged");
expect(linked.loopState).toBe("implementing");
expect(linked.implementationAttemptCount).toBe(1);
expect(taskRow.missionId).toBe(mission.id);
expect(taskRow.sliceId).toBe(slice.id);
});
@@ -1542,6 +1544,8 @@ describe("MissionStore", () => {
// Feature should be triaged with a taskId
expect(triaged.status).toBe("triaged");
expect(triaged.taskId).toBeTruthy();
expect(triaged.loopState).toBe("implementing");
expect(triaged.implementationAttemptCount).toBe(1);
// Task should exist with correct properties
const task = await ts.getTask(triaged.taskId!);

View File

@@ -1667,10 +1667,17 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
const linkage = this.resolveTaskLinkage(feature.sliceId);
// When first linking (loopState is idle or falsy), transition to implementing
const shouldTransitionLoop = !feature.loopState || feature.loopState === "idle";
const loopStateUpdates: Partial<MissionFeature> = shouldTransitionLoop
? { loopState: "implementing", implementationAttemptCount: 1 }
: {};
const updated = this.db.transaction(() => {
const featureUpdate = this.updateFeature(featureId, {
taskId,
status: "triaged",
...loopStateUpdates,
});
// Also update the task's mission/slice linkage for bidirectional linking.