`publish --delete-unmatched` (full publish) does not remove child resources, and does not protect the built-in `master` subscription
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- azure, github-actions, javascript, node.js, typescript
调研方向
Start in services/delete-unmatched-service.js at computeDeleteActions, which lists deployed resources per type with listResources and silently swallows errors for child types that need a parent. Check isSystemResource for where the built-in master subscription (scope /) should be excluded. Done when child resources missing from the artifact folder yield DELETE actions in a dry-run, and master is never listed as DELETE, with tests covering both cases.
由索引模型根据 Issue 内容生成。
描述
Summary
With apiops-cli 1.0.5, a full apiops publish --delete-unmatched (no --commit-id) only reconciles top-level resources (and managed-gateway API assignments). Child resources that exist in APIM but not in the artifact folder are never deleted. Separately, the built-in master subscription is not treated as a system resource, so it is deleted when its file is absent.
1. Child resources are not reconciled
Steps to reproduce
- Publish an artifact folder that contains an API with an API-level policy (
apis/<api>/policy.xml) and a product with an API link (products/<p>/apis.json). - Remove
apis/<api>/policy.xmland the API fromproducts/<p>/apis.json. - Run
apiops publish --delete-unmatched --dry-run, then without--dry-run.
Expected
The API policy and the product–API link are listed as DELETE and removed, so APIM matches the artifact folder (as with top-level resources).
Actual
No DELETE actions are produced for them; both remain in APIM.
Analysis
computeDeleteActions (services/delete-unmatched-service.js) lists deployed resources per resource type via listResources. For child types (ApiPolicy, ApiOperationPolicy, ProductPolicy, ApiDiagnostic, ApiSchema, ProductApi, ProductGroup, ApiTagDescription, …) the list path needs a parent, so the call throws and the error is swallowed; those types are silently skipped. Incremental mode (--commit-id) does delete children whose files were removed in that commit, but full publish – the mode needed to redeploy an older revision (rollback) – does not.
Impact
- Removing a policy/diagnostic/link from Git has no effect in APIM.
- Redeploying an older revision leaves child resources that were added later.
- The dry-run gives no indication of this.
Suggestion
For each deployed parent (API, product, operation, …), enumerate its children and compare them with the artifact folder; at minimum, warn in the dry-run/publish output that child resources are not reconciled.
2. master subscription is not protected
isSystemResource covers the built-in products/APIs (starter, unlimited, echo-api, …) and built-in groups, but not the built-in master subscription (scope /). Publish already skips root-scoped subscriptions, but with --delete-unmatched the master subscription is listed as DELETE when subscriptions/master is not present in the artifact folder. Expected: treat it as a system resource, like the other built-ins.
Environment
@azure-tools/apiops-cli1.0.5, Node.js 22, GitHub Actions (ubuntu-latest) and Windows.
Possibly related: #142, #169.
- 主要语言
- TypeScript
- 星标
- 44
- 派生
- 14
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/apiops-cli 的其他 Issue
-
type:bug
难度 2/5 1-3 小时 新手友好度 71/100
Azure/apiops-cli#350 ·
-
stale
难度 1/5 1-3 小时 新手友好度 84/100
Azure/apiops-cli#333 · 1 条评论 ·
-
extract fails when a policy uses set-backend-service backend-id="{{namedValue}}"可能已有人在做 @dannyward630 于 37 天前认领。 未关闭stale type:bug
难度 2/5 1-3 小时 新手友好度 78/100
Azure/apiops-cli#331 · 1 条评论 ·
-
Docs example says products are auto-included transitively, but they aren't extracted with `products: []`可能已有人在做 @cdayne 于 27 天前认领。 未关闭stale type:question
难度 2/5 1-3 小时 新手友好度 76/100
Azure/apiops-cli#277 · 1 条评论 ·
-
Extractor mistakes set-body json response as transitive dependency which causes pipeline failure未关闭type:bug
难度 3/5 1-2 天 新手友好度 56/100
Azure/apiops-cli#349 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
tashfeenahmed/freellmapi#2217 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
remotion-dev/skills#37 ·
-
gui: a narrow window's gateway key row with a line under it wraps its faded badges onto blank lines未关闭
难度 2/5 1-3 小时 新手友好度 74/100
-
Slider: Escape during a thumb drag keeps and commits the dragged value, unlike ui-sdk's other drags未关闭
难度 2/5 1-3 小时 新手友好度 76/100
vercel-labs/ui#1758 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
nicobailon/pi-subagents#3425 ·
维护者通常 1 天内回复