Distinguish unresolved from resolved-empty required resources
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 42/100
Línea de trabajo
Empieza leyendo las APIs request.get_required_resource y get_required_resources y sus docstrings; después compara el comportamiento análogo de require_schema/get_required_schema. Define los casos admitidos unresolved, absent y present, y confirma con tests la forma de API elegida; el trabajo estará terminado cuando los llamadores puedan distinguir esos estados sin duplicar comprobaciones de pertenencia.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 12
- Forks
- 15
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 7
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crossplane/function-sdk-python
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
crossplane/function-sdk-python#199 · 4 comentarios · 3 reacciones ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
crossplane/function-sdk-python#129 · 1 comentario ·
-
Dependency Dashboard Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 10/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
crossplane/function-sdk-python#5 · 1 comentario ·
Todos los issues de crossplane/function-sdk-python
Issues similares
-
Add: hunch Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
DiamondLightSource/dodal#2211 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
openml/openml-python#1749 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
sipyourdrink-ltd/bernstein#6191 ·