Skip to content

Commit 3330b37

Browse files
Kasper JungeRalphify
authored andcommitted
workspace: record outcome property refactor on _LivePanelBase
Iteration note, coverage update, and backlog entry for d0060b3 — the ef9a178-style public-property substitution applied to the remaining `source._outcome` cross-class access in the fullscreen header. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent d0060b3 commit 3330b37

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

workspace/ralphs/improve-codebase/backlog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ the handful of remaining single-site `2`s are flagged below with
8080
- (134078d — narrowed `name_col` scope in `_IterationPanel._apply_assistant`
8181
so the padded name column is only computed on the branch that renders
8282
it.)
83+
- (d0060b3 — exposed `_LivePanelBase.outcome` as a public property and
84+
switched `_FullscreenPeek._build_header`'s `source._outcome` read to
85+
go through it. Mirror of ef9a178's `iteration_id` cleanup.) Two
86+
private-attr cross-class reads remain — both of `source._scroll_lines`
87+
in `_FullscreenPeek._max_offset` and `__rich_console__`. Those touch a
88+
mutable list the class itself appends to, so a read-only property
89+
would hide the mutation asymmetry; defer unless a clearer abstraction
90+
emerges (e.g., a "get a snapshot of visible lines" helper).
8391
- `_IterationPanel._apply_assistant` still juggles three block types
8492
(`thinking` / `text` / `tool_use`) in one ~50-line method. Splitting
8593
into `_render_thinking_block` / `_render_text_block` / `_render_tool_use_block`

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

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

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

55
## Recent changes
66

7+
- d0060b3 — added a public `outcome` property on `_LivePanelBase` and
8+
replaced `source._outcome` in `_FullscreenPeek._build_header` with
9+
`source.outcome`. Mirrors ef9a178's `iteration_id` cleanup — both
10+
commits expose an existing private attribute through a getter so the
11+
cross-class read doesn't have to dip into private state. The
12+
`_outcome` attribute is still the single source of truth (written
13+
only in `freeze`), and tests that read `_outcome` directly
14+
(test_console_emitter.py:1766) keep working. Two private-attr
15+
cross-class reads remain in the module (`source._scroll_lines` at
16+
lines 750 and 872); those touch a mutable list that the class itself
17+
appends to, so a read-only property would paper over the mutation
18+
asymmetry — not taking until a real need appears.
719
- 3a8908d — replaced the `if initial_id is None and self._iteration_history:`
820
guard in `enter_fullscreen` with `next(reversed(self._iteration_history), None)`.
921
The compound condition was doing two jobs at once: pick the fallback only
@@ -116,6 +128,7 @@ Valid at: 3a8908d
116128
`_FullscreenPeek` already exposes this via an `@property` (line 739-741);
117129
the private-attribute shortcut was an oversight from earlier iterations.
118130
Now `_iteration_id` is only read from within `_FullscreenPeek` itself.
131+
(d0060b3 applied the same pattern to `_LivePanelBase._outcome`.)
119132
- c4469a1 — extracted `_FullscreenPeek._step_iteration(direction)` from
120133
`prev_iteration` / `next_iteration`. The two methods were 12-line
121134
mirror images differing only in step direction (-1 vs +1) and

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+
d0060b3 refactor: replace `source._outcome` cross-class access with public `outcome` property on `_LivePanelBase` — `_FullscreenPeek._build_header` was reading the private attribute directly on its `source` panel. Added an `@property outcome` that returns `self._outcome`, matching the `iteration_id` property pattern from ef9a178 (which cleaned up the parallel `_fullscreen_view._iteration_id` cross-class access). The two remaining cross-class private reads on `_LivePanelBase` (`source._scroll_lines` at lines 750 and 872) read a mutable list that's also appended to from within the class, so a read-only property would mask the asymmetry — leaving those alone until a real need appears. Same observable behavior — `_outcome` is still the single source of truth written by `freeze`, and all existing readers get the same value. The direct `panel_before._outcome == "completed"` assertion in test_console_emitter.py:1766 still passes (underlying attribute is unchanged); fullscreen-header rendering paths exercise the new property transitively.
6+
57
cf72fd9 refactor: replace `parsed = None` sentinel with try/except/else in `_read_agent_stream` — the sentinel only existed so that `isinstance(parsed, dict)` on the next line would fall through on JSON-parse failure. Moving the dict-handling into the try/else branch expresses "only run when parse succeeded" structurally and drops both the sentinel assignment and the redundant isinstance check on the error path. Behavior preserved — valid-but-non-dict JSON (lists, numbers, strings) still skips forwarding via the inner isinstance guard. Same sentinel→structure shape as prior Phase 4 scope narrowings, applied one level up.
68

79
a6f4c47 refactor: drop redundant BOM-startswith guard before `removeprefix` in `parse_frontmatter``str.removeprefix` already returns the string unchanged when the prefix is absent, so the `if text.startswith(_UTF8_BOM):` wrapper was dead defensive code. Behavior preserved — `test_utf8_bom_does_not_break_frontmatter` still pins the BOM-stripping path and every other test exercises the no-BOM path. Same "drop the guard when the operation already handles the no-match case" shape as 5337d88 (empty dict → `" · ".join([])`), 4ccfa9a (empty list → `" · ".join([])`), and 8cb0d47 (redundant `max(..., 1)` floor).

0 commit comments

Comments
 (0)