Skip to content

v0.2.9: scroll performance, themed startup, transparency, accurate slash commands, a real updater - #2

Merged
ayushap18 merged 1 commit into
mainfrom
v0.2.9
Sep 21, 2026
Merged

ayushap18 merged 1 commit into
mainfrom
v0.2.9

Conversation

@ayushap18

Copy link
Copy Markdown
Owner

Investigated first (six read-only root-cause probes), built one unit at a time, then attacked by four adversaries. Every number below was measured before the fix and is enforced by a test.

177 backend tests (was 153) · 49 frontend (was 37) · zero warnings.

Scroll lag — two measured causes

before after
Full frame, 200x50 1,270,609 B (127 B/cell) 310,795 B (31 B/cell)
Allocations, unchanged damage scan 10,000 0
Unchanged damage scan 247 µs 111 µs
Snap-to-bottom whole grid (480 cells) the diff (14)

The PTY reader also held the engine lock while serialising each frame, so scrolling queued behind a running command's output. Frames are now emitted outside the lock by one coalescing painter thread.

Startup

The window had no native background and CSS loaded only after 1.1 MB of wasm, so the canvas was measured at the browser default 300x150 and the shell spawned at ~35x8, then reflowed. The cursor was a hardcoded Tokyo Night grey in every theme — the engine computed a per-theme colour and never sent it.

Added

Window transparency (40–100%, default 100%) with all chrome and the approval bar fully opaque at every setting, enforced by a test. Updater: background check that never downloads, status-bar indicator, real progress, actionable failures, skip-this-version; the check is gone from the IPC surface.

What the adversaries found in this release's own work

Emitting frames outside the engine lock removed the only thing ordering them, so a resize racing a coalesced frame could deliver frames out of diff order — including the frame that paints an approval proposal. Fixed with an ordering lock before merge. They also found the manifest version reaching the status bar unsanitised.

Not verified

Nothing here has been seen running in the app; the GUI cannot be driven reliably on the build machine. Linux is verified by CI only.

…ash commands, a real updater

Six read-only root-cause investigations, then a strictly sequential build, then
four adversaries. Measured before fixing; every number is enforced by a test.

SCROLL. A full 200x50 frame was 1,270,609 bytes of JSON objects with one heap
allocation per cell; cells now travel as tuples with packed colours — 310,795
bytes, 31 B/cell — and an unchanged damage scan allocates nothing (was 10,000)
in 111 us (was 247). The PTY reader also held the engine lock while serialising
each frame, so a scroll queued behind a running command's output; one painter
thread now emits outside that lock, coalescing to one repaint per 8 ms. Snap to
bottom sends the diff, not the grid. The painter sets font and fill per style
run, not per glyph. The status-bar probes moved off the async runtime: four
calls against a wedged git took 8.5 s, serial.

STARTUP. No native window background, and CSS injected only after 1.1 MB of
wasm compiled — so the canvas was measured at the browser-default 300x150 and
the shell was SPAWNED at about 35x8, then reflowed. The native window is now
painted in the saved theme before the webview exists, the CSS is inline, and
the canvas is measured at its real size first. The cursor was a hardcoded Tokyo
Night grey in every theme; the engine computed the right colour and never sent
it. A test forbids hardcoded theme colours outside the two theme tables.

TRANSPARENCY. Opacity 40-100, default 100. Default-background cells clear; every
other background and all glyphs stay opaque. All chrome and the approval bar
stay fully opaque at every setting — a security control must never be hard to
read — enforced by a test.

UPDATER. /update claimed "latest version" when the check had failed. Install is
single-flight. A background check that never downloads, a status-bar indicator,
a real percentage, failure text that says what to do, skip-this-version. Notes
and version come from an unsigned manifest and are sanitised and capped. The
check left the IPC surface; the backend emits an event.

SLASH. Eight disagreements between the parsers, /help, the completer and the
README, fixed — and a test in each crate now parses the OTHER crate's source, so
they cannot drift silently.

FOUND BY THE ADVERSARIES IN THIS RELEASE'S OWN WORK: emitting outside the engine
lock removed the only thing ordering frames, so a resize racing a coalesced
frame could deliver them out of diff order — including the frame that paints an
approval proposal. An ordering lock, taken before the engine lock and held
across the emit, restores the total order without putting the reader back behind
serialisation.

153 -> 177 backend tests, 37 -> 49 frontend.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7bd3d105-3739-4f93-b1bb-3ce2b430c095


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Improve terminal performance, startup theming, and update workflows

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Reduces terminal frame size, allocations, lock contention, and redundant canvas work.
• Adds themed startup, configurable transparency, and accurate initial terminal sizing.
• Hardens slash-command consistency and delivers a secure, informative background updater.
Diagram

graph TD
  PTY["PTY Reader"] --> Engine["Terminal Engine"] --> Painter["Painter Thread"] --> Events["Tauri Events"] --> UI["Web UI"]
  Settings["Appearance Settings"] --> Window["Native Window"] --> UI
  Updater["Updater Watch"] --> Events
  Settings --> Engine
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Coalesce frames in the webview
  • ➕ Aligns repaint scheduling with browser animation frames
  • ➕ Avoids a dedicated native painter thread
  • ➖ Still serializes and transfers every backend frame
  • ➖ Does not remove engine-lock contention before IPC
  • ➖ Makes ordered diff delivery harder to guarantee across native emitters
2. Use a binary frame protocol
  • ➕ Could reduce payload size below packed JSON tuples
  • ➕ Avoids repeated JSON field and parsing overhead
  • ➖ Requires additional Tauri transport and decoding infrastructure
  • ➖ Increases compatibility and debugging complexity
  • ➖ The measured tuple format already meets the current frame budget
3. Move the engine into an actor
  • ➕ Serializes feed, resize, scroll, and paint operations by construction
  • ➕ Could eliminate global ordering and engine mutexes
  • ➖ Requires a broad rewrite of mature terminal and command paths
  • ➖ Introduces request-channel latency and shutdown complexity
  • ➖ Carries substantially greater release risk than the focused painter change

Recommendation: Keep the PR's coalescing native painter, compact tuple protocol, and explicit ordering lock. They directly address measured bottlenecks with limited architectural disruption; a terminal actor is worth considering only if future features substantially increase the number of concurrent engine operations.

Files changed (30) +1875 / -452

Enhancement (9) +1558 / -356
engine.rsCompact and optimize terminal damage frames +247/-28

Compact and optimize terminal damage frames

• Serializes cells as packed tuples, avoids allocations for unchanged cells, preserves snapshots when returning to the live view, and sends themed cursor colors. Adds payload, allocation, timing, coalescing, and diff-accuracy tests.

src-tauri/src/engine.rs

lib.rsAdd ordered coalesced painting and startup appearance persistence +512/-75

Add ordered coalesced painting and startup appearance persistence

• Moves frame emission to a coalescing painter outside the engine lock while preserving diff order, clamps total grid area, and moves blocking context probes off the async runtime. It also persists native theme and opacity, starts the updater watcher, removes updater IPC, aligns slash commands, and adds broad concurrency, security, startup, and parser tests.

src-tauri/src/lib.rs

update.rsBuild a secure background updater workflow +300/-46

Build a secure background updater workflow

• Replaces the updater IPC check with a periodic event-based watcher, distinguishes failed checks from current versions, sanitizes manifest content, and enforces single-flight installs. Adds throttled progress, actionable typed failures, and comprehensive security and behavior tests.

src-tauri/src/update.rs

main.cssSupport transparent pages and updater status styling +22/-12

Support transparent pages and updater status styling

• Removes duplicated theme defaults, makes the document backing transparent, sizes range controls, and styles the quiet update indicator.

ui/assets/main.css

app.rsPersist and apply opacity with startup-safe styling +49/-22

Persist and apply opacity with startup-safe styling

• Adds backward-compatible opacity settings, applies theme and opacity through one backend call, and inlines CSS before terminal measurement. Includes coverage ensuring existing saved settings remain fully opaque.

ui/src/app.rs

settings.rsAdd live window opacity control +23/-18

Add live window opacity control

• Adds a 40–100 percent opacity slider and delegates all appearance application and persistence to the central settings effect.

ui/src/settings.rs

status.rsShow skippable update availability in the status bar +82/-8

Show skippable update availability in the status bar

• Listens for sanitized update events, displays optional release notes, and persists skip-this-version choices. Adds coverage ensuring only the selected version is suppressed.

ui/src/status.rs

terminal.rsOptimize canvas painting and transparent terminal rendering +228/-118

Optimize canvas painting and transparent terminal rendering

• Decodes packed cells, clears default-background cells to expose the native backing, paints glyphs by style runs, and uses themed cursor and selection colors. It also fixes resize tracking, builds Vim snapshots on demand, removes frontend updater checks, and adds wire-format and rendering tests.

ui/src/terminal.rs

theme.rsCentralize theme colors and enforce opaque chrome +95/-29

Centralize theme colors and enforce opaque chrome

• Stops painting a webview background, keeps theme tokens centralized, and adds tests for inline CSS, opaque security surfaces, and stale source references.

ui/src/theme.rs

Bug fix (3) +121 / -31
release.mjsHarden release signature validation +9/-3

Harden release signature validation

• Accepts version metadata only from the authenticated minisign trusted comment and centralizes the first self-updating release used in generated notes.

scripts/release.mjs

local_models.rsAlign local-runtime usage strings +4/-4

Align local-runtime usage strings

• Standardizes '/local' documentation on the '<url>' argument name and simplifies test closure passing.

src-tauri/src/local_models.rs

complete.rsSynchronize and harden slash-command completion +108/-24

Synchronize and harden slash-command completion

• Adds the '/providers' alias, aligns MCP help, rejects candidates that cannot round-trip through placeholders, and verifies frontend, backend, runtime, and README command tables remain synchronized.

ui/src/complete.rs

Refactor (3) +26 / -26
ai_bar.rsReuse shared provider invocation arguments +5/-10

Reuse shared provider invocation arguments

• Moves the provider ID argument shape to the shared bridge module and removes obsolete prototype references.

ui/src/ai_bar.rs

bridge.rsCentralize fire-and-forget bridge calls +17/-7

Centralize fire-and-forget bridge calls

• Introduces shared provider ID arguments and a generic fire helper used by clipboard and display-only terminal writes.

ui/src/bridge.rs

palette.rsReuse shared provider argument types +4/-9

Reuse shared provider argument types

• Removes a duplicate provider ID payload type and updates stale module documentation.

ui/src/palette.rs

Tests (2) +29 / -0
release.test.mjsTest rejection of unauthenticated version metadata +9/-0

Test rejection of unauthenticated version metadata

• Verifies that a version placed only in minisign's untrusted comment cannot satisfy release validation.

scripts/release.test.mjs

mcp_server.rsVerify MCP context disclosure documentation +20/-0

Verify MCP context disclosure documentation

• Adds a test ensuring every field returned by the unapproved 'get_context' tool remains explicitly documented in the threat model.

src-tauri/src/mcp_server.rs

Documentation (7) +128 / -31
CHANGELOG.mdDocument the v0.2.9 release +63/-0

Document the v0.2.9 release

• Adds measured performance results and documents startup, transparency, updater, slash-command, and security changes.

CHANGELOG.md

README.mdRefresh installers and slash-command documentation +15/-8

Refresh installers and slash-command documentation

• Updates download examples to v0.2.9 and aligns documented slash commands, aliases, MCP forms, and help with the implemented grammar.

README.md

architecture.mdDescribe the new rendering, appearance, and updater architecture +36/-11

Describe the new rendering, appearance, and updater architecture

• Documents packed grid cells, coalesced ordered painting, startup theming, opacity persistence, and the event-driven updater workflow.

docs/architecture.md

danger-gate.mdUpdate updater and MCP threat models +6/-5

Update updater and MCP threat models

• Clarifies that no updater command is exposed through IPC and enumerates every unapproved MCP context field.

docs/danger-gate.md

main.rsClarify updater signing tool lifecycle +3/-2

Clarify updater signing tool lifecycle

• Repositions the maintenance note without changing signing behavior.

tools/sign-updater/src/main.rs

blocks.rsRefresh block navigator documentation +3/-3

Refresh block navigator documentation

• Removes stale references to the deleted TypeScript prototype and clarifies stable block identification.

ui/src/blocks.rs

vim.rsRemove stale Vim prototype references +2/-2

Remove stale Vim prototype references

• Updates module and dispatcher documentation to reference the current Rust implementation only.

ui/src/vim.rs

Other (6) +13 / -8
package.jsonBump application package version to 0.2.9 +1/-1

Bump application package version to 0.2.9

• Updates the root package version for the release.

package.json

Cargo.lockLock backend package version at 0.2.9 +1/-1

Lock backend package version at 0.2.9

• Updates the resolved Tachyon backend package version.

src-tauri/Cargo.lock

Cargo.tomlEnable native transparency support +4/-2

Enable native transparency support

• Bumps the backend crate version and enables Tauri's macOS private API feature required for transparent WKWebView rendering.

src-tauri/Cargo.toml

tauri.conf.jsonConfigure the transparent v0.2.9 window +5/-2

Configure the transparent v0.2.9 window

• Bumps the application version and enables native transparency, macOS private APIs, and a themed default window background.

src-tauri/tauri.conf.json

Cargo.lockLock frontend package version at 0.2.9 +1/-1

Lock frontend package version at 0.2.9

• Updates the resolved Tachyon UI package version.

ui/Cargo.lock

Cargo.tomlBump frontend crate version to 0.2.9 +1/-1

Bump frontend crate version to 0.2.9

• Updates the standalone UI crate version for the release.

ui/Cargo.toml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Security guide hides update access 🐞 Bug ⚙ Maintainability
Description
docs/danger-gate.md says no updater command exists on the IPC surface even though the registered
run_slash command routes /update to update::slash. The mismatch hides a webview-reachable
network operation from maintainers auditing the documented trust boundary, although installation
remains native-menu-only.
Code

docs/danger-gate.md[R75-76]

+- *No updater command exists on the IPC surface at all.* `generate_handler!` names nothing from
+  `update.rs`; the background check is a Rust task that does an HTTPS GET and a version compare
Evidence
The changed guide makes an absolute claim about the IPC surface, but run_slash is registered as a
Tauri command and explicitly invokes update::slash. That function performs the updater check for
/update and rejects only the install variant.

docs/danger-gate.md[72-80]
src-tauri/src/lib.rs[2195-2205]
src-tauri/src/lib.rs[2683-2721]
src-tauri/src/update.rs[154-168]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The danger-gate documentation incorrectly states that no updater command exists on the IPC surface. The generic `run_slash` IPC command still exposes `/update` checking through `update::slash`, while only installation is excluded from IPC.

## Fix Focus Areas
- docs/danger-gate.md[75-79]
- src-tauri/src/lib.rs[2195-2205]
- src-tauri/src/lib.rs[2683-2721]
- src-tauri/src/update.rs[154-168]

## Recommended Fix
Clarify that there is no dedicated updater handler and no IPC-accessible installation path, but that webview code can invoke an update check indirectly through the registered `run_slash` command. Retain the explanation that `/update install` is rejected and installation requires a native menu event.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Explicit black backgrounds turn transparent 🐞 Bug ≡ Correctness
Description
Term::draw_line clears every cell whose resolved background RGB equals self.bg, because the wire
contract loses whether the colour came from the terminal default or an explicitly selected ANSI/RGB
background. When transparency is enabled under the Matrix theme, where both the default background
and ANSI black are [0, 0, 0], programs that explicitly request an opaque black background instead
render those cell areas see-through at reduced window opacity.
Code

ui/src/terminal.rs[R326-331]

+            if bg == self.bg {
+                self.ctx.clear_rect(x, y, ex + ew - x, h);
+            } else {
+                self.ctx.set_fill_style_str(&css(bg));
+                self.ctx.fill_rect(x, y, ex + ew - x, h);
+            }
Evidence
The engine resolves default and indexed backgrounds to plain RGB values before serialization, losing
their origin, and the renderer then clears runs based only on equality with self.bg; the nearby
comment explicitly acknowledges that backgrounds matching the theme are treated as transparent.
Matrix makes this path reachable by assigning black to both the default terminal background and ANSI
color zero.

ui/src/terminal.rs[305-331]
src-tauri/src/engine.rs[175-190]
ui/src/theme.rs[93-97]
src-tauri/src/engine.rs[103-110]
src-tauri/src/engine.rs[176-185]
src-tauri/src/engine.rs[264-283]
ui/src/terminal.rs[308-330]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The renderer cannot distinguish the default terminal background from an explicitly selected ANSI or RGB colour after both are resolved to RGB. As a result, `draw_line` clears explicit backgrounds that match the theme background, making cells transparent when they should remain opaque.

## Fix Focus Areas
- src-tauri/src/engine.rs[27-58]
- src-tauri/src/engine.rs[264-283]
- src-tauri/src/engine.rs[307-348]
- ui/src/terminal.rs[27-52]
- ui/src/terminal.rs[305-331]
- ui/src/terminal.rs[326-330]

## Recommended Fix
Add a background-origin flag to the cell wire contract that records whether the effective painted background is the terminal default, including when inverse video affects the effective background. Update the Rust serializer and frontend deserializer to carry this flag, then make `draw_line` call `clear_rect` only for default-background cells and use `fill_rect` for every explicitly selected ANSI or RGB background, even when its resolved RGB value equals the theme background. Update the related serializer, deserializer, and rendering tests together.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: 🧠 Deep: This is a dense, cross-cutting change spanning engine concurrency, updater/security-adjacent IPC, UI state, and release behavior, with 152 edit sites and multiple independent high-impact paths where redundant review could catch subtle defects.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread docs/danger-gate.md
Comment on lines +75 to +76
- *No updater command exists on the IPC surface at all.* `generate_handler!` names nothing from
`update.rs`; the background check is a Rust task that does an HTTPS GET and a version compare

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Security guide hides update access 🐞 Bug ⚙ Maintainability

docs/danger-gate.md says no updater command exists on the IPC surface even though the registered
run_slash command routes /update to update::slash. The mismatch hides a webview-reachable
network operation from maintainers auditing the documented trust boundary, although installation
remains native-menu-only.
Agent Prompt
## Issue description
The danger-gate documentation incorrectly states that no updater command exists on the IPC surface. The generic `run_slash` IPC command still exposes `/update` checking through `update::slash`, while only installation is excluded from IPC.

## Fix Focus Areas
- docs/danger-gate.md[75-79]
- src-tauri/src/lib.rs[2195-2205]
- src-tauri/src/lib.rs[2683-2721]
- src-tauri/src/update.rs[154-168]

## Recommended Fix
Clarify that there is no dedicated updater handler and no IPC-accessible installation path, but that webview code can invoke an update check indirectly through the registered `run_slash` command. Retain the explanation that `/update install` is rejected and installation requires a native menu event.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread ui/src/terminal.rs
Comment on lines +326 to +331
if bg == self.bg {
self.ctx.clear_rect(x, y, ex + ew - x, h);
} else {
self.ctx.set_fill_style_str(&css(bg));
self.ctx.fill_rect(x, y, ex + ew - x, h);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Explicit black backgrounds turn transparent 🐞 Bug ≡ Correctness

Term::draw_line clears every cell whose resolved background RGB equals self.bg, because the wire
contract loses whether the colour came from the terminal default or an explicitly selected ANSI/RGB
background. When transparency is enabled under the Matrix theme, where both the default background
and ANSI black are [0, 0, 0], programs that explicitly request an opaque black background instead
render those cell areas see-through at reduced window opacity.
Agent Prompt
## Issue description
The renderer cannot distinguish the default terminal background from an explicitly selected ANSI or RGB colour after both are resolved to RGB. As a result, `draw_line` clears explicit backgrounds that match the theme background, making cells transparent when they should remain opaque.

## Fix Focus Areas
- src-tauri/src/engine.rs[27-58]
- src-tauri/src/engine.rs[264-283]
- src-tauri/src/engine.rs[307-348]
- ui/src/terminal.rs[27-52]
- ui/src/terminal.rs[305-331]
- ui/src/terminal.rs[326-330]

## Recommended Fix
Add a background-origin flag to the cell wire contract that records whether the effective painted background is the terminal default, including when inverse video affects the effective background. Update the Rust serializer and frontend deserializer to carry this flag, then make `draw_line` call `clear_rect` only for default-background cells and use `fill_rect` for every explicitly selected ANSI or RGB background, even when its resolved RGB value equals the theme background. Update the related serializer, deserializer, and rendering tests together.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@ayushap18
ayushap18 merged commit 80a2a51 into main Sep 21, 2026
3 checks passed
@ayushap18
ayushap18 deleted the v0.2.9 branch September 21, 2026 19:00
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