Repository navigation
feat(session-ui): flat execute layout and script diffs behind full_codemode - #66509
Conversation
There was a problem hiding this comment.
I couldn't check the UI visually, but I found nothing that would block a merge. The unit tests and type checks pass, and reading the code matches the description.
- Tests: in
packages/session-ui,bun test src/timeline/ src/timeline-next/ src/tools/passes 241 tests with 3 skipped, and 244 pass with--conditions=browser. - Type checks:
tsc -bis clean inpackages/session-uiandpackages/app. - Not run: the Playwright component specs, including the updated
session-timeline.spec.ts, because no browsers are installed here. I also didn't open the story, so I'm relying on your screenshots for the visuals.
What I traced in the code:
- Output placement: the key
scriptOutputLayoutbuilds for each change (messageID:partID) matches the idscriptFileFactOfgives that change. A script's changes always draw throughScriptChanges, as their own row or inside a context group, so a moved Output row always has a place to land. The execute renderer gets the partidfrom the existing props in both timelines. - Flag off: gating
placeFacts/placeFactOfis enough.activityFactsandcontextGroupFactsalready drop a script's file facts and count only the changes that were placed, so with the flag off scripts add nothing to "Edited N files", and direct edits still count. The flag is re-read reactively, so turning it on or off updates the timeline.
One behaviour change worth confirming on purpose: without full_codemode, script diffs disappear for everyone, while dev shows them today. The description says this is intended.
Public API: unchanged. The change reads the existing full_codemode flag from #66469 and only touches the internal session-ui and app packages.
There was a problem hiding this comment.
The new commit is a small CSS fix, and I see no problems with it. It only touches the flat (full_codemode) layout in the new timeline: the execute title now sits as far above its steps as the steps sit from each other (6px). The layout with the flag off doesn't change. I didn't render it, since there are no browsers here. My first review left no open threads, and there are no new concerns. Public API: unchanged.
There was a problem hiding this comment.
The new commit only changes CSS, and only for the flat (full_codemode) layout. I see no problems with it. In both timelines, the gap under the execute title now accounts for the difference between the title's and the steps' line heights, so the title's text sits as far above the first step's text as the steps sit from each other. The rules don't apply with the flag off. I didn't render it, since there are no browsers here. No earlier threads are open, and there are no new concerns. Public API: unchanged.
User decisions: - Add a storybook story that renders captured Code Mode states
User decisions: - Make the captured-states story match the real app's layout
User decisions: - Prototype showing a script's inner calls as top-level timeline rows, desktop only
User decisions: - Drop the unwrap-execute experiment
User decisions: - Execute is a static title, not collapsible - Steps listed under it without chevrons, aligned with the title
User decisions: - Add a captured story with many interleaved execute blocks and thoughts
…pace blocks apart User decisions: - Mute the Execute title and Output row - Step names in the UI font - More space between blocks, same tight spacing inside a block
User decisions: - Exactly equal space between top-level blocks
User decisions: - Execute block order: steps, then diffs, then Output
User decisions: - Gate the new execute layout on the server's full_codemode flag - Equal spacing between blocks stays ungated
User decisions: - Hide a Code Mode block's diffs when full_codemode is off
User decisions: - New timeline, full_codemode on: the gap below the Execute title matches the gap above Output
…text User decisions: - The Execute title's text sits as far above its first call as one call's text sits above the next
8671c00 to
d26ff26
Compare
User decisions: - Center the View code button on the flat Execute title's line
There was a problem hiding this comment.
This push is a clean rebase onto newer dev (all earlier commits unchanged) plus a 5-line CSS fix, and I see no problems. The fix only applies in the old timeline with full_codemode on: it moves the execute title's "View code" button up so it sits centred on the title text. On the rebased head, the session-ui timeline and tool tests pass and tsc -b reports no errors in session-ui and app. I didn't render it, since there are no browsers here. There are no new concerns. Public API: unchanged.
Issue for this PR
No issue. Builds on #66469 (
GET /api/experimental/flag).Type of change
What does this PR do?
Puts a new Code Mode (
execute) block layout behind the server'sfull_codemodeflag, read in session-ui withuseData().flag("full_codemode")(from #66469). Applies to both timelines (timelineandtimeline-next).full_codemodeonscriptOutputLayoutintimeline/script-output.ts.full_codemodeoffdev.factsOf/placeFactOf/placeFacts), with the flag passed in from the app's timeline controller andSessionTimeline. Directedit/write/patchcalls are unaffected.Ungated: blocks are spaced equally in both timelines (16px in the old timeline, 20px in the new one, measured box to box), with tight spacing inside a block. In the old timeline, title rows keep their 28px click area but take only their text height (6px padding taken back by margins, as the new timeline already does).
Story: adds "Code Mode / Captured states" (
packages/session-ui/src/timeline-next/stories/codemode-captured.stories.tsx). It renders real captured Code Mode sessions (drive runs against the real core and server) through the real timelines, with a scenario picker, a state stepper with Play, old/new/side-by-side timelines, detail presets, and afull_codemodetoggle. The fixtures inpackages/session-ui/src/storybook/codemode-snapshots/are about 144 KB of JSON (15 scenarios, 4–63 KB each, paths rewritten to/repo, the one 300 KB script literal replaced by the expression that builds it).The branch history includes an "unwrap execute" prototype commit and the commit that removes it; together they make no change.
How did you verify your code works?
tsc -binpackages/session-uiandpackages/app.bun test src/timeline/ src/timeline-next/ src/tools/in session-ui, plain and with--conditions=browser, including the reactivity tests. New tests:script-output.test.ts(Output moves only in the flat layout) and a facts test (with the flag off, a script's changes produce no file facts or counts; direct edits still do).session-tool-projection,session-lifecycle,tool-disclosure,session-timeline(43 pass).session-timeline.spec.tsis updated for the equal spacing.interleavedscenario in both timelines at Compact (groups open) and Detailed: every adjacent pair is equal.dev(story files copied onto anorigin/devworktree). The DOM matches; the only visual difference is the spacing.Screenshots / recordings
Compact, every summary group open, old | new timeline (
interleaved, final state)Before (

dev)After,

full_codemodeoffAfter,

full_codemodeonOne execute block, Detailed (
edits-patch)Compact, flag off, groups closed: group headers don't count script changes ("Ran 3 commands" rather than "Edited 7 files · 3 commands").

Checklist