[ADMINAPI-1478] - Endpoints are not returning all instances/data stores#405
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates tenant and education-organization endpoints to include DbInstances/DbDataStores that are linked via OdsInstanceId but whose corresponding ODS instance / data store is missing from the primary query results (i.e., “orphaned linked” records), so API responses return all available instances/data stores.
Changes:
- Extend “unlinked” merging logic to also append DbInstance records whose
OdsInstanceIdis not present in the returned instances/data stores list. - Add unit tests and DB tests to validate behavior across all
DbInstanceStatusvalues. - Apply the same behavior in both the v2 and v3 code paths.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Application/EdFi.Ods.AdminApi/Infrastructure/Services/Tenants/TenantService.cs | Appends orphaned-linked DbInstances (not just OdsInstanceId == null) when building tenant details. |
| Application/EdFi.Ods.AdminApi/Features/OdsInstances/ReadEducationOrganizations.cs | Appends orphaned-linked DbInstances into the “include unlinked” response composition. |
| Application/EdFi.Ods.AdminApi.V3/Infrastructure/Services/Tenants/TenantService.cs | Appends orphaned-linked DbInstances as “data stores” when building tenant details in v3. |
| Application/EdFi.Ods.AdminApi.V3/Features/DataStores/ReadEducationOrganizations.cs | Appends orphaned-linked DbInstances into v3 data store education-organization composition. |
| Application/EdFi.Ods.AdminApi.V3.UnitTests/Infrastructure/Services/Tenants/TenantServiceTests.cs | Adds coverage to ensure orphaned-linked data stores are returned for all statuses. |
| Application/EdFi.Ods.AdminApi.V3.UnitTests/Features/DataStores/ReadEducationOrganizationsTests.cs | Adds coverage to ensure orphaned-linked data stores are appended for all statuses. |
| Application/EdFi.Ods.AdminApi.V3.DBTests/Database/QueryTests/GetDbDataStoresQueryTests.cs | Adds DB-level coverage to ensure all statuses are returned when no filters are applied. |
| Application/EdFi.Ods.AdminApi.UnitTests/Infrastructure/Services/Tenants/TenantServiceTests.cs | Adds coverage to ensure orphaned-linked ODS instances are returned for all statuses. |
| Application/EdFi.Ods.AdminApi.UnitTests/Features/OdsInstances/ReadEducationOrganizationsTests.cs | Adds coverage to ensure orphaned-linked ODS instances are appended for all statuses. |
| Application/EdFi.Ods.AdminApi.DBTests/Database/QueryTests/GetDbInstancesQueryTests.cs | Adds DB-level coverage to ensure all statuses are returned when no filters are applied. |
Comment on lines
+98
to
+103
| var existingOdsInstanceIds = instances | ||
| .Select(i => i.Id) | ||
| .ToHashSet(); | ||
|
|
||
| var negativeId = -1; | ||
| foreach (var dbInstance in allDbInstances.Where(d => d.OdsInstanceId is null)) | ||
| foreach (var dbInstance in allDbInstances.Where(d => d.OdsInstanceId is null || !existingOdsInstanceIds.Contains(d.OdsInstanceId.Value))) |
Comment on lines
+97
to
+102
| var existingDataStoreIds = instances | ||
| .Select(i => i.Id) | ||
| .ToHashSet(); | ||
|
|
||
| var negativeId = -1; | ||
| foreach (var dbDataStore in allDbDataStores.Where(d => d.OdsInstanceId is null)) | ||
| foreach (var dbDataStore in allDbDataStores.Where(d => d.OdsInstanceId is null || !existingDataStoreIds.Contains(d.OdsInstanceId.Value))) |
Contributor
Test Results 15 files 15 suites 59s ⏱️ Results for commit a2c3a00. ♻️ This comment has been updated with latest results. |
DavidJGapCR
marked this pull request as ready for review
July 24, 2026 15:30
jagudelo-gap
approved these changes
Jul 24, 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.
No description provided.