Skip to content

Handle revisioned API deletion in --delete-unmatched and add integration coverage - #178

Draft
Elizabeth Maher (EMaher) with Copilot wants to merge 7 commits into
mainfrom
copilot/delete-unmatched-parameter-fix
Draft

Handle revisioned API deletion in --delete-unmatched and add integration coverage#178
Elizabeth Maher (EMaher) with Copilot wants to merge 7 commits into
mainfrom
copilot/delete-unmatched-parameter-fix

Conversation

CopilotAI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

apiops publish --delete-unmatched could fail to remove APIs with revisions because root and revision deletes were executed in an order APIM rejects (Cannot delete the current revision of an API). This left dependent resources undeletable in the same run.

  • Delete orchestration fix (publish path)

    • In publish-service, API deletes are now processed separately from other resources.
    • API delete order is deterministic and revision-aware: revision descriptors are deleted before their root API descriptor, and API deletes run sequentially to avoid race/order conflicts inside the same API family.
    • Non-API resources keep parallel delete behavior.
  • Unit coverage for regression and ordering

    • Added tests proving:
      • orders-api;rev=2 is deleted before orders-api.
      • Ordering remains deterministic across multiple API families (including revision + root pairs).
  • Integration coverage for --delete-unmatched

    • Added a new round-trip phase (Phase 7, run-phase7-delete-unmatched.ps1) that:
      • removes a known revisioned API from extracted artifacts,
      • runs publish with --delete-unmatched,
      • verifies both revision and root API resources are removed from target APIM.
    • Renumbered subsequent round-trip phase labels so teardown is now Phase 8 (run-phase8-teardown.ps1).
    • Wired these updates into both the round-trip orchestrator and integration-test.yml.
    • Updated integration README to document the renumbered phases.
functionorderApiDescriptorsForDelete(descriptors: ResourceDescriptor[]): ResourceDescriptor[]{return[...descriptors].sort((a,b)=>{constaName=getNamePart(a.nameParts,0);constbName=getNamePart(b.nameParts,0);constaRoot=getApiRootName(aName);constbRoot=getApiRootName(bName);if(aRoot!==bRoot)returnaRoot.localeCompare(bRoot);constaIsRevision=isApiRevisionName(aName);constbIsRevision=isApiRevisionName(bName);if(aIsRevision===bIsRevision)returnaName.localeCompare(bName);returnaIsRevision ? -1 : 1;});}

CopilotAI changed the title [WIP] Fix deletion of unmatched APIs with revisionsHandle revisioned API deletion in --delete-unmatched and add integration coverageJun 22, 2026
Comment thread.github/workflows/integration-test.yml Outdated
@EMaher
Elizabeth Maher (EMaher)force-pushed the copilot/delete-unmatched-parameter-fix branch from f4e93d9 to 590a88fCompareJuly 1, 2026 22:53
- Updated PowerShell scripts in the integration tests to improve readability and maintainability.
- Replaced the use of `Invoke-MaskedApiopsCommand` and `Invoke-MaskedAzCommand` with direct calls to the `apiops` CLI and `az` commands, enhancing error handling and output masking.
- Introduced a new teardown phase script to handle resource group deletions and soft-deletion purging of APIM instances.
- Removed the phase for validating delete-unmatched behavior and integrated its functionality into the publish phase.
- Added support for a `--delete-unmatched` switch in the publish phase to manage unmatched resources during deployment.
- Enhanced secret redaction in logs by implementing a `Protect-Secret` function for better handling of sensitive information.
- Updated documentation and comments for clarity and consistency across scripts.
@EMaherElizabeth Maher (EMaher) removed their assignment Jul 7, 2026
Sign up for freeto 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.

2 participants

@EMaher