fix(arm): resolveArmResources returns duplicate resources for versioned specs#4005
fix(arm): resolveArmResources returns duplicate resources for versioned specs#4005
Conversation
…ources Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
…s duplicate ARM resources Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
|
@copilot sample tests are failing |
… changeset description Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Investigated the sample test failures thoroughly. The failures fall into two categories:
I've reverted the incorrect ARM fix from Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Please create a test that reproduces the issue - the key appears to be that the spec is versioned and contains 2 or more versions when createSDKContext is called. Then please fix the issue so that the test passes. |
|
@copilot also, please ensure to pull the latest from main, ensure that build and tests pass, and that there are no formatting or spelling issues (pnpm format, pnpm cspell) |
…sources in versioned specs Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Done in commit Fix: Instead of blocking registration of realm types (which broke export function listArmResources(program: Program): ArmResourceDetails[] {
return [...armResourceStateMap(program).values()].filter(
(r) => !unsafe_Realm.realmForType.has(r.typespecType),
);
}This way:
All 270 ARM tests pass, and both regression tests pass with 2-version specs. |
…rm-resources-issue
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Done in commit |
commit: |
markcowl
left a comment
There was a problem hiding this comment.
Please make these fixes. Manke sure to pull the latest changes from main and ensure there are no formatting errors (pnpm format)
.chronus/changes/fix-arm-resource-duplicates-in-versioned-spec-2026-03-04-01-50-00.md
Outdated
Show resolved
Hide resolved
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Done in commit |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
pnpm format- import ordering inprivate.decorators.tsandcontext.test.ts)pnpm cspell- 0 issues in changed files)createSdkContextbeforeresolveArmResources)listArmResourcesto prevent duplicate resourcesOriginal prompt
This section details on the original issue you should resolve
<issue_title>[resource-manager] calling TCGC's
createSdkContextchanges the result ofresolveArmResources??</issue_title><issue_description>I have this spec:
and I did this test on it:
where the


createCSharpSdkContextcalls thecreateSdkContextmethod.When I debug the above test, I get 6 resources. The content might also be problematic but not the point of this issue.
If I uncomment the
ppart, when I debug:now we have 4 resources instead.
I was told that TCGC runs mutator - should resource manager library also consider it?
If resource manager library's API is returning an object from typespec which is different from the return value of TCGC, I think it becomes a little bit unreliable.
BTW TCGC has
onValidateruns beforepin the above code, which might be the reason why we have 4 resources instead of 2 (I only defined 2 resources in the spec)So in summary:
we have two layers of issues now.
resolveArmResourcesI get 4 resources, in which, each resource gets a duplicate.resolveArmResourcesafter I called TCGC'screateSdkContext, I get 6 resources, in which each resource gets two duplicates.Maybe currently this issue would not cause an issue, because we are deduplicating them by model's id. But there is concern if one spec has complicated versioning and breaks it.</issue_description>
Comments on the Issue (you are @copilot in this section)
@markcowl Need much more detail on what is actually in the program to start with to have any idea of how tocategorize this. @tadelesh `createSdkContext` API in TCGC uses mutation to get calculate...createSdkContextchanges the result ofresolveArmResources?? #3691🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.