Cherry-Pick: Fix: child-config autoentities fails validation with "No entities f… - #3841
Merged
RubenCerna2079 merged 3 commits intoSep 30, 2026
Merged
Conversation
…ound" when using `data-source-files` (#3723) ## Why make this change? - Closes #3655 - When a child config (referenced via `data-source-files`) uses `autoentities` instead of explicit `entities`, validation incorrectly fails with `"No entities found"`. The same `autoentities` block works correctly in the top-level config. This contradicts documented behavior that states every config may satisfy the entities requirement via `autoentities`. ## What is this change? - **Root cause**: `MsSqlMetadataProvider.GenerateAutoentitiesIntoEntities` stores autoentity resolution counts only on the root (merged) `RuntimeConfig.AutoentityResolutionCounts`. But `ValidateEntityPresence` checks the *child* config's own `AutoentityResolutionCounts`, which is never populated — so the resolved entity count is always 0 for child configs. - **Fix** (`RuntimeConfigValidator.ValidateRootConfig`): Before validating each child config, copy any missing resolution counts from the root config into the child config. This is a no-op when child counts are already populated (e.g. in unit tests that pre-populate them directly). ```csharp foreach (KeyValuePair<string, Autoentity> ae in childConfig.Autoentities) { if (!childConfig.AutoentityResolutionCounts.ContainsKey(ae.Key) && runtimeConfig.AutoentityResolutionCounts.TryGetValue(ae.Key, out int count)) { childConfig.AutoentityResolutionCounts[ae.Key] = count; } } ``` ## How was this tested? - [ ] Integration Tests - [x] Unit Tests - `TestChildWithDataSourceAndAutoentitiesResolvingEntitiesIsValid`: child config with only `autoentities` resolving >0 entities (counts stored on root only) passes validation — direct regression test for the bug. - `TestRootAndChildBothWithAutoentitiesResolvingEntitiesIsValid`: both root and child have `autoentities`, all counts on root, both pass validation. ## Sample Request(s) ```json // dab-config.child.json — previously caused "No entities found" during `dab validate` { "data-source": { "database-type": "mssql", "connection-string": "@env('CONN_B')" }, "autoentities": { "def-b": { "patterns": { "name": "b_{object}", "include": [ "dbo.TableTwo" ] }, "permissions": [ { "role": "anonymous", "actions": [ { "action": "read" } ] } ] } } } ``` ```bash dab validate -c dab-config.json # now passes when child uses autoentities ``` --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com> Co-authored-by: Ruben Cerna <rcernaserna@microsoft.com> Co-authored-by: Anusha Kolan <anushakolan10@gmail.com> Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>
autoentities fails validation with "No entities f…autoentities fails validation with "No entities f…
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The regression test’s root pattern resolves a real table, contradicting and failing to cover its documented zero-resolution scenario.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Fixes child-config autoentities validation by propagating MSSQL resolution counts to the originating child configuration.
Changes:
- Associates metadata providers with child configurations.
- Records autoentity resolution counts on root and child configs.
- Adds an MSSQL regression test and updates constructor usage.
| File | Description |
|---|---|
src/Config/ObjectModel/RuntimeConfig.cs |
Adjusts child loading and merged collections. |
src/Core/Services/MetadataProviders/MetadataProviderFactory.cs |
Maps child configs to metadata providers. |
src/Core/Services/MetadataProviders/MsSqlMetadataProvider.cs |
Stores child autoentity resolution counts. |
src/Service.Tests/Caching/DabCacheServiceIntegrationTests.cs |
Updates constructor invocation. |
src/Service.Tests/Configuration/ConfigurationTests.cs |
Adds the regression integration test. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Aniruddh Munde (Aniruddh25)
approved these changes
Sep 30, 2026
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.


Why make this change?
What is this change?
Cherry-picked PR:
autoentitiesfails validation with "No entities found" when usingdata-source-files#3723How was this tested?
This is a cherry-pick it was already tested when it was first merged.
Sample Request(s)
N/A