fix: reconcile gateway APIs and skip missing association targets - #268
Merged
Alexander Zaslonov (azaslonov) merged 4 commits intoSep 4, 2026
Conversation
The built-in 'managed' gateway is not returned by GET /gateways, so its per-API assignments were never extracted, published, or reconciled. This left dev/prod divergence (e.g. an API removed from managed in dev remained assigned in prod). - extract: query gateways/managed/apis and write gateways/managed/apis.json (only when non-empty) - publish: skip PUT of the built-in managed Gateway resource (its GatewayApi associations still publish) - delete-unmatched: reconcile GatewayApi assignments (incl. managed), scoped to gateways that own a local assignment, so untracked gateways are never touched - add MANAGED_GATEWAY_NAME constant; tests for extract/publish/delete-unmatched
computeGatewayApiDeleteActions compared deployed [gateway,api] descriptors against localSet, which only holds aggregate GatewayApi [gateway] keys (api names live in apis.json content, not the path). Every deployed assignment therefore missed the set and was deleted regardless of desired state - e.g. an API present in the gateway's apis.json was both PUT and DELETEd. Read the desired API set per gateway via store.readAssociation and delete only deployed assignments absent from it. Update tests to use aggregate local descriptors + readAssociation.
Copilot started reviewing on behalf of
Alexander Zaslonov (azaslonov)
September 4, 2026 21:30
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Empty managed-gateway state, filtering, and environment-mapped gateways are not reconciled correctly.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds managed-gateway assignment support and resilient association publishing, including stale-link reconciliation.
Changes:
- Extracts and publishes managed gateway API assignments.
- Skips missing API/group targets without aborting remaining links.
- Reconciles stale tracked gateway assignments during
--delete-unmatched.
File summaries
| File | Description |
|---|---|
src/models/resource-types.ts |
Defines the managed gateway identifier. |
src/services/extract-service.ts |
Extracts managed gateway API assignments. |
src/services/resource-publisher.ts |
Skips managed gateway PUTs and missing targets. |
src/services/delete-unmatched-service.ts |
Reconciles stale gateway assignments. |
tests/unit/services/extract-service.test.ts |
Tests managed assignment extraction. |
tests/unit/services/resource-publisher.test.ts |
Tests managed skipping and missing targets. |
tests/unit/services/delete-unmatched-service.test.ts |
Tests gateway assignment reconciliation. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot started reviewing on behalf of
Alexander Zaslonov (azaslonov)
September 4, 2026 22:21
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation addresses the linked issues with focused coverage, and the previously identified mapping, filtering, and empty-state problems are resolved.
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Tuan Nguyen (atuannguyen1101)
approved these changes
Sep 4, 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.
Summary
managedgateway without attempting to PUT the managed gateway resource itself--delete-unmatchedfrom each tracked gateway'sapis.json, leaving untracked gateways untouchedValidation
npm run lintnpm run buildnpm test(60 files, 1,365 tests)git range-diff: all three patches match fix: skip missing API/group links in gateway/product associations instead of aborting #267's intended commit seriesRelated issues
Closes #264
Closes #266
Replaces #267, whose branch included unrelated inherited history. #267 can now be closed.