Skip to content

fix(cli): skip extra newline for command records in tail text output#173

Merged
infiniteregrets merged 1 commit intomainfrom
m/fix-newline
Feb 5, 2026
Merged

fix(cli): skip extra newline for command records in tail text output#173
infiniteregrets merged 1 commit intomainfrom
m/fix-newline

Conversation

@infiniteregrets
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR updates the CLI tail text output path to avoid writing an extra newline after printing a record when the record is a “command record” (and text mode is selected).

The change aligns tail with existing read behavior by conditionally skipping writer.write_all(b"\n") when args.format == RecordFormat::Text && record.is_command_record(). This interacts with write_record() in cli/src/main.rs:596+, where command records in text mode are printed to stderr (eprintln!) rather than written to the configured output writer (stdout/file).

Confidence Score: 3/5

  • This PR is close to safe to merge, but has an output-format regression for text mode when command records occur in the stream.
  • The change is small and localized, but it alters record boundary handling: command records in text mode emit to stderr and now also emit no separator on the output writer, which can concatenate stdout output across records.
  • cli/src/main.rs (tail/read text formatting logic)

Important Files Changed

Filename Overview
cli/src/main.rs Skips writing an extra newline after tail/read records in text mode for command records; introduces an output-boundary issue because command records write to stderr and no longer emit a separator newline on the output writer.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant CLI as s2 cli
    participant OPS as ops::tail/ops::read
    participant WR as output writer (stdout/file)
    participant ERR as stderr

    U->>CLI: s2 tail/read --format text
    CLI->>OPS: request stream of SequencedRecord
    loop for each record
        OPS-->>CLI: SequencedRecord
        alt record is command_record
            CLI->>ERR: eprintln!(command summary)
            note over CLI,WR: PR skips writing "\n" to WR for command records
        else record is data
            CLI->>WR: TextFormatter::write_record(record)
            CLI->>WR: write_all("\n")
        end
        CLI->>WR: flush()
    end
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@infiniteregrets infiniteregrets merged commit 832c415 into main Feb 5, 2026
11 checks passed
@infiniteregrets infiniteregrets deleted the m/fix-newline branch February 5, 2026 19:44
@github-actions github-actions bot mentioned this pull request Feb 5, 2026
quettabit pushed a commit that referenced this pull request Feb 5, 2026
## 🤖 New release

* `s2-lite`: 0.27.4 -> 0.27.5 (✓ API compatible changes)
* `s2-cli`: 0.27.4 -> 0.27.5

<details><summary><i><b>Changelog</b></i></summary><p>

## `s2-lite`

<blockquote>

## [0.27.5] - 2026-02-05

### Miscellaneous Tasks

- Update Cargo.lock dependencies

<!-- generated by git-cliff -->
</blockquote>

## `s2-cli`

<blockquote>

## [0.27.5] - 2026-02-05

### Bug Fixes

- Skip extra newline for command records in tail text output
([#173](#173))

<!-- generated by git-cliff -->
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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