Distinguish unresolved from resolved-empty required resources
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc các API request.get_required_resource và get_required_resources cùng docstring của chúng, sau đó so sánh hành vi tương ứng của require_schema/get_required_schema. Xác định các trường hợp unresolved, absent và present được hỗ trợ, đồng thời xác nhận hình dạng API đã chọn bằng các test; hoàn thành khi các caller có thể phân biệt những trạng thái đó mà không lặp lại các phép kiểm tra membership.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 12
- Fork
- 15
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 7
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crossplane/function-sdk-python
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
crossplane/function-sdk-python#199 · 4 bình luận · 3 reaction ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
crossplane/function-sdk-python#129 · 1 bình luận ·
-
Dependency Dashboard Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 10/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
crossplane/function-sdk-python#5 · 1 bình luận ·
Tất cả issue của crossplane/function-sdk-python
Issue tương tự
-
Add: hunch Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DiamondLightSource/dodal#2211 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
openml/openml-python#1749 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sipyourdrink-ltd/bernstein#6191 ·