Support composed resource dependencies - #378
Draft
stevendborrelli wants to merge 1 commit into
Draft
stevendborrelli wants to merge 1 commit into
stevendborrelli wants to merge 1 commit into
Conversation
Sync proto/v1 with the composed resource ordering prototype in crossplane/crossplane#7842 and regenerate, picking up Dependencies, Dependency, RequiredResourceDependency, the DependencyLifecycle enum, the dependencies field on the request and the response, and CAPABILITY_DEPENDENCIES. response.To carries the request's dependencies forward, as it does desired state and context, so a function that adds one keeps the ones earlier functions declared. It copies them only when the request has them: unset means "no opinion, carry mine forward" and empty means "drop every constraint", so turning one into the other would change the graph. It copies rather than shares them, so adding to the response doesn't add to the request. AddDependency declares a dependency between composed resources, with WithCreateBeforeDestroy for a replacement, AddRequiredResourceDependency one on a resource the function requires, and ClearDependencies drops them all. This mirrors crossplane/function-sdk-python#241, and like it can't land before the protocol change does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
This adds SDK support for the
dependenciesfield that #7842 adds toRunFunctionRequestandRunFunctionResponse.proto/v1is synced with the prototype'sproto/fn/v1and regenerated. That addsDependencies,Dependency,RequiredResourceDependency, theDependencyLifecycleenum, thedependenciesfield on the request and the response, andCAPABILITY_DEPENDENCIES.response.Tocarries the request's dependencies forward, the way it carries desired state and context, so a function that adds a dependency keeps the ones earlier functions declared. It copies them only when the request has them, because an unset field means "no opinion, carry mine forward" and an empty one means "drop every constraint". It copies rather than shares them, so adding to the response doesn't change the request.Four helpers declare dependencies:
response.ClearDependenciesdrops every dependency, including the onesTocopied forward.function-ordering, a fork of function-sequencer that emits dependencies instead of composing Usages, builds against this branch and declares its edges with
AddDependency.I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
Unit tests cover
Tocarrying dependencies forward, unset versus empty, and copying rather than sharing, along with each helper.🤖 Generated with Claude Code