fix(plan): update existing milestone specs without stale params
This commit is contained in:
parent
6e40b829f2
commit
427324fb93
2 changed files with 22 additions and 1 deletions
|
|
@ -556,6 +556,7 @@ export function insertMilestoneSpecIfAbsent(milestoneId, planning = {}) {
|
|||
":created_at": new Date().toISOString(),
|
||||
};
|
||||
if (existing) {
|
||||
const { ":created_at": _createdAt, ...updateParams } = params;
|
||||
currentDb
|
||||
.prepare(`UPDATE milestone_specs SET
|
||||
vision = :vision,
|
||||
|
|
@ -572,7 +573,7 @@ export function insertMilestoneSpecIfAbsent(milestoneId, planning = {}) {
|
|||
vision_meeting_json = :vision_meeting_json,
|
||||
product_research_json = :product_research_json
|
||||
WHERE id = :id`)
|
||||
.run(params);
|
||||
.run(updateParams);
|
||||
return;
|
||||
}
|
||||
currentDb
|
||||
|
|
|
|||
|
|
@ -164,6 +164,26 @@ test("specTables_when_shell_milestone_created_before_planning_captures_first_rea
|
|||
);
|
||||
});
|
||||
|
||||
test("specTables_when_empty_milestone_spec_exists_upsert_replaces_without_unused_created_at_parameter", () => {
|
||||
openDatabase(":memory:");
|
||||
|
||||
insertMilestone({
|
||||
id: "M004",
|
||||
title: "Shell first",
|
||||
status: "active",
|
||||
});
|
||||
upsertMilestonePlanning("M004", {
|
||||
vision: "First real planning payload",
|
||||
successCriteria: ["first criterion"],
|
||||
});
|
||||
|
||||
const milestoneSpec = getMilestoneSpec("M004");
|
||||
assert.equal(milestoneSpec.vision, "First real planning payload");
|
||||
assert.deepEqual(JSON.parse(milestoneSpec.success_criteria), [
|
||||
"first criterion",
|
||||
]);
|
||||
});
|
||||
|
||||
test("specTables_when_shell_task_created_before_planning_captures_first_real_plan", () => {
|
||||
openDatabase(":memory:");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue