fix: endpoint import on tag-scoped syncs + tag merge name collision (2.4.4)#45
Merged
Merged
Conversation
…2.4.4) SNMP-endpoint import (sync_endpoints) never worked on tag-scoped syncs. Two independent defects: the endpoint query branch required endpoints to carry the device include tags (endpoints rarely share device scoping tags, so Forward filtered them all), and the local scope filter's device set was built from network.devices only, so every endpoint row was dropped — with prune-out-of-scope enabled they would even be emitted as deletes. The endpoint branch now applies exclude tags only, and with sync_endpoints on a dedicated endpoint probe (exclude tags honored) unions endpoint names into scoped_device_names so the local filter and prune keep them. A probe failure disables endpoint emission for the run (and skips the context-artifact save) instead of risking deletes. The context memo key and shared context artifact (v3) include the toggle so an endpoint-less scope is never reused. Also fixes the merge-phase "Tag with this Name already exists" issues: device updates (ordered before creates) set tags by name, creating the tag on main with a new pk; the branch's tag create then collided on the unique name. bulk_merge now treats a same-named/same-slug main-side tag as already merged; differing non-unique attrs converge on the next sync. Validated live reproducing the reported scenario (include tags endpoints don't carry + endpoint import on): 355 Avocent/console endpoints import under a tag-scoped sync. Full suite (994) + lint + harness green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A design partner on 2.4.2/2.4.3 with a device-tag include scope still saw zero SNMP endpoints (Avocents), plus 5 merge-phase
Tag with this Name already existsingestion issues. Multi-agent trace found two independent scope defects that made endpoint import impossible on any tag-scoped sync (publish/refresh could never fix it):scoped_device_nameswas built fromnetwork.devicesonly, so_apply_device_tag_scopedropped every endpoint row unconditionally — and with prune-out-of-scope on, dropped rows become deletes.Changes
forward_devices.nqe,forward_devices_with_netbox_aliases.nqe): exclude tags only — include scope narrows modeled devices, not endpoints._resolve_scoped_tag_scope+ new_resolve_scoped_endpoint_names: withsync_endpointson, endpoint names (exclude-honoring probe) union into the scoped set so the local filter and prune keep them. Probe failure disables endpoint emission for the run (never proceeds with an endpoint-less scope → no risk of pruning imported endpoints) and skips the context-artifact save; memo key + artifact (v3) include the toggle.bulk_merge._flush: same-named/same-slug main-sideextras.tagtreated as already merged (skip counted as applied) — kills the mid-merge name-collision ValidationErrors. Differing non-unique attrs converge next sync.Validation
sync_endpointson): both device queries emit 355 Avocent/console endpoints; scope union adds 688 endpoint names; local filter keeps endpoint rows, drops out-of-scope devices.