Skip to content

[ADMINAPI-1478] - Endpoints are not returning all instances/data stores#405

Merged
jagudelo-gap merged 12 commits into
mainfrom
ADMINAPI-1478
Jul 24, 2026
Merged

[ADMINAPI-1478] - Endpoints are not returning all instances/data stores#405
jagudelo-gap merged 12 commits into
mainfrom
ADMINAPI-1478

Conversation

@DavidJGapCR

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OdsInstanceId is not present in the returned instances/data stores list.
  • Add unit tests and DB tests to validate behavior across all DbInstanceStatus values.
  • 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)))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

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)))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Test Results

   15 files     15 suites   59s ⏱️
1 820 tests 1 806 ✅ 14 💤 0 ❌
4 286 runs  4 248 ✅ 38 💤 0 ❌

Results for commit a2c3a00.

♻️ This comment has been updated with latest results.

@DavidJGapCR
DavidJGapCR marked this pull request as ready for review July 24, 2026 15:30
@jagudelo-gap
jagudelo-gap merged commit ec23fc0 into main Jul 24, 2026
28 checks passed
@jagudelo-gap
jagudelo-gap deleted the ADMINAPI-1478 branch July 24, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants