Repository navigation
refactor(migrate): re-pin the capability catalog to CLI 1.0.0b31 and compile it against a real release - #53
Merged
Conversation
Paul Yuknewicz (paulyuk)
approved these changes
Nov 16, 2026
Paul Yuknewicz (paulyuk)
left a comment
Member
There was a problem hiding this comment.
looks good. just it has b31 and SHA all over so you're signing up to maintain that.
| id: wheel | ||
| working-directory: tools/migrate-apim | ||
| run: | | ||
| set -euo pipefail |
There was a problem hiding this comment.
We can do this. maybe safer, but you have to keep setting the SHA right. I assume you want to pin instead of install script which goes to latest?
Member
Author
There was a problem hiding this comment.
Addressed!
Support the new Foundry bulk-import workflow introduced in CLI v1.0.0b30: - Rename capabilities file from b26 to b30 to match documented version - Add provider.import capability for bulk Foundry deployment import with automatic identity/RBAC setup - Add mcp.import capability for bulk MCP tool server registration - Update provider.create to include --import-models option for combined create+import - Add asset rule for Foundry providers offering bulk-import, create-only, or combined options - Add asset rule for MCP servers offering bulk-import or individual registration paths - Update targetCapabilities reference in rules.json to b30 - Update test expectations to 32 capabilities (was 30) The split between import and create commands improves the migration skill's decision logic by offering operators explicit choices between bulk setup (faster, broader grants) and granular configuration (more control).
…abilities Reviewing the b31 release against the released wheel turned up three ways the catalog claimed things the CLI does not do. `mcp import` does not exist -- not in b31, not in b30, nowhere in the wheel. `model-provider import` does exist but takes `--foundry-resource-id`, an account resource ID, not the `--foundry` JSON argument that `model-provider create` takes; the catalog required `foundry`, so the capability probed `unavailable` against a CLI that was working fine. Both shipped in the b30 bulk-import change. Neither reached a plan item -- `_provider` hardcodes `provider.create`, and `_mcp` matches rules by `pattern`, which the `mcp.import` rule did not declare -- so nothing broke in the field. Wired up, they would have produced blocking `capabilityUnavailable` items telling operators to upgrade an extension that no version would fix. The offline suite injects a probe, by design, so a fabricated command passes every test it has. `TestTheCatalogueOnlyDeclaresRealCommands` reconciles the catalog against the real wheel when the documented release is installed, and skips rather than guessing when it is not. It names both defects exactly. `DEFAULT_CATALOG` still read `aigateway-1.0.0b26.json`, deleted two releases ago. Every entry point that does not pass `--capabilities` falls back to it, so `plan` failed outright with "capability data unavailable" and 228 tests errored at fixture setup. `TestTheDefaultCatalogueResolves` pins the constant to a file that exists and to the version it documents. `to_dict` reported that same constant as the catalog it had loaded, which was wrong whenever `--capabilities` was passed; it now reports the catalog actually read. b31 itself needs no capability change. The two wheels differ only in `custom.py`, where `mcp create` single-source normalization became shared and idempotent; the command and option surface is identical, and `apply` builds MCP servers with `--endpoints @file`, which was never affected. Verified against the released b31 wheel (sha256 f8f13bfb…, matching the pinned digest) loaded into an isolated AZURE_EXTENSION_DIR: 472 pass, including the live probe. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…elects rules.json is only worth maintaining if the planner reads what it says, and it did not. Thirteen of its rules could never be chosen: every `models` and `modelProviders` asset rule, because `_provider` and `_model` hardcode their capability ids and never consult the rules at all, and four structural rules for kinds `_structural` never asks for. Five of the dead asset rules matched on keys no collector emits -- `modelsStatus`, `surfaceStatus`, `hasUnpublishable`, `translationStatus`, `aspect` -- where the real values live at nested paths like asset["models"]["status"]. Two faults cancelled out: those rules matched nothing and nothing asked for them, so wiring the planner to consult them would not have worked either. None of this was visible at the call site, because selection was an inline lambda per site. A checker could only find it by declaring the criteria a second time somewhere else, and a second declaration drifts from the first -- which is how the problem started. So selection goes through `Selector`, which performs the match and *is* the statement of what the match looks at. The five sites declare one each. A rule is governed when its match keys are a subset of the keys that site reads and every value it pins is one that site accepts; subset rather than equality, because a rule may pin fewer keys, but pinning more means the surplus is silently ignored and the rule matches more broadly than it reads. The structural `workspace` rule was doing exactly that with a `name` condition the planner hardcodes anyway. Behaviour is unchanged. The fixture plan is byte-for-byte identical before and after both the refactor and the deletions -- which is what being dead means. The three deleted structural rules that merely asserted "nothing to do" for products, named values and policy fragments are recorded elsewhere: products in the catalog's `unsupported` list, all three in README's mapping table. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The catalog is a claim about one `az aigateway` release: these commands exist, they take these options. Nothing checked it, and it was wrong in shipped form -- `mcp import` exists in no release, and `model-provider import` takes `--foundry-resource-id`, not the `--foundry` the catalog required. Neither could fail a test, because the suite injects a probe and a fake answers whatever it is told to. `migrate-apim compile` settles it offline, against capabilities/cli-surface-<version>.json: every command and option the catalog declares, every rule against the planner's registered selection sites, both files against new JSON Schemas, and the version and digest across the catalog, the rules, DEFAULT_CATALOG and the cli/ installers. It needs no az, no network and no credentials, so it can gate every change. The snapshot is what joins the offline check to a real wheel, and it carries the wheel's SHA-256 so it cannot be paired with a release it did not come from. scripts/export_cli_surface.py writes it from an installed extension. That script does not reuse `az_option_probe`. Scraping any line that starts with `--` reads the summary prose of `model-provider create` as declaring an option called `foundry.`, and `mcp create` as declaring `credentials)` -- false positives that would let a bogus catalog option through the very check meant to catch it. The parser here is anchored on structure: lines indented four spaces inside a section heading ending in "Arguments", declaration half only. A first attempt at tightening that went too far and dropped the resource-id arguments instead, so `--self-test` pins both directions against commands whose real surface is known. Diagnostics say why, not just that: a rule matching on an unknown key and a rule matching on a value no site compares against are different mistakes with different fixes. tests/test_compile.py reconstructs each defect that shipped and asserts the compiler names it. Against the shipped contract: 0 errors, 5 advisory warnings for fields no code reads. 497 tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two jobs, because the contract has two halves with very different costs. migrate-apim.yml compiles the catalog and rules against the committed snapshot and runs the suite. Offline, no az, no network, about a minute -- so it gates every pull request. This is the repo's first `pull_request` trigger; catching the defect before merge rather than after is the entire point. cli-surface.yml answers the other half: whether the committed snapshot is what the pinned wheel really offers. It installs the Azure CLI, verifies the wheel digest before installing rather than after, re-exports the surface into an isolated AZURE_EXTENSION_DIR and fails if the committed file has drifted, attaching the regenerated one. It runs on cli-v* tags and on request, because the snapshot only needs to change when the CLI does. Together they give catalog subset-of reality. Keeping them apart is what lets the first gate everything: proving a command exists needs the real wheel, but proving the catalog only names commands the snapshot contains needs nothing. The explicit `import jsonschema` step is not ceremony. Without it `_validate_against` returns no errors for plan and journal documents instead of failing, and compile can only warn that it did not shape-check -- both would pass while checking nothing. Actions are pinned to full commit SHAs with their version in a comment, matching labs-pages.yml, which is left alone: it is bound to the pages concurrency group and the github-pages environment. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…reads
rules.json is the single source of truth for the mapping, except where it was
not. `plan._structural` hardcoded a verdict and an item kind per branch while
the rule carried its own; the telemetry branch hardcoded four options with
their consequence text while the rule carried four more, already drifted in
wording; the certificates and credentialProviders branches ignored the proposal
their rules named and raised the items with none. The App Insights prerequisite
was raised whenever telemetry reported, including when the plan had settled on
a destination that creates no exporter -- work invented by the tool, and the
prose field that said so was read by nobody.
So the builder reads what the file says. The option reader takes either shape,
bare string or {value, consequence}, so a rule can gain a consequence later
without the reader changing. `prerequisiteGuide` becomes `prerequisiteWhen`,
which names the destinations that leave an endpoint outstanding and can
therefore be acted on rather than only read.
A selector now also declares what it `reads`. That is the same answer as `keys`
to a question one layer in: a field no site consumes is a field somebody wrote
expecting an effect it does not have. The six `_structural` branches declare
six selectors rather than one keyed on `kind`, because they share a key and
nothing else -- one selector would have to declare the union of what they read,
excusing a field on the workspace rule because the telemetry branch reads it.
Structural rules are held to carrying a verdict now that one is read. Dead
weight goes: `constraints` and `dependsOnBackendRole` restated prose already in
their rationale, `priority` described an ordering that lives in the code, and
`toolDiscoveryGuidance` is folded into the option consequences, where it
reaches the operator it was addressed to instead of sitting in the file.
The only plan output that changes is that tool-exposure options now carry their
consequences, and the two reprovisioning items carry the proposal their rules
always named.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Four gaps, all of the same kind: something the compiler could have settled and did not, so it passed on data that was wrong. The surface snapshot records which options the CLI marks [Required], and nothing read it. Blanking `mcp.create` to require nothing compiled clean while the real command insists on --tool-server-name. A release that makes an option mandatory would have been found at apply time, against a live gateway, which is the worst place to find it. Identity arguments are excepted by name, because `apply` supplies those from the plan's target rather than from the catalog. The unread-field warning was a denylist kept in this file -- a second declaration, which drifted exactly as the design predicted. It named `constraints` and `toolDiscoveryGuidance` and missed `prerequisiteGuide`, the telemetry rule's `options`, and `blocking`/`cannotAccept`, all equally unread. It is derived from the selectors now, so the list that decides lives where the reading happens. A rule nothing can select is exempt: every field of it is unread by construction, and saying so once per field buries the reachability error that is the actual problem. Ties were checked for the policy element pass only. The family and expression passes are first-match too, and a second `family: transform` rule compiled clean while never being reached. All three sections go through the registry now, with list-valued matches expanded so one repeated element among several is still caught. `--newest-release` reports a catalog that has fallen behind the published releases, and -- more useful right now -- warns when it is pinned ahead of them, as b31 is: until that release is tagged there is no wheel for cli-surface.yml to check the snapshot against, so the claim this all rests on is unverifiable. It takes the whole tag list and picks the newest itself rather than trusting git's `--sort=v:refname` to order b100 against b99. Smaller: schema errors past the twenty-fifth are counted rather than dropped silently, and an unreadable installer becomes a diagnostic like every other load here instead of the one thing that raises. --strict now passes on the committed data, which is the only state in which it is worth having. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The drift check was `git diff --exit-code` over capabilities/, and the snapshot records the azure-cli-core that produced it. The runner installs whatever is current, so the next core release would have failed the job with "the committed CLI surface snapshot does not match the pinned wheel" -- false, and the kind of false that teaches people to ignore a check. It compares what the two snapshots claim now: version, digest, commands, options. `--compare` names the command and flag that moved, so the log says what to re-pin rather than only that something did. The cli-v* tag trigger did nothing it appeared to. It read the version from the committed catalog, so tagging b32 re-verified b31 and passed green; it could never report the pin it existed to watch. That signal moves to the offline job, where it needs no CLI and no network, and where the person it is addressed to is already standing. A gateway release is not this tool's build to redden. The cost is that it is only asked when somebody touches this tool -- a pin can sit stale between visits, but it cannot be stale while being worked on. cli-surface.yml now runs when the snapshot or the exporter changes, which is when the question it answers can have a new answer. A missing release asset and a wrong digest get different messages, because they are different problems: the catalog is allowed to pin a release candidate, as it does today, and what it cannot do is pretend the snapshot has been checked against one. The exporter's offline half is tested now -- the comparison CI leans on, and the help parser that decides what a snapshot says, including the prose-scraping failure mode that reads `foundry.` as an option. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The claims table promised "no two rules look identical to the site that selects them", which was true of two of the four policy passes. It lists what is actually checked now, including the fields-have-readers check and the release pin, and the CI table describes the triggers the workflows have rather than the ones they had. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Facundo Santiago (santiagxf)
force-pushed
the
compile-capabilities
branch
from
November 16, 2026 17:08
1cec36f to
70b478b
Compare
Review on #53: the catalog pins a version and a digest, so somebody has to keep them right. True, and the cost was worse than it looked. Moving to a new release meant editing the catalog filename, five fields of cliEvidence, the snapshot filename and its contents, targetCapabilities in rules.json, six test fixtures, two docs mentions, and a constant in capability.py. Ten files, by hand, where a digest updated but a filename left behind still compiles -- and the snapshot is then a record of a wheel nobody pinned. Add scripts/azcli_aigw_apply.py, which does the whole move or none of it: fetch the released wheel, record its digest, install it in a throwaway extension directory, re-export the surface, rename the catalog, rewrite cliEvidence, repoint rules.json, drop the snapshot being left behind, then run compile against what it now claims. --dry-run reports the move without writing. It will not write surfaceDelta. That field says what changed between two releases in terms a reader can act on, which a diff of option lists is not, so it is blanked and reported as still to do by hand. Carrying the previous delta forward would read as though this move had been reviewed. Stop writing the version into Python. DEFAULT_CATALOG is now the one aigateway-*.json that is there, which is how cli-surface.yml has always resolved it. That takes the only code edit out of the release move; a test pins that exactly one catalog is present, since two would be picked between by sort order rather than by what was adopted. Rename export_cli_surface.py to azcli_aigw_export.py, so the two scripts that work on the az aigateway extension sort together and read as a pair: export reads one wheel into a snapshot, apply moves the whole contract onto a release. Pinning itself stays. The snapshot is a record of one specific wheel, so installing latest would compare it against whatever shipped that morning and redden CI on every CLI release for something that is not a defect here. That failure mode already cost this branch a fix: the drift check compares what snapshots claim rather than their bytes, because azure-cli-core floats on the runner and read as drift in the wheel. 549 passed, 1 skipped. compile reports 0 errors, 0 warnings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The catalog's version and digest are also carried by cli/install.sh, cli/install.ps1 and cli/tests/test_installers.py, and compile's installer-pin check holds all three to them. azcli_aigw_apply.py moved the catalog and left the installers behind, so an adoption would have ended on the error it exists to prevent. This went unnoticed because the first upgrade did not need it. Taking the catalog from b26 to b31 satisfied installer-pin by accident: the b31 release had already moved the installers, so nothing had to know they were part of the contract. The next adoption gets no such help. Replace the exact previous version and digest rather than sweeping anything version-shaped. tests/test_installers.py names an older release on purpose as the upgrade-from fixture, and a sweep would rewrite the one case that proves upgrading works -- while looking like it had succeeded. compile draws the same distinction, holding only the two installers to "no other version appears". An installer that does not carry the version the catalog is moving from stops the adoption. It means the two had already diverged, and which of them is right is not a question this can answer. The installers are moved before the catalog is renamed, so a refusal does not leave the tree half moved. Seven tests, on fixtures: no network, no wheel, no installed extension. They cover the pin moving, the upgrade-from fixture surviving, dry runs writing nothing, and both refusals. 556 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The release-pin error listed the steps by hand and told the reader to point DEFAULT_CATALOG at the new catalog. That instruction is now wrong -- the constant is discovered, not written -- and the list never mentioned the installers, which is the step that was missing from the tooling itself. Name the command instead. The error a reader hits when a release lands should tell them the one thing that moves the whole contract. 556 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
release-pin failed when a newer cli-v* existed, and installer-pin failed when cli/ named a different version than the catalog. Between them, publishing a CLI release broke every change to this tool until somebody adopted it. b33 shipped while this branch was in review and did exactly that. Both contradict what the tool says about itself. migrate-apim.yml: "a gateway release is not this tool's build to redden, and the fact is most useful to whoever is already editing the table." ARCHITECTURE.md: advisory facts are warnings that --strict promotes. The code errored on both. The catalog is a claim about one release, checked against that release, and it stays true when a newer one ships. Falling behind is a prompt to adopt, not a defect. The installers compound it: cli/ moves when the CLI releases, the catalog moves when it has been verified against that release -- two pins, two owners, two cadences -- so holding them equal on pain of failure forces the lockstep release-pin already refuses. Both become warnings. --strict still promotes them, so the adoption PR has to land the whole move together, and the installers keep their own pin honest through cli/tests/test_installers.py. Checked against the state that caused this: catalog at b31, cli/ taken from main at b33, every tag passed as --newest-release. 0 errors, 9 warnings, exit 0; --strict exits 1. 559 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A release moves install.sh, install.ps1 and test_installers.py together, and each was reported for three symptoms: no digest, wrong version, and some other version present. Nine warnings for one fact, with one thing to do about it that release-pin was already saying on the tenth line. Read all three first, then report. When they are off the catalog's version and agree on which release they are on, that is one sentence. The digest is only mentioned for a file otherwise on the right release; on a different one it is wrong by construction and says nothing new. Keep the detail for the case that needs it. When the installers disagree with each other, which of them is right is the open question, so each says what it is pinned to -- collapsing those would hide the only thing that settles it. Against catalog b31 with cli/ from main at b33: 9 warnings become 2. Fixture versions in the new tests are 1.0.0b9x, not 9.9.9b9: _PIN matches `1\.0\.0b\d+`, so the made-up shape never reached the code under test. 561 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
installer-pin held the catalog to the version in cli/install.sh. Those installers are the CLI's own artifact and move when it releases, so the check made the newest release the only version the catalog could ever pin -- and a catalog pinned to latest means every run validates against latest, which is the opposite of what pinning the catalog is for. That was the conflict behind the last three changes. Demoting the check to a warning and then collapsing nine warnings into one were both treatments of a symptom: the dependency pointed the wrong way, and azcli_aigw_apply.py had started rewriting cli/install.sh to keep it satisfied -- the migration tool editing the CLI's installer to agree with itself. Remove the check, the --cli-dir plumbing it was the only consumer of, and the installer rewriting from the adoption script. cli-surface.yml already does the right thing: it reads documentedVersion and wheelSha256 from cliEvidence and installs exactly that wheel. The catalog is the source of the version. cli/ keeps its own pin honest through cli/tests/test_installers.py, which is where that belongs. Against the b31 catalog with every tag: 9 warnings become 1, the release-pin one that says a newer release exists and what to run to adopt it. 550 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Nothing is wrong when a newer release exists. The catalog is a claim about one release, checked against that release, and another one shipping does not make it false. Calling it a warning put a problem in CI that was not there, and under --strict would have failed this tool's build on somebody else's release. Add a third severity. Errors fail. Warnings stay advisory and --strict still promotes them. Suggestions are never fatal, not even under --strict, and are counted apart from the tally so a clean compile still reads as clean: 0 error(s), 0 warning(s), 1 suggestion(s) Only the behind-case moves. A version that cannot be compared, and a catalog pinned ahead of anything published, are still warnings -- the first means the check could not run, the second that the snapshot cannot be verified yet. Both are about this contract, not about someone else's release. 550 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A run that speaks up only on failure leaves the reader of a green one unable
to tell a thorough check from a vacuous one. That is not hypothetical here:
the catalog shipped a command that existed in no release, and rules.json
carried entries no site could select, both through a green suite.
Each check now reports what it covered, printed before the diagnostics:
checked catalog and rules against their schemas, unknown keys rejected
checked 31 capabilities and 90 declared options against 74 commands in the
1.0.0b31 surface
checked 1.0.0b31 and its wheel digest agree across the catalog filename,
cliEvidence, the snapshot and rules targetCapabilities
checked 27 rules across assets, structural, policies: each selectable,
every field read by a site that can select it, none ambiguous
checked 1.0.0b31 against 4 published release(s)
The numbers come from the data each check walked, so a line that thins out
is a check that stopped covering something. The release line is absent
without --newest-release: nothing was compared, so claiming it ran would be
a lie.
553 passed, 1 skipped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three places named a release: the capability inventory in README.md, the --newest-release example beside it, and the ARCHITECTURE.md line describing what the catalog is paired to. All three go stale on the next adoption, and nothing checks prose, so they would have gone stale quietly. Two become version-free: `capabilities/aigateway-<version>.json`, and a catalog "paired to one CLI release, named in its own cliEvidence.documentedVersion and in its filename" -- which says where to look instead of repeating the answer. The --newest-release example had a worse problem: it named a single made-up tag, so a reader copying it learned the wrong usage. It now passes every cli-v* tag, which is what the check is built for and what CI does. Verified against the 11 tags in the repository. Same reasoning as dropping the version from DEFAULT_CATALOG: the version is written in the catalog, and everything else should read it from there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Six tests named 1.0.0b31, so adopting a release meant editing the suite to keep it green. A test that has to be updated to pass is one nobody reads before updating it -- the version gets bumped, the assertion goes back to green, and whatever it was guarding is never re-examined. They assert against the catalog instead: - the pinned catalog's version comes from DEFAULT_CATALOG, and its content is checked for shape -- capabilities exist and all carry an id -- rather than for a count that has to be re-counted; - the plan records the version CapabilityMap.load() reports, which is the actual property: the plan says which table it was planned against; - the two compile tests that need a release *after* the catalog's derive it with one_newer(). A literal there was the same trap as a literal in the catalog -- newer than today's pin, older than tomorrow's, so the case it exercised would quietly stop firing on the first adoption. Both did: they were the only failures when this was tested. Verified by moving a scratch copy of the catalog to another release and running the suite untouched: 553 passed, 1 skipped, no test file edited. The literals that remain are fixtures -- a fake surface, and the version ordering cases where b100 must beat b99 -- which are inputs, not claims about what is pinned. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
cli-surface.yml and migrate-apim.yml were split on the claim that they answered different questions on different cadences. The first half is true and the second is not: cli-surface's paths -- capabilities/** and the exporter -- sit inside tools/migrate-apim/**, so it never ran when migrate-apim.yml did not. The snapshot cannot change without the catalog directory changing. Two files, two statuses to read, one answer. Merge them. The jobs stay separate, because the questions really are different and the chain only holds with both: catalog --compile--> snapshot --export--> the published wheel compile checks the catalog against the committed snapshot and needs nothing; export installs the wheel the catalog pins and fails if the snapshot is not what that wheel offers. Neither covers the other: compile can gate every change only because it trusts the snapshot, and a snapshot is a file somebody could hand-edit. What this costs: export now runs on any change under tools/migrate-apim/, so an offline refactor of plan.py pays two minutes and a network dependency it did not before. The alternative was keeping a second file to express a path filter, which is not worth a second status. Also drops the cli/ path triggers. They were there for installer-pin, which is gone, so edits to cli/install.sh were starting a workflow that no longer reads cli/ at all. 553 passed, 1 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Paul Yuknewicz (paulyuk)
approved these changes
Nov 16, 2026
Paul Yuknewicz (paulyuk)
left a comment
Member
There was a problem hiding this comment.
compiler is nice addition
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.
Stacked 2 of 2. Targets
cli-b30(#48), notmain. Review #48 first.Summary
Re-pins the migration tool's capability catalog to
aigateway-1.0.0b31.jsonand makes it checkable against the CLI it describes.migrate-apim compilecompares the catalog to a surface exported from a real published CLI and fails on any command, flag, or option the CLI does not offer. CI runs it on every change.The two corrections below are what that check finds in the previous catalog.
Catalog corrections
mcp.importis removed.az aigateway mcp importdoes not exist in the released CLI. The capability and the planner rule inrules.jsonthat offered bulk MCP registration both go. The catalog holds 31 capabilities.provider.importhad the wrong selector. It declared a required--foundryJSON argument. The command takes--foundry-resource-id, an account resource ID;--foundrybelongs toprovider.create. The entry and its rule note are corrected.provider.importandprovider.create --import-modelsremain supported, and the Foundry bulk-import decision path stays. There is no MCP equivalent.The check
migrate-apim compilecomparescapabilities/aigateway-<version>.jsonagainstcapabilities/cli-surface-<version>.json, a snapshot of an actual CLI release.scripts/export_cli_surface.pygenerates that snapshot from an installed wheel, so it is regenerated rather than hand-edited.Two schemas —
capabilities.schema.jsonandrules.schema.json— pin the shape of both halves of the contract.Declarative rule selection (
dispatch.py). Each selection site declares what it reads, and rules that nothing selects are removed.Planner wiring.
plan.pyreads whatrules.jsondeclares instead of restating the logic.Two workflows.
migrate-apim.ymlruns the compile and the test suite offline on every change.cli-surface.ymlre-installs the pinned wheel, re-exports the surface, and fails if it no longer matches the committed snapshot, so the snapshot stays an accurate record of a real release.Reviewing notes
cli-surface-1.0.0b31.jsonis 1,021 lines of generated output — readexport_cli_surface.pyinstead of the JSON.test_compile.pyandtest_export_surface.pyare another ~600 lines.The compiler and the rule-selection work are mutually dependent and ship together:
compile.pyimportsdispatch, and the planner wiring editsrules.schema.json.Verification
python -m migrate_apim compile --cli-dir ../../cli→aigateway-1.0.0b31.json against cli-surface-1.0.0b31.json: 0 error(s), 0 warning(s)python -m pytest -q→ 548 passed, 1 skippedcli-surface.ymlre-exported the surface from the pinned wheel in CI and matched the committed snapshot.🤖 Generated with Claude Code