Skip to content

Ensure scrape output ends with newline#256

Open
BoSuYxxxOfficial wants to merge 1 commit into
CortexLM:mainfrom
BoSuYxxxOfficial:fix-scrape-trailing-newline
Open

Ensure scrape output ends with newline#256
BoSuYxxxOfficial wants to merge 1 commit into
CortexLM:mainfrom
BoSuYxxxOfficial:fix-scrape-trailing-newline

Conversation

@BoSuYxxxOfficial
Copy link
Copy Markdown

Summary

  • ensure non-empty cortex scrape output ends with a trailing newline before writing to stdout or --output
  • avoid duplicating an existing trailing newline and preserve empty output as empty
  • fix a test-only import so the cortex-cli test harness compiles cleanly

Fixes PlatformNetwork/bounty-challenge#53315.

Verification

  • rustfmt --edition 2024 --check src/cortex-cli/src/scrape_cmd/command.rs src/cortex-cli/src/scrape_cmd/tests.rs src/cortex-cli/src/agent_cmd/tests.rs
  • cargo test -p cortex-cli (981 unit tests passed, 7 doctests passed, 4 doctests ignored)
  • local smoke test: served HTML without a final newline and verified both stdout redirect and --output file ended with byte 0a

Normalize non-empty scrape output before it is written to stdout or an --output file, so generated text content behaves like a regular POSIX text stream.

Constraint: Preserve empty output as empty and avoid duplicating an existing trailing newline.

Rejected: Per-path stdout/file special cases because a single normalization point covers both sinks.

Confidence: High.

Scope-risk: Low; affects only scrape command output formatting plus test imports.

Directive: PlatformNetwork/bounty-challenge#53315.

Tested: cargo test -p cortex-cli.

Tested: Local smoke verified stdout and --output bytes end in 0a.

Not-tested: Full workspace test suite.
Copy link
Copy Markdown

@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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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.

[BUG] [v0.0.7] cortex scrape stdout and --output file content lack a trailing newline

2 participants