Repository navigation
fix: publish 24-hex product subscriptions like legacy APIOps - #310
Alexander Zaslonov (azaslonov) merged 2 commits into
Conversation
Publish previously skipped every product-scoped subscription with a 24-character hex name, so environment overrides (e.g. primaryKey / secondaryKey) for those subscriptions could never be applied. Match legacy APIOps instead: when publish creates a new product, delete the subscriptions APIM auto-created for it, then publish the extracted product subscriptions normally with overrides applied.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 4
Open (5)
The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… · New The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… · New The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… · New This cleanup enumerates all subscriptions in the service/workspace and filters client-side. In… · New The implementation treats deletion as best-effort (logs a warning and continues on failure).… · New
What changed in this PR
Aligns subscription publishing behavior with legacy APIOps by publishing previously-skipped 24-hex product subscriptions and cleaning up APIM auto-created product subscriptions when a product is newly created, enabling environment key overrides to apply.
Changes:
- Remove eligibility skip for 24-hex product-scoped subscriptions so they publish normally and accept overrides.
- Add cleanup step to delete APIM auto-created subscriptions for newly created products (service or workspace scope).
- Update docs and unit tests to cover publishing + overrides, cleanup behavior, workspace scope, and delete-failure tolerance.
| File | Description |
|---|---|
| tests/unit/services/resource-publisher.test.ts | Updates tests to confirm 24-hex product subscriptions publish and overrides flow into PUT payload. |
| tests/unit/services/product-publisher.test.ts | Adds tests ensuring auto-created product subscriptions are deleted only for newly created products (including workspace scope) and failures don’t break publish. |
| src/services/resource-publisher.ts | Removes auto-generated product subscription eligibility skip logic. |
| src/services/product-publisher.ts | Introduces cleanupProductSubscriptions invoked for newly created products to delete auto-created subscriptions. |
| docs/guides/environment-overrides.md | Updates guidance to reflect new behavior and key override support for 24-hex product subscriptions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Compare the decoded /products/{name} scope segment so auto-created
subscriptions are found for product names that are URL-encoded in scopes.
- Note in the overrides guide that subscription cleanup is best-effort.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 7
Open (9)
This lists all subscriptions in the service/workspace and filters client-side. In large APIM… · New Cleanup currently deletes any subscription whosescopeends with the product name. If another… · New This test is intended to validate that cleanup failures don’t fail the publish, but it doesn’t… · New This cleanup enumerates all subscriptions in the service/workspace and filters client-side. In… The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… The scope comparison uses the rawproductNamebut APIM resource IDs/scopes are URL paths where… LoggingString(error)often drops useful diagnostics (stack trace, structured fields). If the… · New The implementation treats deletion as best-effort (logs a warning and continues on failure).…


Summary
Publish skipped every product-scoped subscription with a 24-character hex name ("auto-generated product subscription"). Because of that, environment overrides such as
primaryKey/secondaryKeycould never be applied to these subscriptions. Legacy APIOps supports this, and existing customers depend on it.This PR switches to the legacy APIOps behavior (
PutProductInApiminAzure/apiopssrc/common/Product.cs):subscriptionsLimitfrom being exceeded once the extracted subscriptions are published.subscriptions:overrides are applied. The built-inmasterand other service-scoped subscriptions are still skipped.Changes
src/services/product-publisher.ts: newcleanupProductSubscriptions. It lists subscriptions in the product's service or workspace scope and deletes the ones scoped to/products/<deployed product name>. It runs only when the product was newly created; a failed delete logs a warning and does not fail the publish.src/services/resource-publisher.ts: removed theisAutoGeneratedProductSubscriptioneligibility check.docs/guides/environment-overrides.md: updated the subscriptions note.Behavior notes
Validation
npm test: 60 files, 1514 tests passednpm run lint: cleanCode review
Changes touch
src/andtests/, so a CodeReviewer pass per.squad/ceremonies.mdis requested.