Skip to content

Commit bc13035

Browse files
Kasper JungeRalphify
authored andcommitted
workspace: record line scope narrowing in _on_agent_output_line
Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 3823019 commit bc13035

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

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

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

3-
Valid at: d0060b3
3+
Valid at: 3823019
44

55
## Recent changes
66

7+
- 3823019 — narrowed `line = escape_markup(data["line"])` scope in
8+
`_on_agent_output_line` past the
9+
`if not isinstance(target, _IterationSpinner): return` guard. The
10+
escape_markup call was wasted work on the early-return path (target
11+
None or wrong-type panel); moving the binding after the guard keeps
12+
the _IterationSpinner branch behavior identical and drops the wasted
13+
work on the other branch. Same shape as 134078d's `name_col`
14+
narrowing — unconditional compute that only one branch consumes.
15+
Note: the `_structured_agent` short-circuit earlier in the method
16+
already skips this path for Claude runs (ad7523e), so this narrowing
17+
only affects the raw-stdout path.
718
- d0060b3 — added a public `outcome` property on `_LivePanelBase` and
819
replaced `source._outcome` in `_FullscreenPeek._build_header` with
920
`source.outcome`. Mirrors ef9a178's `iteration_id` cleanup — both

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+
3823019 refactor: narrow `line = escape_markup(data["line"])` scope past the early-return guard in `_on_agent_output_line` — the local was computed unconditionally inside `_console_lock` but only used on the `_IterationSpinner` branch; the `if not isinstance(target, _IterationSpinner): return` early-return path would have thrown the value away. Moving the binding below the guard preserves exactly the same output (same escape_markup call, same f-string, same add_scroll_line) while skipping the wasted work whenever target is None or an _IterationPanel. Same Phase 4 shape as 134078d (`name_col`), 7730dd4 (`secs`), ef176bf (`line_count`), 59b0e34 (`page`). Pinned by the raw-line handling tests in test_console_emitter.py.
6+
57
ce487d3 refactor: inline `text` alias in `_output.py:collect_output` — the local was assigned from `ensure_str(stream)` and read exactly once on the next line as `parts.append(text)`. Same alias-inline shape as fc5e1cb / 497c028 / 52e0272 — the `ensure_str` helper name already documents the decode step, so the intermediate binding was pure noise. Tests in `test_output.py` cover the str, bytes, and stdout+stderr-newline-join paths.
68

79
7730dd4 refactor: narrow `secs = total % _SECONDS_PER_MINUTE` scope into the `if minutes < _MINUTES_PER_HOUR:` branch in `_output.py:format_duration` — the local was computed unconditionally but only consumed by `f"{minutes}m {secs}s"` on the truthy branch. The hours branch derives `hours`/`mins` independently and never references `secs`, so the modulo was wasted work for any duration ≥ 1h. Same Phase 4 narrow-the-scope shape as 134078d (`name_col`), ef176bf (`line_count`), 59b0e34 (`page`), b19625e (`new_offset`). Tests in test_output.py cover both branches (sub-hour: lines 110–137; hour+: lines 140–144), so the move is pinned in either direction.

0 commit comments

Comments
 (0)