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
+6
View File
@@ -334,10 +334,16 @@ function recordDetection(id, { nodeId, signal } = {}) {
* never be advanced past.
*/
function clearLane(id) {
// Opt-in: only a lane that has activated a feature has anything to archive.
// Requiring the module here (not at file top) avoids a require cycle —
// lane-features.js itself requires this file for lanesLib.getLane/setStage.
require("./lane-features").archiveActiveFeature(id);
db.prepare(
`UPDATE lanes SET stage = 'idle', stage_since = ?, status = 'idle', gate_decision = NULL,
ci_status = NULL, needs_action = NULL, stages = '{}', notes = NULL, run_id = NULL,
detected_stage = NULL, detected_signal = NULL, detected_at = NULL,
active_feature_id = NULL,
updated_at = ? WHERE id = ?`
).run(nowIso(), nowIso(), id);
return getLane(id);