migrate-apim: handled elements are skipped before expression analysis, so policy-driven backend selection leaves no trace in the plan

Chiusa
#59 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #66 di @santiagxf — chiusa senza merge
  • #67 di @santiagxf — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, cloud

Direzione di ricerca

Start in plan.py at _policies() around line 879 and trace how policy elements reach _apply_partial_when(); then read the element-name rules in capability.py around lines 185–197. Check the statement-wrapper handling around plan.py line 1842 and compare how handled managed identity is represented around lines 290, 346, and 1134. Done means conditional or expression-driven set-backend-service routing is visible in the plan without changing sound handled cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

_policies() drops handled and notApplicable elements before any further inspection (plan.py:879):

if not rule or rule["verdict"] in {"notApplicable", "handled"}:
    continue

This happens before _apply_partial_when() on the next line, and element-name rules win over the hasExpression fallback by design (capability.py:185-197). The combination means set-backend-service — verdict handled, rationale "Backend selection becomes the alias backend pool" — is skipped regardless of what it actually does:

  • <set-backend-service backend-id="@(expression)" />, an arbitrary C# routing decision.
  • set-backend-service nested under choose/when, which _STATEMENT_WRAPPERS (plan.py:1842) correctly treats as a statement, so the element is classified and then discarded.

The alias backend pool is built from the APIM backend pool, which carries none of that conditional logic. The result is no item, no gap, and nothing in the plan recording that routing logic existed.

Why this matters here specifically

The project's governing rule is that a failed inference must not read as a confident negative, and collect already closed the analogous hole on the inventory side — referencedBy now scans policy text and expressions, because "a backend id built inside a policy expression was invisible."

The planner has the same hole one level up, and handled is a stronger claim than gap: it asserts that another object carries this.

By contrast, authentication-managed-identity is a sound handled — the provider item genuinely carries it (plan.py:290, 346) and raises the matching RBAC prerequisite (plan.py:1134). The verdict itself isn't the problem; skipping before analysis is.

Suggested fix

For a handled rule, still emit a cross-reference or raise an item when the element carries an expression (expressionIds non-empty) or sits under a conditional path, so the plan says the routing logic existed and what became of it.


Found while documenting the migration flow. Derived from reading the source; not reproduced against a live APIM instance.

Lingua principale
Python
Stelle
18
Fork
9
Merge medio
1g 16h
PR unite (30g)
23

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/aigateway

Tutte le issue di Azure/aigateway

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.