[codex] narrow template helper types - #162
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens internal template runtime helper type annotations to reduce Any usage (without changing runtime behavior), and refreshes the companion RFC with updated baseline counts and status.
Changes:
- Narrow helper contracts in
src/kida/template/helpers.pyby replacing provably-arbitraryAnywithobject, marking the strict undefined helper asNever, and preserving profiling pass-through types with PEP 695 generics. - Update
plan/rfc-template-helpers-any-reduction.mdto Active and record refreshed lexicalAnybaselines/success metrics for the #146 slice.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/kida/template/helpers.py | Narrows helper annotations (Any → object, Never for never-returning helper, generics for pass-through profiling). |
| plan/rfc-template-helpers-any-reduction.md | Refreshes RFC status and baseline counts / success criteria for the Any reduction slice. |
Comment on lines
+39
to
+43
| - `_raise_undefined_attr()` returns `Never`; | ||
| - `markup_concat()`, `coerce_numeric()`, lazy default/defined/coalescing helpers, | ||
| and `optional_call()` accept or return `object` where values are arbitrary; | ||
| - profiling pass-through helpers use a generic type so their result type is | ||
| preserved; |
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.
Summary
AnyRFC against the current source treeobjectNeverWhy
The RFC's old counts predated substantial runtime growth and no longer described the implementation. Internal helper contracts were also using
Anywhere a precise arbitrary-value or never-returning contract was available.Impact
This is type-only runtime refactoring. Helper behavior and public template context APIs are unchanged. The lexical
Anycount drops from 36 to 19 intemplate/helpers.pyand from 658 to 641 acrosssrc/kida.Validation
make lintmake tymake format-checkmake test(4,280 passed, 5 skipped)Steward Notes
Closes #146.