Skip to content

test(pty): observe highlight input responsiveness - #899

Merged
benvinegar merged 2 commits into
mainfrom
fix/pty-highlight-responsiveness-flake
Aug 29, 2026
Merged

benvinegar merged 2 commits into
mainfrom
fix/pty-highlight-responsiveness-flake

Conversation

@benvinegar

@benvinegar benvinegar commented Aug 29, 2026

Copy link
Copy Markdown
Member

Problem

The large-diff responsiveness PTY test times await session.press("down") and requires it to finish in under 500 ms. Tuistory implements press() by writing the key and then waiting up to 500 ms for terminal idleness, so normal timer overhead can produce results such as 500.4 ms. The elapsed time also does not prove Hunk processed the key: Tuistory resolves when its fallback timer expires.

This caused the unrelated CI failure observed on #896.

Approach

  • wait until generated source rows make the initial application paint observable;
  • immediately use Tuistory's non-waiting sendKey("pagedown");
  • require a later generated source row to enter the viewport within one second;
  • retain the eventual syntax-color assertion to prove worker highlighting completed.

The test now observes Hunk processing and painting navigation instead of measuring a dependency's idle timer. A synchronous multi-second highlighting regression still fails the bounded viewport assertion, while a legitimately faster worker does not fail a precondition.

No runtime code changes.

Validation

  • Focused responsiveness test: 20 consecutive passes
  • bun run test:integration — 135 passed, 1 platform skip
  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun run check:docs
  • bun run check:changelog
  • bun run deps:check
  • bun run test — 1,717 passed, 8 skipped, with one existing local environment failure in registerHostRuntimeModules > does not claim bare specifiers outside registered extension directories

This PR description was generated by Pi using GPT-5.6 Sol

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Preview Aug 29, 2026 3:35pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR revises the large-diff PTY responsiveness test to observe PageDown-driven viewport movement rather than Tuistory’s idle timer.

  • Captures the highest initially visible generated source-line index.
  • Sends PageDown without waiting for terminal idleness and waits for a later line to enter the viewport.
  • Retains the eventual syntax-highlighting assertion and adds an empty changeset.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking timing-dependence in the new pre-highlight assertion that could produce CI flakes on faster runners.

The viewport-based navigation check is stronger than the removed idle-timer measurement, but requiring highlighting to remain unfinished after a fixed 25 ms delay makes the test sensitive to worker completion speed.

Files Needing Attention: test/pty/highlighting.test.ts

Important Files Changed

Filename Overview
test/pty/highlighting.test.ts Replaces elapsed-time measurement with a viewport-change oracle, but adds a fixed-delay assertion that can fail when highlighting completes quickly.
.changeset/fair-baboons-tease.md Adds an empty changeset for this test-only modification.
Prompt To Fix All With AI
### Issue 1
test/pty/highlighting.test.ts:56-59
**Fixed delay races highlighting**

The assertion requires highlighting to remain incomplete after a fixed 25 ms delay, so a faster worker causes an otherwise healthy implementation to fail this integration test. Synchronizing on observable application state instead would avoid reintroducing a timing-dependent CI failure.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "test(pty): observe highlight input respo..." | Re-trigger Greptile

Comment thread test/pty/highlighting.test.ts Outdated
@benvinegar
benvinegar merged commit e23ba6e into main Aug 29, 2026
12 checks passed
@benvinegar
benvinegar deleted the fix/pty-highlight-responsiveness-flake branch August 29, 2026 15:43
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