Distinguish unresolved from resolved-empty required resources
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
Comece lendo as APIs request.get_required_resource e get_required_resources e suas docstrings; depois, compare o comportamento análogo de require_schema/get_required_schema. Defina os casos compatíveis unresolved, absent e present e confirme com testes o formato de API escolhido; o trabalho estará concluído quando os chamadores puderem distinguir esses estados sem duplicar verificações de pertencimento.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 12
- Forks
- 15
- Merge médio
- 1d 12h
- PRs com merge (30d)
- 7
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de crossplane/function-sdk-python
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
crossplane/function-sdk-python#199 · 4 comentários · 3 reações ·
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
crossplane/function-sdk-python#129 · 1 comentário ·
-
Dependency Dashboard Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 10/100
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
crossplane/function-sdk-python#5 · 1 comentário ·
Todas as issues de crossplane/function-sdk-python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
anthropics/skills#1811 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
speaches-ai/speaches#678 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
datalayer/mcp-compose#42 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
conda-forge/spacy-feedstock#177 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
UKGovernmentBEIS/inspect_evals#2523 ·