Skip to content

[CTX-1370] feat(vt): advertise resolved terminal font (kitty DCS + +show-font) - #2277

Merged
Xuepoo merged 2 commits into
mainfrom
ctx-1370/feat-font-query
Oct 20, 2026
Merged

Xuepoo merged 2 commits into
mainfrom
ctx-1370/feat-font-query

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: term | Labels: feat,P1,area:term | Milestone: 0.0.24 | RFC: N/A | Task: CTX-1370

Closes #2263

Summary

Advertise Bitty's resolved terminal font to detectors through two independent, read-only paths:

  • Kitty font DCS query (ESC P +q <hex-key>[;<hex-key>] ST, also APC): the parser classifies the bounded payload and the runtime answers kitty-query-font_family / kitty-query-font_size with the live resolved config, using the existing bounded Reply channel. The raw query is never echoed and no second PTY write path exists.
  • bitty +show-font: prints font_family: <family>, font_size: <points>, and optional font_fallback: lines from the same merged config startup uses; read-only, headless, and it creates no runtime/window/PTY/IPC/plugin VM.

The upstream fastfetch change is fastfetch-cli/fastfetch#2660 (Xuepoo:terminalfont-bitty), which queries Bitty with the kitty font DCS and falls back to bitty +show-font on non-Windows.

Review findings addressed (independent review at 5e083e59)

  • F1 (blocking) — fixed. One classification contract (classify_dcs_query_body returning font / reserved-font / XTGETTCAP) is now shared by the parser and find_xtgettcap. A mixed capability+font payload can no longer be both answered as a font query and left in the XTGETTCAP queue; the following Co query is answered as Co, never TN. Regressions: classification_is_shared_for_mixed_capability_and_font_payloads, find_xtgettcap_skips_a_mixed_font_payload_and_keeps_alignment, and the end-to-end mixed_font_and_capability_query_keeps_the_xtgettcap_queue_aligned.
  • F2 (blocking) — fixed. Tests now exercise both real caps: a 300-hex / 150-decoded-byte body, a 258-hex / 129-byte single token, and a >512-byte payload whose individual tokens are valid. The parser also proves recovery after an over-cap payload. The three review mutations (wire cap, decoded cap, XTGETTCAP skip) now fail (recording/ctx-1370-font-query/mutations/results.tsv, 3/3 caught).
  • F3 — corrected. Reply order is documented as fixed family→size (the action carries booleans, not request order), matching fastfetch's canonical request.
  • F4 — documented. The DCS path follows the live RuntimeConfig; +show-font is a new process reading the config file. After a live zoom they can differ until the file is updated; the live value is what the running terminal uses.
  • F5 — documented. ShowFontError::Unavailable / exit 3 remains defense-in-depth; config validation rejects unusable values at load time, so the CLI path reports exit 2. The usage text lists only reachable codes.

Verification (pre-rebase commit 75d64802, re-checked after rebase onto origin/main 00b20089)

Gate Command Result
fmt cargo fmt --all -- --check pass
check cargo check --workspace --all-targets --locked pass
clippy cargo clippy --workspace --all-targets --locked -- -D warnings pass
nextest cargo nextest run -p bitty-vt -p bitty-runtime -p bitty-terminal --locked 3975 passed, 1 skipped
Windows cargo check --target x86_64-pc-windows-gnu --workspace --all-targets --locked pass
mutations wire cap / decoded cap / finder skip 3/3 caught

Post-rebase focused re-run: 33 kitty/finder/terminal-query tests pass, including the mixed-payload integration test.

Scope and residual

  • No new capability, privilege, or network/filesystem path: the DCS reply uses the existing bounded reply channel; +show-font only loads config.
  • Values are configuration-owned; terminal state stays inert for the new action.
  • No security-closure or release claim.

Evidence (ignored, on-disk): recording/ctx-1370-font-query/evidence.md, recording/ctx-1370-font-query/review/review.md, recording/ctx-1370-font-query/mutations/.

@Xuepoo Xuepoo added this to the 0.0.24 milestone Oct 19, 2026
@Xuepoo Xuepoo added feat Feature P1 Priority: high area:term Area: terminal state / VT labels Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 59a71db5-c230-4881-b199-0dbc2f6e947a
📥 Commits

Reviewing files that changed from the base of the PR and between 00b2008 and 99d5bb2.

📒 Files selected for processing: 15
  • crates/bitty-runtime/src/queries.rs
  • crates/bitty-runtime/src/runtime/pty.rs
  • crates/bitty-runtime/tests/pty_reply.rs
  • crates/bitty-runtime/tests/terminal_queries.rs
  • crates/bitty-term-state/src/state.rs
  • crates/bitty-terminal/src/cli.rs
  • crates/bitty-terminal/src/main.rs
  • crates/bitty-terminal/src/show_font.rs
  • crates/bitty-terminal/tests/cli_show_font.rs
  • crates/bitty-vt/src/action.rs
  • crates/bitty-vt/src/kitty_font_query.rs
  • crates/bitty-vt/src/lib.rs
  • crates/bitty-vt/src/parser.rs
  • crates/bitty-vt/src/parser/dispatch.rs
  • crates/bitty-vt/src/parser/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Xuepoo added a commit that referenced this pull request Oct 20, 2026
… wall-clock expiry (#2281)

`FsListBackend::list` spends the accepted RC-1 50 ms budget on the whole
call and checks the deadline at walk index 0. Every cap, containment, and
security test called it, so a saturated runner only had to burn 50 ms in
pre-scan work (grant matching, canonicalization, `read_dir`) plus
scheduling jitter for a tiny fixture listing to abort with `E_TIMEOUT`
before reaching the property under test. That is what failed
`granted_prefix_lists_expected_entries_deterministically` on PR #2277.

- Route all 33 non-timing test call sites through the existing
  `list_with_generous_deadline` helper (test-only 60 s fixture deadline),
  so cap/containment/security assertions are decided by entries and bytes.
- Keep `large_directory_aborts_near_the_scan_deadline` as the only test
  that depends on wall-clock expiry (already-expired deadline plus a 2 ms
  live budget over 20k entries).
- Assert in that test that `LIST_SCAN_BUDGET` still equals
  `RC1_WALL_CLOCK_BUDGET_MS`, so the tests cannot be "fixed" by loosening
  the production deadline.

Production deadlines, `list_with_expiry`, and the bridge expiry plumbing
are unchanged. No `cfg(test)` in production logic, no sleep-based retries.

Closes #2280

Co-authored-by: reviewer <[email protected]>
@Xuepoo
Xuepoo merged commit bdb03e8 into main Oct 20, 2026
26 of 27 checks passed
@Xuepoo
Xuepoo deleted the ctx-1370/feat-font-query branch October 20, 2026 00:07
Xuepoo added a commit that referenced this pull request Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes:
all 71 merged commits are grouped under Added, Changed, Fixed, Security, and
Documentation, with PR numbers and the affected CTX tasks.

Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line
paste duplication and ghost fixed by the cursor clamp across wide spacers
(#2272), combining marks paint so decomposed `é` matches precomposed (#2279),
kitty font query and `bitty +show-font` (#2277), bounded native clipboard
acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the
`bitty.history` Lua surface (#2268), the production ComponentBroker plus
activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI
fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor
reservation (#2289).

Partials are marked honestly: #2254's request surface is still pending, the
#2213 disposition stays open, #2286 is feature-gated and unwired, the macOS
clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not
claimed because PR #2292 is unmerged. The heading reads `unreleased` because
the release is on hold; the tag date is set at tag time.

Docs-only: no code, scripts, workflows, or pins touched.
Xuepoo added a commit that referenced this pull request Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes:
all 71 merged commits are grouped under Added, Changed, Fixed, Security, and
Documentation, with PR numbers and the affected CTX tasks.

Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line
paste duplication and ghost fixed by the cursor clamp across wide spacers
(#2272), combining marks paint so decomposed `é` matches precomposed (#2279),
kitty font query and `bitty +show-font` (#2277), bounded native clipboard
acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the
`bitty.history` Lua surface (#2268), the production ComponentBroker plus
activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI
fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor
reservation (#2289).

Partials are marked honestly: #2254's request surface is still pending, the
#2213 disposition stays open, #2286 is feature-gated and unwired, the macOS
clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not
claimed because PR #2292 is unmerged. The heading reads `unreleased` because
the release is on hold; the tag date is set at tag time.

Docs-only: no code, scripts, workflows, or pins touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:term Area: terminal state / VT feat Feature P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[0.0.24] Advertise resolved terminal font to detectors (fastfetch TerminalFont)

1 participant