Skip to content

refactor: ts sdk module execution system to use imports - #8653

Merged
helderco merged 9 commits into
dagger:mainfrom
TomChv:ts-sdk/improve-function-executor
Oct 14, 2024
Merged

helderco merged 9 commits into
dagger:mainfrom
TomChv:ts-sdk/improve-function-executor

Conversation

@TomChv

@TomChv TomChv commented Oct 8, 2024 •

Copy link
Copy Markdown
Member

Rework the way the user's code is imported to be executed to actually uses imports instead of loading it from its decorators.

This would unblock severals features such as interface supports and compositions.

It's also a safer way to actually executes the user's code and resolve default value by reference, specially complex values since they can now be resolve by actually executing them if they are exported.

The changes are backward compatible.

@TomChv TomChv self-assigned this Oct 8, 2024
@TomChv TomChv changed the title refactor: module execution system to use imports refactor(breaking change): ts sdk module execution system to use imports Oct 8, 2024
@jedevc

jedevc commented Oct 9, 2024

Copy link
Copy Markdown
Contributor

Is there a way we can make this change without breaking modules that have already been published to the daggerverse? Can we change the behavior based on the engineVersion?

@TomChv

TomChv commented Oct 9, 2024 •

Copy link
Copy Markdown
Member Author

Is there a way we can make this change without breaking modules that have already been published to the daggerverse? Can we change the behavior based on the engineVersion?

I could try to resolve the execution using the registry first, then the executor if it's failing to keep things backward compatible, but that's quite ugly no?

Or the reverse (first executor, then registry)

EDIT: I ensured the backward compatibility of that changes by using both method to resolve the function. With a test indeed ;)

@TomChv
TomChv marked this pull request as ready for review October 10, 2024 12:20
@TomChv
TomChv requested a review from a team as a code owner October 10, 2024 12:20
@TomChv
TomChv force-pushed the ts-sdk/improve-function-executor branch from fbe2320 to d553c39 Compare October 10, 2024 12:30
@TomChv TomChv changed the title refactor(breaking change): ts sdk module execution system to use imports refactor: ts sdk module execution system to use imports Oct 10, 2024
Tom Chauveau added 6 commits October 10, 2024 17:06
Rework the way the user's code is imported to be executed to actually
uses `imports` instead of loading it from its decorators.

This would unblock severals features such as interface supports and
compositions.

It's also a safer way to actually executes the user's code and resolve
default value by reference, specially complex values since
they can now be resolve by actually executing them if they are exported.

/!\ This is a breaking change! Anything that needs to be executed by
the runtime or the introspector now needs to be exported.

Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Keep the existing registry to ensure backward compatibility with
non-exported classes.

Add a test to verify that behaviour.

Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
@TomChv
TomChv force-pushed the ts-sdk/improve-function-executor branch from d553c39 to ecb3b8b Compare October 10, 2024 15:06
Signed-off-by: Tom Chauveau <[email protected]>
@TomChv

TomChv commented Oct 10, 2024

Copy link
Copy Markdown
Member Author

@helderco This is ready for a review! Only the PHP tests are failing which isn't related to this PR

Comment thread core/integration/module_type_test.go Resolved
Comment thread sdk/typescript/entrypoint/invoke.ts Resolved

@helderco helderco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for reply on #8653 (comment)

TomChv and others added 2 commits October 14, 2024 18:01
Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>
Co-authored-by: Helder Correia <[email protected]>
Signed-off-by: Vasek - Tom C <[email protected]>
@TomChv

TomChv commented Oct 14, 2024

Copy link
Copy Markdown
Member Author

Waiting for reply on #8653 (comment)

Replied :D

@helderco
helderco merged commit 28b3ffa into dagger:main Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants