fix(lanes): stop archive/activate from clobbering feature title and links
archiveActiveFeature was overwriting a feature's own title with the LIVE lane's title on every clear/switch — a --title set on activation silently disappeared. activateFeature restored stage/status/gate/CI/ stages/notes onto the live lane when switching back to a past feature, but never links, so they vanished on reactivation. Both are fixed, with a regression test for each (full activate/archive/reactivate round trip for links). Also fixes server/routes/lanes.js: the doc comment explaining GET /:id/git's rationale had been left sitting above the newly-inserted /:id/features routes instead of its own route. docs/API.md's Lane features section described fields and behavior that don't exist in the real routes (an "active" boolean, a POST response containing "archivedPrevious", a "409 ESTALE" concurrency response) — rewritten to match the actual request/response shapes exactly.
This commit is contained in:
@@ -112,6 +112,26 @@ describe("activateFeature / archiveActiveFeature", () => {
|
||||
const { feature } = features.activateFeature(lane.id, "feat/Weird Input/");
|
||||
assert.equal(feature.slug, "Weird-Input");
|
||||
});
|
||||
|
||||
it("a feature's own title survives being archived (never clobbered by the lane's title)", () => {
|
||||
const lane = makeLane();
|
||||
features.activateFeature(lane.id, "one", { title: "Custom title" });
|
||||
features.activateFeature(lane.id, "two"); // archives "one"
|
||||
assert.equal(features.getFeature(lane.id, "one").title, "Custom title");
|
||||
});
|
||||
|
||||
it("links survive a full activate -> archive -> reactivate round trip", () => {
|
||||
const lane = makeLane();
|
||||
features.activateFeature(lane.id, "one");
|
||||
lanesLib.updateLane(lane.id, { links: { pr: "https://example.com/pr/1" } });
|
||||
features.activateFeature(lane.id, "two"); // archives "one" with its links
|
||||
|
||||
const archived = features.getFeature(lane.id, "one");
|
||||
assert.deepEqual(archived.links, { pr: "https://example.com/pr/1" });
|
||||
|
||||
const { lane: reactivated } = features.activateFeature(lane.id, "one");
|
||||
assert.deepEqual(reactivated.links, { pr: "https://example.com/pr/1" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("listFeatures / getFeature", () => {
|
||||
|
||||
Reference in New Issue
Block a user