Repository navigation
fix(azure): repair malformed ARM ids so catalog lists are not collapsed - #18
Merged
Merged
Conversation
Azure returns some list results with empty id segments. Firewall FQDN tags and ExpressRoute service providers answer with "/subscriptions//resourceGroups//providers/Microsoft.Network/<type>/" for every item, so all 24 tags and all 211 providers shared one NativeID. Each scan wrote them as successive versions of one resource: a fresh database reported 233 changed rows and kept only the last item current. azTrackedRows now passes every id through repairARMID, which rebuilds "/subscriptions/<sub>/providers/<ns>/<type>/<name>" when the id has an empty segment. Well-formed ids are unchanged. BGP service communities had the same empty scope segments but kept their names; their ids are now canonical too, so an existing database sees those 348 rows replaced once. Verified live on two subscriptions: two scans into a fresh --db report 0 changed, no duplicate natural keys, and no id with an empty segment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Azure returns some list results with empty id segments. Firewall FQDN tags and ExpressRoute service providers return
/subscriptions//resourceGroups//providers/Microsoft.Network/<type>/for every item (confirmed withaz rest). Every item in each list shared one NativeID. Each scan wrote the items as successive versions of one resource, so only the last item stayed current. A fresh database reported233 changed(23 + 210).Fix
azTrackedRowsnow passes every id throughrepairARMID. When an id has an empty segment, the helper rebuilds it as/subscriptions/<sub>/providers/<ns>/<type>/<name>, using the item's name. Well-formed ids are unchanged.BGP service communities had the same empty scope segments but kept their names, so they were unique. Their ids are now canonical too. An existing database sees those 348 rows replaced once.
Test plan
TestRepairARMIDcovers well-formed ids, a missing name, empty scope segments, and the cases with nothing to rebuild from.TestAzTrackedRows_MalformedIDsStayDistinctuses the live FQDN tag shape.go test ./internal/providers/azure/passes.golangci-lintreports 0 issues.--dbreport0 changed. There are no duplicate natural keys and no id with an empty segment.🤖 Generated with Claude Code