Distinguish unresolved from resolved-empty required resources
まだ誰も着手していません。
評価
調査の方向性
まず request.get_required_resource と get_required_resources の API およびその docstring を読み、次に対応する require_schema/get_required_schema の挙動と比較します。サポートする unresolved、absent、present のケースを定義し、テストで選択した API の形を確認します。呼び出し側が membership check を重複させずにこれらの状態を区別できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 12
- フォーク
- 15
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 7
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crossplane/function-sdk-python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
crossplane/function-sdk-python#199 · コメント 4 件 · リアクション 3 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
crossplane/function-sdk-python#129 · コメント 1 件 ·
-
Dependency Dashboard オープン
難易度 1/5 1時間未満 初心者へのやさしさ 10/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
crossplane/function-sdk-python#5 · コメント 1 件 ·
crossplane/function-sdk-python の issue をすべて見る
似ている issue
-
essnmx good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
[Feature] 奇物选择添加优先级 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
syfoud/Simulated_Scepter#174 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Giskard-AI/giskard-oss#2840 · コメント 1 件 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success オープンarea: repo bug perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yeti-platform/yeti#1380 ·