Repository navigation
feat(tui): implement Ratatui invocation timeline widget - #500
Merged
Merged
Conversation
Render the transaction invocation stack of a replayed transaction in the interactive debugger instead of printing a placeholder message. The timeline widget flattens the invocation tree depth first, the same order used by `grat trace`, and renders every frame with its nesting depth, tree connector, execution status, function name and elided contract id. The panel title tracks the focused frame, the focused frame is highlighted and an empty replay reports that no invocation was recorded. The debugger now sets up a ratatui terminal, replays the transaction before entering raw mode and handles the timeline navigation keys, with the terminal restored on exit.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
@cold-13 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
codeZe-us
self-requested a review
October 23, 2026 01:57
codeZe-us
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the invocation timeline of the interactive replay debugger (#483).
grat replay <tx-hash> -iused to print a placeholder message. It now opens a realRatatui debugger that replays the transaction and shows the contract invocation
stack of the replay, so nested calls can be inspected frame by frame.
How It Was Done
crates/cli/src/tui/widgets/timeline.rs— the timeline widget:flatten()walks theContractInvocationtree depth first (pre-order) and returnsTimelineRows carrying the nestingdepth, theis_lastsibling flag and theinvocation itself. The order matches the tree printed by
grat trace, so a timelineindex always points at the same invocation.
count()returns the number of frames without allocating, and is used by the keyhandling and the footer so that navigation stays allocation free.
render()/render_with_focus()draw the frames inside a bordered panel whosetitle shows the position (
Timeline (3/12)). The border is cyan while the timelineowns the focus and dark gray otherwise.
├─/└─), the execution status (✔/✘,green / red), the function name and the contract id. Stellar contract ids are 56
characters long, so long ids are elided in the middle (
CBQYN5XZ…MCC5).crates/cli/src/tui/app.rs— the debugger shell:grat_core::replay::replay_transactionbefore theterminal enters raw mode, so a failing replay keeps the regular terminal output.
TerminalGuardrestores raw mode, the alternate screen and the cursor on drop,which covers normal exits, I/O errors and panics.
panel and a footer (frame counter and key bindings).
handle_keysupportsq/Esc/Ctrl+Cto quit and↑/↓(orj/k) to movethe focused frame;
TuiState::scroll_offsetholds the index of the focused frameand is clamped to the timeline bounds.
Issues Encountered (If Any)
stableRust toolchain inrust-toolchain.toml, which couldnot be installed in the development environment, so the changes were verified with
Rust 1.91.0.
cached locally. The TUI modules were therefore compiled and tested in isolation
against a stub of
grat_core::types::tracethat mirrors the real type definitions.crates/cli/src/tui/app.rs, so this branch may need a small rebase once feat(tui): implement debugger controls widget and keyboard navigation #493 lands.Related Issue
Closes #483
How It Was Tested
cargo test) cover the flattening order and sibling flags, theframe counter, the elision of contract ids, the indentation of nested invocations,
the highlight of the focused frame, the clamping of an out-of-bounds index, the
empty-timeline message, the quit keys, the navigation bounds and the rendered
screen content. The widget tests render into a
TestBackendand assert on theresulting buffer.
rustfmtand compiles without warnings.Screenshots / Video (If Applicable)
The panel renders as follows (frame 3 of 12 focused):