Distinguish unresolved from resolved-empty required resources
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
Direzione di ricerca
Inizia leggendo le API request.get_required_resource e get_required_resources e le relative docstring, quindi confronta il comportamento analogo di require_schema/get_required_schema. Definisci i casi supportati unresolved, absent e present e conferma con i test la forma dell’API scelta; il lavoro è completato quando i chiamanti possono distinguere questi stati senza duplicare i controlli di appartenenza.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What problem are you facing?
request.get_required_resource (and get_required_resources) returns None/[] in two semantically different cases: the requirement hasn't been resolved by Crossplane yet, and the requirement resolved but matched nothing. The only way to tell them apart is to also check name in req.required_resources, which the get_required_resources docstring documents as a caveat the caller must handle by hand.
This distinction matters whenever a function gates on an external resource. "Not resolved yet" is transient — wait and let Crossplane re-call. "Resolved, matched nothing" is a real state — the resource was deleted, or its reference is a typo — and usually wants a different response (e.g. a warning, or holding steady rather than waiting). Functions end up reimplementing the same in-then-get dance. We hit it twice in one project: once gating a hydration Job on an auth Secret, and once gating replica placement on a referenced cache being resolvable.
How could this Function help solve your problem?
A small helper that classifies a required resource into the three states, so callers don't each re-derive it from the in check. Roughly:
class Resolution(enum.Enum):
UNRESOLVED = "unresolved" # Crossplane hasn't fetched it yet (key absent)
ABSENT = "absent" # resolved, but nothing matched
PRESENT = "present" # resolved and found
def resolve_required(req, name) -> tuple[Resolution, dict | None]: ...
A list variant (and possibly the same for require_schema/get_required_schema, which has the analogous distinction) would round it out. Naming/placement and whether this is an enum vs. a small result type are open — happy to send a PR once there's a preferred shape.
- Lingua principale
- Python
- Stelle
- 12
- Fork
- 15
- Merge medio
- 1g 12h
- PR unite (30g)
- 7
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crossplane/function-sdk-python
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
crossplane/function-sdk-python#199 · 4 commenti · 3 reazioni ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
crossplane/function-sdk-python#129 · 1 commento ·
-
Dependency Dashboard Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 10/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
crossplane/function-sdk-python#5 · 1 commento ·
Tutte le issue di crossplane/function-sdk-python
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
canonical/paas-charm#368 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
addition to tracking list Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
StevenBlack/hosts#3256 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
qualcomm/qai-appbuilder#275 ·