Skip to content

refactor(code_gen): type LLM-Gateway options to drop cast() escape hatches#216

Merged
alexkroman merged 1 commit into
mainfrom
claude/remove-escape-hatches-7bw181
Jun 17, 2026
Merged

refactor(code_gen): type LLM-Gateway options to drop cast() escape hatches#216
alexkroman merged 1 commit into
mainfrom
claude/remove-escape-hatches-7bw181

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Introduce a GatewayOptions TypedDict (in code_gen/serialize.py) for the
prompt-chain options that code_gen.gateway_options builds and the transcribe/
stream renderers consume. Threading the typed shape end-to-end lets pyright/mypy
know llm["prompts"] is list[str], removing the two cast("list[str]", …)
calls in transcribe.py and stream.py. interval is NotRequired (transcribe
omits it; the streaming refresh-loop test deliberately exercises the absent case).

Also drops the # type: ignore[no-any-return] in the e2e helper by returning a
constructed dict instead of the bare json.loads result (no new Any token).

Net escape hatches: cast() 13->11, type:ignore/noqa/no-cover 20->19.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01FunrXSdcsWguki9hyeeMMe

…tches

Introduce a `GatewayOptions` TypedDict (in code_gen/serialize.py) for the
prompt-chain options that `code_gen.gateway_options` builds and the transcribe/
stream renderers consume. Threading the typed shape end-to-end lets pyright/mypy
know `llm["prompts"]` is `list[str]`, removing the two `cast("list[str]", …)`
calls in transcribe.py and stream.py. `interval` is `NotRequired` (transcribe
omits it; the streaming refresh-loop test deliberately exercises the absent case).

Also drops the `# type: ignore[no-any-return]` in the e2e helper by returning a
constructed dict instead of the bare `json.loads` result (no new `Any` token).

Net escape hatches: cast() 13->11, type:ignore/noqa/no-cover 20->19.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FunrXSdcsWguki9hyeeMMe
@alexkroman alexkroman enabled auto-merge June 17, 2026 04:42
@alexkroman alexkroman added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit 11e169c Jun 17, 2026
19 checks passed
@alexkroman alexkroman deleted the claude/remove-escape-hatches-7bw181 branch June 17, 2026 04:50
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.

2 participants