🛠️ Cleanup
Follow-up to PR #2225 (repo-wide KQL join/lookup review). Two style-only patterns remain across the workbooks. All are benign today because the left-side join keys happen to be unique, but they rely on that implicitly — an upstream mv-expand/union added later would silently start dropping rows.
1. 48 bare | join ( without explicit kind= (baselined in the lint)
src/powershell/Tests/Lint/KqlJoinKinds.Tests.ps1 fails on any new bare join and carries a per-file ratchet baseline for the pre-existing ones:
| File |
Count |
src/workbooks/optimization/AHB/AHB.workbook |
24 |
src/workbooks/optimization/Compute/AHB.workbook |
20 |
src/workbooks/optimization/Networking/Networking.workbook |
3 |
src/workbooks/governance/workbook.json |
1 |
Nearly all are the copy-pasted ResourceContainers | ... | join (resources | ...) on subscriptionId subscription-name pattern → should be join kind=inner. Two need slightly more care: query - Firewall per Location and Get-Idle-PIP (Networking.workbook) sit after an mv-expand, where the implicit innerunique dedup is load-bearing — make the dedup explicit (distinct/summarize before the join) and then use kind=inner.
When fixing a file, lower its baseline count in KqlJoinKinds.Tests.ps1 (the test enforces this). Remove the entry when it reaches 0.
2. ~75 join kind = innerunique(... | distinct <key>) on <key> tag-filter semi-joins
The tag-filter pattern used across the optimization workbooks. Since the right side is distinct and the left key is unique, innerunique behaves identically to inner — but kind=inner states the intent and removes the reliance on left-key uniqueness. Pure find-and-replace within the queries; not tracked by the lint (kind is explicit).
ℹ️ Additional context
- The two AHB workbooks are near-verbatim copies of each other — fixes must land in both.
- Good candidate for an incremental cleanup: the ratchet means partial progress is locked in per file, no big-bang PR needed.
🛠️ Cleanup
Follow-up to PR #2225 (repo-wide KQL join/lookup review). Two style-only patterns remain across the workbooks. All are benign today because the left-side join keys happen to be unique, but they rely on that implicitly — an upstream
mv-expand/unionadded later would silently start dropping rows.1. 48 bare
| join (without explicitkind=(baselined in the lint)src/powershell/Tests/Lint/KqlJoinKinds.Tests.ps1fails on any new bare join and carries a per-file ratchet baseline for the pre-existing ones:src/workbooks/optimization/AHB/AHB.workbooksrc/workbooks/optimization/Compute/AHB.workbooksrc/workbooks/optimization/Networking/Networking.workbooksrc/workbooks/governance/workbook.jsonNearly all are the copy-pasted
ResourceContainers | ... | join (resources | ...) on subscriptionIdsubscription-name pattern → should bejoin kind=inner. Two need slightly more care:query - Firewall per LocationandGet-Idle-PIP(Networking.workbook) sit after anmv-expand, where the implicitinneruniquededup is load-bearing — make the dedup explicit (distinct/summarizebefore the join) and then usekind=inner.When fixing a file, lower its baseline count in
KqlJoinKinds.Tests.ps1(the test enforces this). Remove the entry when it reaches 0.2. ~75
join kind = innerunique(... | distinct <key>) on <key>tag-filter semi-joinsThe tag-filter pattern used across the optimization workbooks. Since the right side is
distinctand the left key is unique,inneruniquebehaves identically toinner— butkind=innerstates the intent and removes the reliance on left-key uniqueness. Pure find-and-replace within the queries; not tracked by the lint (kind is explicit).ℹ️ Additional context