feat: AST-targeted id/name swap for delay control utterances - #186
Open
Ruari-Phipps wants to merge 1 commit into
Open
feat: AST-targeted id/name swap for delay control utterances#186Ruari-Phipps wants to merge 1 commit into
Ruari-Phipps wants to merge 1 commit into
Conversation
The make_pretty/from_pretty methods on Function now swap {{prefix:value}}
references only within @func_latency_control delay response messages,
using AST to precisely locate the string literals. This fixes a bug
where make_pretty silently discarded the swap (unused return value) and
scopes the from_pretty swap to delay control utterances instead of the
entire function code.
Also fixes validate() overwriting its resource_mappings parameter with
kwargs.get("resource_mappings") which was always None after the
signature change, and adds delay response reference validation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Coverage Report
Changed file coverage
|
Contributor
|
This pull request has been automatically marked as stale because it has not had any activity in 30 days. It will be closed in 7 days if no further activity occurs. If this is still in progress, please push an update or leave a comment. |
Collaborator
Author
|
WIP |
Contributor
|
This pull request has been automatically marked as stale because it has not had any activity in 30 days. It will be closed in 7 days if no further activity occurs. If this is still in progress, please push an update or leave a comment. |
Collaborator
Author
|
bump |
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
Scopes the
{{prefix:value}}reference swap inFunction.make_pretty/from_prettyto only delay control utterance messages, using AST to precisely locate the string literals within@func_latency_controldecorators.Motivation
make_prettyhad a bug:replace_resource_ids_with_namesreturn value was silently discardedfrom_prettyappliedreplace_resource_names_with_idsto the entire function code instead of only delay control messagesvalidate()had a bug whereresource_mappingsparameter was overwritten bykwargs.get("resource_mappings")(alwaysNoneafter the signature change)Changes
_swap_latency_control_referencesstatic method that uses AST to find@func_latency_controldecorator message strings and applies swap via positional replacementmake_prettyto use targeted swap (previously no-op due to unused return value)from_prettyswap to delay control utterances onlyvalidate()parameter shadowing bugDELAY_CONTROL_REFERENCESconstant and delay response reference validation invalidate()_swap_latency_control_referencescovering both directions, body isolation, edge cases, and roundtripTest strategy
poly <command>)Checklist
ruff check .andruff format --check .passpytestpassespolyCLI interface (or migration path documented)🤖 Generated with Claude Code