Skip to content

flatten_tuple_return handles Return and Starred reader contexts - #360

Merged
trissim merged 1 commit into
mainfrom
claude/nra-engine-gaps-0kjz79
Nov 11, 2026
Merged

trissim merged 1 commit into
mainfrom
claude/nra-engine-gaps-0kjz79

Conversation

@trissim

@trissim trissim commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Two new reader-context handlers for FlattenTupleReturnOperation:

  • Return: return method() → return ((_r := method()),) if _r is not None else () — wraps the flattened result back into a tuple so the caller's contract is unchanged
  • Starred: *method() passthrough — the spread already extracts elements

Impact on agent-comms

Most of the 13 zero_one_tuple findings have callers using return method() (e.g., RuntimeReference.hidden at runtime_processes.py:310). Without the Return handler, the operation refused them. Now it can rewrite them.

Evidence

7/7 tests pass (6 existing + 1 new test_return_context_reader_wraps_in_tuple).


Generated by Claude Code

_rewrite_reader now handles two more patterns:
- Return: `return method()` wraps the flattened result back into a
  tuple using a walrus: `((_r := method()),) if _r is not None else ()`
- Starred: `*method()` in a tuple is a passthrough (no rewrite needed)

These unblock most of the 13 zero_one_tuple findings on agent-comms
where callers use `return method()` (e.g. RuntimeReference.hidden at
runtime_processes.py:310) or tuple spread.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dR7JdknxC8XJJtW8Uh
Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:21
@trissim
trissim merged commit d0131e7 into main Nov 11, 2026
6 of 10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

3 participants