Skip to content

Commit 1188288

Browse files
Kasper JungeRalphify
authored andcommitted
workspace: record visible alias inline in _build_body
Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 2fda4f0 commit 1188288

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

workspace/ralphs/improve-codebase/coverage/_console_emitter.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# `_console_emitter.py` coverage
22

3-
Valid at: 3823019
3+
Valid at: 2fda4f0
44

55
## Recent changes
66

7+
- 2fda4f0 — inlined the `visible = self._scroll_lines[-_MAX_VISIBLE_SCROLL:]`
8+
local in `_LivePanelBase._build_body`. The alias was read exactly
9+
once, as the iterable of the very next `for line in visible:` loop.
10+
Collapsing to `for line in self._scroll_lines[-_MAX_VISIBLE_SCROLL:]:`
11+
matches the inline-alias pattern from 497c028 (`agent`), fc5e1cb
12+
(`total_in`), 52e0272 (`msg`), ce487d3 (`text`), and e1ad87a
13+
(`binary`). Behavior unchanged — each iteration still mutates the
14+
Text in place (`no_wrap` / `overflow`) before appending to `rows`,
15+
and the slice still materializes the last `_MAX_VISIBLE_SCROLL`
16+
items. No other `visible` locals remain in the class; the name is
17+
reused elsewhere in the module (fullscreen viewport height, scrollbar
18+
geometry) but all in unrelated scopes.
719
- 3823019 — narrowed `line = escape_markup(data["line"])` scope in
820
`_on_agent_output_line` past the
921
`if not isinstance(target, _IterationSpinner): return` guard. The

workspace/ralphs/improve-codebase/iterations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
One line per iteration: `<sha> <summary>`.
44

5+
2fda4f0 refactor: inline `visible` alias in `_LivePanelBase._build_body` — the `visible = self._scroll_lines[-_MAX_VISIBLE_SCROLL:]` local was read exactly once, as the iterable of the very next `for line in visible:` loop. Collapsing to `for line in self._scroll_lines[-_MAX_VISIBLE_SCROLL:]:` matches the inline-alias pattern from 497c028 / fc5e1cb / 52e0272 / ce487d3 / e1ad87a. Behavior unchanged — the slice still materializes the last `_MAX_VISIBLE_SCROLL` items, and each loop iteration still mutates the Text in-place (`no_wrap` / `overflow`) before appending to `rows`. Pinned by the broad `test_console_emitter.py` suite (peek-visible rendering paths).
6+
57
e1ad87a refactor: inline `binary` alias in `_supports_stream_json` — the local was assigned to `Path(cmd[0]).stem` and then read exactly once on the next line as `binary == CLAUDE_BINARY`. Collapsing to the chained form `Path(cmd[0]).stem == CLAUDE_BINARY` matches the already-inline sibling check in `_console_emitter.py:_is_claude_command` (`return Path(parts[0]).stem == CLAUDE_BINARY`) and the inline-alias pattern from ce487d3 / 52e0272 / 497c028 / fc5e1cb. Same behavior — `_supports_stream_json` still short-circuits on empty `cmd` first, and the final boolean result is unchanged. Pinned by `tests/test_agent.py::test_streaming_mode_used_for_claude` and the broader agent-selection tests.
68

79
c5ce11d refactor: inline `reason = state.status.reason` alias in `run_loop`'s `RUN_STOPPED` emit. The local was read exactly once as the `reason=` kwarg to `RunStoppedData(...)` on the next line; collapsing to `reason=state.status.reason` matches the inline-alias pattern from ce487d3 (`text`) / 52e0272 (`msg`) / 497c028 (`agent`) / fc5e1cb (`total_in`). Safe at this call site — the immediately-preceding `if state.status == RunStatus.RUNNING: state.status = RunStatus.COMPLETED` normalizes status to a terminal value (STOPPED / COMPLETED / FAILED), so the `RunStatus.reason` property's "non-terminal raises ValueError" guard cannot fire.

0 commit comments

Comments
 (0)