Skip to content

glitter: whole-binary pty gate, pty flake fix, and doc drift - #356

Merged
m4ttheweric merged 5 commits into
mainfrom
glitter-pty-gate-and-docs
Sep 21, 2026
Merged

m4ttheweric merged 5 commits into
mainfrom
glitter-pty-gate-and-docs

Conversation

@m4ttheweric

@m4ttheweric m4ttheweric commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

What

RT-220 — a whole-binary gate for rt glitter. Everything under it was previously gated with something faked on one side: the Go render tests script the driver, the compose test scripts the session. e2e/tests/glitter-pty.test.ts runs the real compiled rt spawning the real rt-ui over a pty and asserts git state after each step, never rendered text.

It covers four paths: the board opens on the tree git actually has; space unchecks the cursor's file and the commit omits it while leaving it modified; a git add done behind the board's back is discarded by the commit-time index rebuild (the GHD model, asserted rather than documented); and u undoes the commit and keeps the work.

Screen text appears only in waits, and every wait keys on a state transition the board paints after the driver returns from git (Commit N files), so there are no sleeps to tune. Five consecutive local runs, 20/20 assertions.

I verified it actually catches regressions rather than assuming: changing the space keybinding's payload from toggle-file to toggle-hunk fails two of the four tests.

Reused e2e/interactive.ts (termwright), which was already in the repo and already installed by the e2e workflow, rather than adding a second pty harness. It gained one method, raw(bytes), for key encodings press/ctrl cannot express — the board negotiates the Kitty keyboard protocol, so ctrl+enter is a CSI-u sequence.

The pty flake, fixed at the cause. TestTextInputDrawsOneChevronPrompt failed CI on rt#354 with an empty painted screen. runPTY's paint predicate returned true on the first pty byte, but terminal setup (alt screen, cursor hide, Kitty keyboard push) arrives before any cell is drawn. Instrumented on an idle machine, it released 1.4–4.2ms early; the keys loop's 30ms delay absorbed that locally but not under CI load, where a key landed pre-paint, the program quit, and the assertion ran against a blank screen. The predicate now replays the buffer and requires a non-blank screen.

RT-192 — doc drift. The README claimed rt git commit has a "live diff preview" that commands/commit.ts explicitly denies. rt git reset soft|hard both target HEAD, which reads as "undo my commit". Beyond what the ticket listed, rt git undo and rt glitter had both shipped with no README entry at all, so the intended "point at rt git undo" fix had nowhere to point. Added both, and put the rt git undo steer into the reset command descriptions so it reaches --help and the picker too.

CI. The e2e job now sets up Go, since the gate drives the real rt-ui. The gate lives in the existing e2e job, which is already required.

Verification

Run from the worktree:

  • go vet ./... clean; go test -count=1 ./... clean; prompt package green over -count=10.
  • bunx tsc --noEmit clean; bash scripts/repo-purity.sh ok.
  • bun run test:e2e: 129 pass (4 new), 1 fail — user plugins > rt plugin new, which fails identically on main (a broken local mise node shim in the test's sanitized env, unrelated to this branch).

Closes RT-192, closes RT-220.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Clarified the effects of soft and hard Git resets.
    • Added documentation for undoing commits with rt git undo.
    • Updated commit guidance to cover interactive staging and file statistics.
    • Added usage details for the interactive rt glitter terminal board, including staging, diffs, history, branches, commits, and interactive requirements.
  • Tests

    • Expanded end-to-end coverage for interactive Git workflows, including staging changes and undoing commits while preserving working-tree edits.

m4ttheweric and others added 3 commits September 21, 2026 09:34
…nd glitter

README claimed `rt git commit` has a live diff preview; it has never had one.
`rt git reset soft|hard` both target HEAD, which reads as "undo my commit" to
anyone who has not used them. `rt git undo` and `rt glitter` both shipped
without a README entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Drives the compiled rt spawning the real rt-ui, asserting git state after
each step rather than rendered text. Screen text appears only in waits, and
every wait keys on a state transition the board paints after the driver
returns from git, so there are no fixed sleeps to tune.

Verified it catches regressions: changing the space keybinding's payload
from toggle-file to toggle-hunk fails two of the four tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Terminal setup (alt screen, cursor hide, the Kitty keyboard push) reaches
the pty before any cell is drawn, so the old predicate released while the
screen was still blank. Measured on an idle machine it fired 1.4-4.2ms
early; the keys loop's 30ms delay absorbed that locally but not under CI
load, where a key landed pre-paint, the program quit, and the assertion ran
against an empty screen. That is the TestTextInputDrawsOneChevronPrompt
failure seen on rt#354.

The predicate now replays the buffer and requires a non-blank screen. The
no-paint deadline goes to 10s since it is now waiting on a real paint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Warning

Review limit reached

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 79 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: fee6ae52-7393-4e77-9e59-b86afbcd7feb

📥 Commits

Reviewing files that changed from the base of the PR and between 6a52577 and de517c3.

📒 Files selected for processing (6)
  • .github/workflows/e2e.yml
  • e2e/pty/glitter.test.ts
  • package.json
  • website/docs/reference/git/reset/hard.mdx
  • website/docs/reference/git/reset/index.mdx
  • website/docs/reference/git/reset/soft.mdx

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 531d474e-4900-4301-8825-84780da61348

📥 Commits

Reviewing files that changed from the base of the PR and between 3dbf5b9 and 6a52577.

📒 Files selected for processing (7)
  • .github/workflows/e2e.yml
  • README.md
  • e2e/glitter-repo.ts
  • e2e/interactive.ts
  • e2e/tests/glitter-pty.test.ts
  • lib/command-tree-def.ts
  • ui/internal/testutil/ptyrun.go

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The change adds an isolated Git fixture and PTY tests for rt glitter. It adds raw terminal input support, improves PTY readiness detection, updates command documentation, and configures Go setup for macOS E2E tests.

Changes

Glitter PTY coverage

Layer / File(s) Summary
Isolated Git repository fixture
e2e/glitter-repo.ts
Creates a temporary repository with staged, unstaged, deleted, and untracked changes. It exposes Git execution, log lookup, staged-file listing, and cleanup operations.
Interactive transport and PTY validation
e2e/interactive.ts, ui/internal/testutil/ptyrun.go, e2e/tests/glitter-pty.test.ts, .github/workflows/e2e.yml
Adds raw PTY byte input, uses painted screen content for readiness, extends the readiness timeout, and tests checkbox-driven staging, commits, and undo behavior. The macOS E2E job derives Go setup from ui/go.mod and caches with ui/go.sum.
Command documentation
README.md, lib/command-tree-def.ts
Documents reset behavior, rt git undo, commit file statistics, and the rt glitter terminal board. Command descriptions distinguish preserving edits from discarding working-tree changes.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant glitter-pty.test as glitter-pty.test
  participant TermwrightSession
  participant rt-glitter as rt glitter
  participant GitRepository as Git repository
  glitter-pty.test->>TermwrightSession: Send Kitty keyboard and raw PTY input
  TermwrightSession->>rt-glitter: Forward terminal bytes
  rt-glitter->>GitRepository: Read and update repository state
  rt-glitter-->>TermwrightSession: Draw updated board
  TermwrightSession-->>glitter-pty.test: Return painted screen state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main changes: the whole-binary PTY gate, the PTY flake fix, and documentation updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

m4ttheweric and others added 2 commits September 21, 2026 10:10
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The gate needs Go and an rt-ui build the other e2e tests never touch, which
put ~60s of setup on every PR. It moves to e2e/pty/ and its own job, gated
on a changed-path filter, so the cost lands only where the board can break
and an inapplicable run reads as a skipped check rather than a silent pass.

The filter is every input the board is built from, not just ui/: the driver,
the command, and git-core are TypeScript, and both bugs this gate was
written after were TypeScript with no Go diff. Checked against real ranges:
rt#354 (TS-only glitter fix) runs it, the RT-192 docs commit does not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@m4ttheweric
m4ttheweric merged commit 1d22fa0 into main Sep 21, 2026
8 of 9 checks passed
@m4ttheweric
m4ttheweric deleted the glitter-pty-gate-and-docs branch September 21, 2026 15:39
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.

1 participant