Skip regen when diff shows no subtree change #36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: slice
Depends on: #32, #34
Estimate: M (1–2 days)
Slice — layers touched
Node-RED lifecycle (diff inspection) → dashboardAPI domain (subtree-affected predicate) → observability (no-diff log).
Context
Implements PRD F-1 fully. Resolves O-1 via spike #32.
Scope
payload.diffper spike findings (added/changed/removed node ids vs. dashboardAPI's own id + allregisteredChildrenids).outcome: "no-diff"and skip the HTTP call.Out of scope
Acceptance criteria
outcome: "no-diff"and makes no HTTP call (verified by interceptinghttps.request).outcome: "no-diff"appears in the N-4 structured log with the expected fields.Slice #36 shipped on branch
slice/36-diff-skip-regen(offslice/35)Branches:
dashboardAPI·EVOLVWhat landed
_attachLifecycleHooksubscribes toRED.events.on('flows:started')and cachespayload.diffonsource.lastFlowsStartedDiff.subtreeChanged(diff, subtreeIds)predicate from S1 (#32) — null diff = regen, empty arrays = skip, id present in added/changed/removed/rewired = regen.subtreeIdsFor(myId, childSource)builds the set: dashboardAPI id + child id + grandchild ids (via existingextractChildren).registerChildhandler consults the predicate before composing; logsoutcome: "no-diff"on skip.Edge case carried forward from S1
Brand-new child wired to an existing registered parent: child id appears in
diff.addedbut isn't yet inregisteredChildrenwhenflows:startedfires (race). Per the spike's mitigation (b), accepting a one-deploy race for R&D — next deploy picks it up. If this manifests as visible lag during commissioning, revisit and pre-compute grandchild ids from previous-deploy snapshot.Acceptance criteria (status)
outcome: "no-diff"and emits no upsert message. Verified by predicate unit test (only unrelated ids → no regen).event,outcome,trigger,dashboardApiId,childId,subtreeSize).Closes #36.