Skip to content

fix(extract): resolve {{displayName}} named value references to resource names - #319

Merged
Alexander Zaslonov (azaslonov) merged 2 commits into
Azure:mainfrom
Alexey-Zheltov:fix/transitive-named-value-displayname
Oct 9, 2026
Merged

Alexander Zaslonov (azaslonov) merged 2 commits into
Azure:mainfrom
Alexey-Zheltov:fix/transitive-named-value-displayname

Conversation

@Alexey-Zheltov

Copy link
Copy Markdown
Collaborator

Summary

Policies reference named values by displayName ({{displayName}}), but the ARM GET endpoint is keyed by resource name. When the two differ, transitive extraction issued GET namedValues/<displayName>, got a silent 404, counted an error and never wrote the artifact.

Changes

  • extractTransitiveDependencies now builds a per-context displayName → name index (one LIST per context, shared across concurrent tasks via a cached promise) and resolves each named value reference through it before the GET.
  • References that do not match any displayName fall back to the reference as the resource name, so behaviour is unchanged for the common name == displayName case and for refs the LIST cannot see.
  • A reference that resolves to an already-extracted resource is skipped instead of being re-extracted or counted as an error.
  • A 404 on a transitive dependency now logs a warning instead of failing silently.
  • New unit tests in tests/unit/services/transitive-extractor.test.ts cover resolution, fallback, single LIST per context, already-extracted skip, LIST failure fallback, workspace-scoped resolution and missing-dependency error accounting.

Verification

Verified against a live APIM instance: a named value with name ≠ displayName referenced from an API policy (plus a control named value with name == displayName) went from 3 resources extracted, 1 errors with no artifact to 4 resources extracted, 0 errors, with the artifact written under its resource name.

Not in scope (follow-up)

Related Issue(s)

Closes #291

…rce names

Policies reference named values by displayName ({{displayName}}), but the
ARM GET endpoint is keyed by resource name. When the two differ, transitive
extraction issued GET namedValues/<displayName>, got a silent 404, counted
an error and never wrote the artifact.

extractTransitiveDependencies now builds a per-context displayName -> name
index (one LIST per context, shared across concurrent tasks) and resolves
each named value reference through it before the GET. References that do
not match any displayName still fall back to the reference as the resource
name, so existing behaviour is unchanged for name == displayName. A
reference that resolves to an already-extracted resource is skipped instead
of being re-extracted or counted as an error, and a 404 on a transitive
dependency now logs a warning instead of failing silently.

Verified on a live APIM instance: a named value with name != displayName
referenced from an API policy was previously reported as "1 errors" with
no artifact; it is now extracted under its resource name with 0 errors.

Closes Azure#291
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Raw reference keys can incorrectly suppress extraction of a different resolved named-value resource.

1 open finding
What changed in this PR

Resolves transitive named-value references by mapping policy display names to ARM resource names.

Changes:

  • Adds cached per-context named-value lookup and fallback behavior.
  • Adds missing-dependency warnings and duplicate extraction avoidance.
  • Adds unit coverage for resolution, fallback, workspaces, and failures.
File Description
src/​services/​transitive-extractor.ts Resolves named-value display names before extraction.
tests/​unit/​services/​transitive-extractor.test.ts Tests the new resolution behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/services/transitive-extractor.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation addresses the reported mismatch with appropriate deduplication, fallback behavior, and focused regression coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@azaslonov
Alexander Zaslonov (azaslonov) merged commit 85ee4e2 into Azure:main Oct 9, 2026
6 checks passed
Sign up for free to 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.

Transitive Dependencies and namedValues issues

4 participants