Skip to content

Commit f7cd4bf

Browse files
committed
docs(types): note runtime/type mismatch on act format= overloads
The format= overloads narrow the thunk's generic element type, observable on parsed_repr (S | None), not on .value — ComputedModelOutputThunk.value is typed `-> str` unconditionally. parsed_repr also currently routes through Instruction._parse (returns str), so parsed_repr.some_field type-checks but AttributeErrors at runtime: the same silent-failure shape generative-computing#1274 set out to fix, relocated to parsed_repr. Add a TODO pointing at the coordinated .parsed redesign (PR generative-computing#1282) as the proper fix, out of scope here. PR body updated to match (was claiming .value narrows to MyModel). Assisted-by: Claude Code
1 parent 290cf23 commit f7cd4bf

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mellea/stdlib/session.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,14 @@ def cleanup(self) -> None:
390390

391391
deregister_session_plugins(self.id)
392392

393+
# The format= overloads below narrow the thunk's generic element type. That narrowing
394+
# is observable on `parsed_repr: S | None`, NOT on `.value` — ComputedModelOutputThunk.value
395+
# is typed `-> str` unconditionally (mellea/core/base.py). There is also a runtime gap:
396+
# parsed_repr currently goes through Instruction._parse, which returns a plain str, so
397+
# `result.parsed_repr.some_field` type-checks but raises AttributeError at runtime.
398+
# TODO: a coherent end state has the thunk's `.parsed` generic over S backed by a runtime
399+
# path that delivers S. That is a coordinated change tracked by PR #1282 and is out of
400+
# scope here; these overloads only land the static format= narrowing where they can.
393401
@overload
394402
def act(
395403
self,

0 commit comments

Comments
 (0)