feat: enhance parameter annotation resolution in task signatures#477
Merged
Conversation
e2db7c8 to
b254819
Compare
b254819 to
a6ac044
Compare
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.
Problem
@env.templatebreakshud deploy/ sync introspection when env files usefrom __future__ import annotationsand template params use rich types (Literal, aliases, Pydantic models, unions).Failure surfaces as
TaskArgs is not fully defined.Cause
_TaskFactorystored a rawinspect.signature(func).With postponed annotations, that signature keeps annotation strings, and those unresolved strings were consumed by both manifest schema generation and start-time arg coercion.
Solution
Use an evaluated signature at construction time:
_TaskFactory.__init__, changed toinspect.signature(func, eval_str=True).task.sig, but now they get real runtime types.Note
Low Risk
Single-line signature evaluation change with targeted tests; improves typing/introspection without altering wire protocol or auth paths.
Overview
Fixes
hud deploy/ sync failures (TaskArgs is not fully defined) when env modules usefrom __future__ import annotationsand@env.templateparameters use rich types (Literal, aliases, Pydantic models, unions)._TaskFactorynow storesinspect.signature(func, eval_str=True)instead of a raw signature, sotask.sigexposes resolved runtime types for bothtasks.listargs JSON Schema (_args_json_schema) and wiretasks.startarg coercion (_coerce_argsinTaskRunner).Adds tests that postponed annotations produce correct manifest enums/
$ref/defaults and that a fullRuncoerces string wire args into typed template parameters.Reviewed by Cursor Bugbot for commit a6ac044. Bugbot is set up for automated code reviews on this repo. Configure here.