feat(lanes): clearLane archives the active feature before resetting (B)

This commit is contained in:
2026-08-04 14:23:01 +07:00
parent 181e0f77ff
commit aa01d77ce6
2 changed files with 33 additions and 0 deletions
+27
View File
@@ -86,6 +86,7 @@ describe("pipelines", () => {
});
const lanes = require("../lib/lanes");
const features = require("../lib/lane-features");
describe("lanes lib", () => {
it("creates, lists, updates and deletes a lane", () => {
@@ -586,6 +587,32 @@ describe("stage detection", () => {
assert.equal(lanes.getLane(l.id).detected_stage, "implement");
lanes.deleteLane(l.id);
});
describe("clearLane archives the active feature first", () => {
it("archives the active feature with its final stage before resetting the live row", () => {
const l = lanes.createLane({ title: "t", cwd: "/tmp/wt-archive-active" });
features.activateFeature(l.id, "one");
lanes.setStage(l.id, { stage: "review", evidence: "e" });
lanes.clearLane(l.id);
const archived = features.getFeature(l.id, "one");
assert.notEqual(archived.archived_at, null);
assert.equal(archived.stage, "review");
const cleared = lanes.getLane(l.id);
assert.equal(cleared.stage, "idle");
assert.equal(cleared.active_feature_id, null);
lanes.deleteLane(l.id);
});
it("is unchanged for a lane that never activated a feature (no archive row created)", () => {
const l = lanes.createLane({ title: "t2", cwd: "/tmp/wt-archive-none" });
lanes.setStage(l.id, { stage: "review" });
lanes.clearLane(l.id);
const cleared = lanes.getLane(l.id);
assert.equal(cleared.stage, "idle");
lanes.deleteLane(l.id);
});
});
it("a real stage transition clears a stale detection and unblocks a fresh one behind it", () => {
const l = lanes.createLane({ cwd: "/tmp/wt-detect-stale-cross-task" });