[Hubs] Split the Recommendations app#2052
[Hubs] Split the Recommendations app#2052flanakin wants to merge 7 commits intofeatures/hubs-recsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Splits the FinOps hubs Recommendations functionality into smaller Bicep modules (IngestionQueries orchestrator + AzureResourceGraph engine + slimmed Recommendations) and introduces a build-time generator script plus Pester coverage to keep query-file wiring maintainable.
Changes:
- Updates
hub.bicepto wire newIngestionQueriesandAzureResourceGraphmodules and refactors inter-module dependencies/outputs. - Refactors
Recommendations/app.bicepto focus on uploading query/schema assets, with query file entries generated at build time. - Adds
Build-HubIngestionQueries.ps1plus unit/integration tests, and extendsBuild-Toolkit.ps1+ template.build.configto run custom build scripts.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/templates/finops-hub/modules/hub.bicep | Wires new sub-modules and updates outputs/params for the split Recommendations design. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Recommendations/app.bicep | Slims Recommendations to storage uploads and introduces generated query-file section markers. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/metadata.bicep | Adds exported metadata type for the new IngestionQueries app. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/app.bicep | New orchestrator app: schedule trigger + pipelines to dispatch query execution and manage ingestion/manifests. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/README.md | Documents the new orchestration model and engine contract. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/metadata.bicep | Adds exported metadata type for the ARG engine app. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/app.bicep | New engine app: ARG dataset and queries_ResourceGraph_ExecuteQuery pipeline implementation. |
| src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/README.md | Documents the ARG engine behavior, dependencies, and limitations. |
| src/templates/finops-hub/.build.config | Registers a template-specific custom build script to generate query-file wiring. |
| src/scripts/Test-PowerShell.ps1 | Broadens Hubs test selection to include new Hubs*.Tests.ps1 files. |
| src/scripts/Build-Toolkit.ps1 | Adds support for running per-template custom build scripts after copying to release output. |
| src/scripts/Build-HubIngestionQueries.ps1 | New generator: builds Bicep loadTextContent() map(s) from query JSON files. |
| src/powershell/Tests/Unit/HubsIngestionQueries.Tests.ps1 | New unit tests validating query/schema JSON and compiling finops-hub Bicep (when CLI is present). |
| src/powershell/Tests/Integration/HubsIngestionQueries.Tests.ps1 | New integration tests validating ARG queries execute and match expected result schema/perf. |
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Recommendations/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/app.bicep
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/app.bicep
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/README.md
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/README.md
Show resolved
Hide resolved
… path, fix conditional output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Handle empty ARG query results gracefully instead of failing the pipeline. Fix error propagation in ingestion query execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add mapComplexValuesToString to ADF schema so JSON string columns
are preserved in parquet (was silently dropping x_RecommendationDetails)
- Wrap AdvisorCost bag_merge in tostring() for parquet compatibility
- Fix parse_resourceid() to handle bare /subscriptions/{id} resource IDs
- Add mv-apply key renaming in transform to normalize x_RecommendationDetails
keys to x_PascalCase (Advisor extendedProperties use camelCase)
- Derive ResourceType display name from ResourceId via resource_type() lookup
- Fix description fallback to use x_RecommendationSolution then
x_RecommendationSubCategory instead of nonexistent x_RecommendationMessage
- Use SubAccountName for ResourceName on subscription-level recommendations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RolandKrummenacher
left a comment
There was a problem hiding this comment.
Code review -- 4 inline comments. Overall the architecture is solid; these are mostly guardrails for future maintainability.
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/README.md
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Recommendations/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/README.md
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/README.md
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Recommendations/app.bicep
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/AzureResourceGraph/README.md
Outdated
Show resolved
Hide resolved
- Add safety comment on non-null assertion in hub.bicep - Add trusted-source comment on query text in ARG app.bicep - Fix dataset name in ARG README (resourceGraph -> azureResourceGraph) - Add error handling for custom build scripts in Build-Toolkit.ps1 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: RolandKrummenacher <RolandKrummenacher@users.noreply.github.com> Co-Authored-By: copilot-pull-request-reviewer <copilot-pull-request-reviewer@users.noreply.github.com> Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 [AI][Claude] PR Update Summary (Round 2) Addressed: 11 thread(s)
Key changes: safety comment on |
- Use ingestionQueries.queries.container instead of core.containers.config for consistency 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: copilot-pull-request-reviewer <copilot-pull-request-reviewer@users.noreply.github.com> Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 [AI][Claude] PR Update Summary (Round 3) Addressed: 3 thread(s)
Changed |
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/IngestionQueries/app.bicep
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Recommendations/app.bicep
Show resolved
Hide resolved
src/powershell/Tests/Integration/HubsIngestionQueries.Tests.ps1
Outdated
Show resolved
Hide resolved
src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql
Show resolved
Hide resolved
- Reset $LASTEXITCODE before custom build script invocation to prevent stale values - Throw on missing build scripts instead of warning - Guard mv-apply for null/empty x_RecommendationDetails bags - Clarify integration test comment about x_Source* column origin 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Copilot <copilot@users.noreply.github.com> Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 [AI][Claude] PR Update Summary Addressed: 7 thread(s)
Changes:
|
🛠️ Description
Split the monolithic Recommendations app.bicep into three focused modules to improve maintainability and separation of concerns:
Also added a new
Build-HubIngestionQueries.ps1build script with corresponding unit and integration tests, and updated the hub module to wire up the new sub-modules.📋 Checklist
🔬 How did you test this change?
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md?📖 Did you update documentation?