Skip to content

Add native detached buffer CLI workflows#9

Merged
Pajn merged 1 commit intomainfrom
buffer-cli
Mar 24, 2026
Merged

Add native detached buffer CLI workflows#9
Pajn merged 1 commit intomainfrom
buffer-cli

Conversation

@Pajn
Copy link
Copy Markdown
Owner

@Pajn Pajn commented Mar 23, 2026

Stack

Summary by CodeRabbit

  • New Features

    • Added list-buffers command to display buffers, with mutually exclusive flags to filter attached or detached buffers and readable tab-separated output.
    • Added attach-buffer command to move a buffer to a specified target pane.
  • Tests

    • Added end-to-end test covering listing detached/attached buffers and attaching a detached buffer via the CLI.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 795d1b36-b468-410a-903e-c92c60123678

📥 Commits

Reviewing files that changed from the base of the PR and between 84b9cee and 4309e3f.

📒 Files selected for processing (2)
  • crates/embers-cli/src/lib.rs
  • crates/embers-cli/tests/panes.rs
 _________________________________________
< Fly, you fools! I'll hold off the bugs. >
 -----------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
📝 Walkthrough

Walkthrough

Two new CLI subcommands (list-buffers and attach-buffer) are introduced to manage detached buffers, enabling users to list buffers with optional filtering and attach detached buffers to target panes. Supporting helper functions format buffer state information for CLI output. An integration test validates the end-to-end functionality.

Changes

Cohort / File(s) Summary
CLI Buffer Management
crates/embers-cli/src/lib.rs
Added ListBuffers and AttachBuffer command variants with execution handlers that communicate with protocol layer. Implemented format_buffers() and buffer_state_label() helpers to render buffer records with state, attachment status, and metadata in human-readable tab-delimited format.
Buffer Integration Test
crates/embers-cli/tests/panes.rs
Added comprehensive async test validating buffer listing and attachment workflows: creates buffers via protocol, verifies CLI output formatting for attached/detached states, confirms attachment updates pane buffer references, and validates filter flags work correctly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Server

    User->>CLI: list-buffers --detached
    CLI->>Server: ClientMessage::Buffer(BufferRequest::List { detached_only: true })
    Server-->>CLI: ServerResponse::Buffers { records }
    CLI->>CLI: format_buffers(records)
    CLI-->>User: Tab-delimited buffer output

    User->>CLI: attach-buffer 42 -t pane123
    CLI->>Server: ClientMessage::Node(NodeRequest::MoveBufferToNode { buffer_id: 42, target_leaf_node_id: pane123 })
    Server-->>CLI: Success
    CLI-->>User: Empty response (success)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰✨ Buffer Bunny's Ballad

With list and attach, we hop with glee,
Buffers float free, then settle with thee,
Detached and attached in formatted view,
Protocol hops make the CLI bright and new! 🎪

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add native detached buffer CLI workflows' directly matches the changeset which implements two new CLI subcommands (list-buffers and attach-buffer) for managing detached buffers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Tip

You can disable the changed files summary in the walkthrough.

Disable the reviews.changed_files_summary setting to disable the changed files summary in the walkthrough.

@Pajn Pajn force-pushed the buffer-cli branch 2 times, most recently from c708b29 to 48286b0 Compare March 23, 2026 21:16
@Pajn Pajn force-pushed the api-docs branch 2 times, most recently from 93fb341 to a92217c Compare March 24, 2026 00:14
@Pajn Pajn changed the base branch from api-docs to main March 24, 2026 16:20
@Pajn
Copy link
Copy Markdown
Owner Author

Pajn commented Mar 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn
Copy link
Copy Markdown
Owner Author

Pajn commented Mar 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn
Copy link
Copy Markdown
Owner Author

Pajn commented Mar 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/embers-cli/src/lib.rs`:
- Around line 97-100: The two boolean flags attached and detached should be made
mutually exclusive at parse time so BufferRequest::List cannot receive
contradictory attached_only and detached_only values; update the clap derive on
the struct that defines attached and detached (the fields currently annotated
with #[arg(long)]) to declare a mutual conflict (e.g., add conflicts_with =
"detached" to the attached field and conflicts_with = "attached" to the detached
field, or define an ArgGroup with multiple = false) so the parser rejects both
true simultaneously before constructing BufferRequest::List.
- Around line 285-294: The AttachBuffer branch currently sends
NodeRequest::MoveBufferToNode and awaits but doesn't validate the response;
modify the code in the Command::AttachBuffer handler (around
connection.resolve_pane and the request via
ClientMessage::Node/NodeRequest::MoveBufferToNode) to capture the awaited
response and call expect_session_snapshot() on it (mirroring the pattern used in
SplitWindow) to ensure the server returned a SessionSnapshot and fail fast on
protocol drift.

In `@crates/embers-cli/tests/panes.rs`:
- Around line 172-177: The test is brittle because it asserts the buffer state
is exactly "running" immediately after create/attach; instead update the
assertion in the panes.rs test (around the use of run_cli, stdout, listed and
detached_buffer_id) to accept either "running" or "created" (the transient
state) — e.g., parse the status field from the tab-separated line for the buffer
id and assert it is one of ["created","running"] so the test is not
timing-flaky.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6eac6ac0-16df-4030-a570-750c21baddc1

📥 Commits

Reviewing files that changed from the base of the PR and between bb2a7d8 and 84b9cee.

📒 Files selected for processing (2)
  • crates/embers-cli/src/lib.rs
  • crates/embers-cli/tests/panes.rs

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/Pajn/Embers/issues/comments/4113210608","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- walkthrough_start -->\n\n<details>\n<summary>📝 Walkthrough</summary>\n\n## Walkthrough\n\nAdds two CLI commands — `list-buffers` and `attach-buffer` — to request buffer listings and move buffers to target panes via protocol messages, plus helpers to format buffer records; includes an async integration test exercising listing and attachment flows end-to-end.\n\n## Changes\n\n|Cohort / File(s)|Summary|\n|---|---|\n|**CLI Buffer Management** <br> `crates/embers-cli/src/lib.rs`|Added `ListBuffers` and `AttachBuffer` variants to `Command` and extended `execute()` to send `ClientMessage::Buffer(BufferRequest::List{...})` and `ClientMessage::Node(NodeRequest::MoveBufferToNode{...})`. Added `format_buffers()` and `buffer_state_label()` to render tab-separated buffer lines and map buffer states.|\n|**Buffer Integration Test** <br> `crates/embers-cli/tests/panes.rs`|Added `detached_buffers_can_be_listed_and_attached_via_cli` async test: creates a detached buffer via protocol, verifies `list-buffers --detached` output, runs `attach-buffer <id> -t <pane>`, checks session snapshot for attachment, and validates `list-buffers --attached` and full-list scenarios.|\n|**Protocol Imports in Tests** <br> `crates/embers-cli/tests/panes.rs` (imports)|Introduced protocol-layer imports (`RequestId`, `BufferRequest`, `ClientMessage`, `ServerResponse`) to construct/inspect protocol messages in the test.|\n\n## Sequence Diagram(s)\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant CLI\n    participant Server\n\n    User->>CLI: list-buffers [--attached/--detached]\n    CLI->>Server: ClientMessage::Buffer(BufferRequest::List { session_id?, attached_only, detached_only })\n    Server-->>CLI: ServerResponse::Buffers { records }\n    CLI->>CLI: format_buffers(records)\n    CLI-->>User: Tab-delimited buffer list\n\n    User->>CLI: attach-buffer <buffer_id> -t <pane_id>\n    CLI->>CLI: resolve target pane / expect session snapshot\n    CLI->>Server: ClientMessage::Node(NodeRequest::MoveBufferToNode { buffer_id, target_leaf_node_id })\n    Server-->>CLI: Success / ServerResponse\n    CLI-->>User: (empty string on success)\n```\n\n## Estimated code review effort\n\n🎯 3 (Moderate) | ⏱️ ~22 minutes\n\n## Poem\n\n> 🐰  \n> I hopped through lists both near and far,  \n> Found detached buffers hiding like a star,  \n> I nudged one home to a pane so neat,  \n> Now tabs align and outputs meet,  \n> A tiny hop, a tidy feat. 🥕\n\n</details>\n\n<!-- walkthrough_end -->\n\n\n<!-- pre_merge_checks_walkthrough_start -->\n\n<details>\n<summary>🚥 Pre-merge checks | ✅ 2 | ❌ 1</summary>\n\n### ❌ Failed checks (1 warning)\n\n|     Check name     | Status     | Explanation                                                                           | Resolution                                                                         |\n| :----------------: | :--------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- |\n| Docstring Coverage | ⚠️ Warning | Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |\n\n<details>\n<summary>✅ Passed checks (2 passed)</summary>\n\n|     Check name    | Status   | Explanation                                                                                                                                                                                       |\n| :---------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled.                                                                                                                                       |\n|    Title check    | ✅ Passed | The title 'Add native detached buffer CLI workflows' directly and accurately describes the main change: introducing new CLI commands (list-buffers and attach-buffer) to manage detached buffers. |\n\n</details>\n\n<sub>✏️ Tip: You can configure your own custom pre-merge checks in the settings.</sub>\n\n</details>\n\n<!-- pre_merge_checks_walkthrough_end -->\n\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Pajn/Embers&utm_content=9)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->\n\n<!-- internal state start -->\n\n\n<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAgrXoY1JIkkEq4aAywdJAC2ABmcZSQAMIAMgCSkADu+BQA1nEe+FnIkAYAco4ClFwAnJBlAKo2qVywuLjciBwA9D1E6rDYAhpMzD1WaEIYPQCizNUUiD3c2B4ePfVNiDXWU1hlAMr42BQMIQJUGJFcsQmUYAweOmXQzqS4MVc3kMzaBwZDuFcNhuvxuGQGgYbCQJPASFlKGCABQYfDkSDPRA0WgASihqRUJA8KLRGKxOPxZWSFBI1Gi1C4ACYAAxMgBsYBZAGYwEzudAAIy1Djc9kcQUAFgAWkYACLSBgUeDccTojgGKBwVC2FDIbjOT74OLoezhBh5aI7ZXSSDIvLwDC0KhgbERPL4zD0R1PbBKZC0jz0+i2boGBpQNDceBgWj4BjIZFmJm48O6GLxRIUR7PO1mWr4wAoBJBcAhkLY01AdohEPB0WBaYE2HmAKypiOMZ7sV1ZdSRPPs9vp1WyMBoZ5SPMAdiHUCeMdwtJCSYAHKmDBYUiw2BhcMgHE4XEYoJNppBaQBHbDSHGm2lwhGQOIUFiQAACTCUVFU6m0JdgS4lvAbDIL2pb/iEIGIGgpCQAARB+ijKD+4Q6Pe8JZHBGiajAUQxPgnwREw2C7goX4qGoqEANoCARAC6drJEhNgUeo+LcPg2LRKWgHwEou7wAw444AQxBkMot60twXaIBokCzBEsDniQ0nyD6Hh+tIGodj4CjrFGtYCF48E+GIdYYPqlBxLkbC0HB9iiGqGDYR2cCQd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EXR8gwneO3HUCYhIlwF+JZB1psIcPwEtpWhttQ1Nr0CAA -->\n\n<!-- internal state end -->"},"request":{"retryCount":3,"retries":3,"retryAfter":16}}}

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
crates/embers-cli/tests/panes.rs (1)

210-217: ⚠️ Potential issue | 🟠 Major

Avoid strict running state checks immediately after attach/list transitions.

Line 215 and Line 242 still hard-code running, which can reintroduce timing flakes (created is transiently valid).

Suggested fix
     let listed = run_cli(&server, ["list-buffers", "--attached"]);
     assert!(
         stdout(&listed)
             .lines()
-            .any(|line| line.starts_with(&format!(
-                "{detached_buffer_id}\trunning\tattached:{target_pane_id}\t"
-            )))
+            .filter(|line| line.starts_with(&format!("{detached_buffer_id}\t")))
+            .any(|line| {
+                let fields: Vec<&str> = line.split('\t').collect();
+                fields
+                    .get(1)
+                    .is_some_and(|status| status == &"created" || status == &"running")
+                    && fields.get(2).is_some_and(|attachment| {
+                        *attachment == format!("attached:{target_pane_id}")
+                    })
+            })
     );
@@
     let detached_again = run_cli(&server, ["list-buffers", "--detached"]);
     assert!(
         stdout(&detached_again)
             .lines()
-            .any(|line| line.starts_with(&format!("{previous_buffer_id}\trunning\tdetached\t")))
+            .filter(|line| line.starts_with(&format!("{previous_buffer_id}\t")))
+            .any(|line| {
+                let fields: Vec<&str> = line.split('\t').collect();
+                fields
+                    .get(1)
+                    .is_some_and(|status| status == &"created" || status == &"running")
+                    && fields.get(2) == Some(&"detached")
+            })
     );

Also applies to: 238-243

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/embers-cli/tests/panes.rs` around lines 210 - 217, The test is
asserting a strict "running" state immediately after attach/list transitions
which can be transiently "created"; update the assertions in the panes.rs test
where run_cli(&server, ["list-buffers", "--attached"]) is used (and the similar
assertion later) to accept either "created" or "running" rather than only
"running": locate the checks that build the expected string with
{detached_buffer_id}\trunning\tattached:{target_pane_id} and change the match
logic (using e.g. a predicate that checks .any(|line|
line.starts_with(&format!("{detached_buffer_id}\t")) &&
(line.contains("\trunning\tattached:") || line.contains("\tcreated\tattached:"))
) ) so both transient states pass; apply the same change to the duplicate
assertion later in the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@crates/embers-cli/tests/panes.rs`:
- Around line 210-217: The test is asserting a strict "running" state
immediately after attach/list transitions which can be transiently "created";
update the assertions in the panes.rs test where run_cli(&server,
["list-buffers", "--attached"]) is used (and the similar assertion later) to
accept either "created" or "running" rather than only "running": locate the
checks that build the expected string with
{detached_buffer_id}\trunning\tattached:{target_pane_id} and change the match
logic (using e.g. a predicate that checks .any(|line|
line.starts_with(&format!("{detached_buffer_id}\t")) &&
(line.contains("\trunning\tattached:") || line.contains("\tcreated\tattached:"))
) ) so both transient states pass; apply the same change to the duplicate
assertion later in the file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 795d1b36-b468-410a-903e-c92c60123678

📥 Commits

Reviewing files that changed from the base of the PR and between 84b9cee and 4309e3f.

📒 Files selected for processing (2)
  • crates/embers-cli/src/lib.rs
  • crates/embers-cli/tests/panes.rs

@Pajn Pajn merged commit c4c795a into main Mar 24, 2026
4 checks passed
@Pajn Pajn deleted the buffer-cli branch March 24, 2026 18:41
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