Skip to content

fix(point): escape line protocol control characters - #59

Open
bednar wants to merge 3 commits into
mainfrom
fix/point/escape-linebreaks
Open

fix(point): escape line protocol control characters#59
bednar wants to merge 3 commits into
mainfrom
fix/point/escape-linebreaks

Conversation

@bednar

@bednar bednar commented Sep 1, 2026

Copy link
Copy Markdown
Member

Supersedes #49 and implements the escaping approach proposed in this review comment.

Proposed Changes

  • escape actual newline, carriage return, and tab characters as literal \n, \r, and \t sequences before serializing structured line protocol
  • apply the shared escaping rules to measurements, tag keys and values, default tags, field keys, and string field values
  • cover both Point and DataFrame write paths while leaving raw line-protocol strings unchanged
  • preserve the existing serialized representation of literal backslash sequences
  • retain point-tag precedence over default tags and continue dropping all-null DataFrame rows
  • add regression coverage for exact serialized output and HTTP request bodies

This prevents control characters from splitting structured writes into additional line-protocol records and aligns the Rust client with the Java, C#, JavaScript, and Python client behavior described in #49.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@codecov-commenter

codecov-commenter commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.73418% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.32%. Comparing base (b98caa8) to head (44b2856).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/write_dataframe.rs 98.48% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   82.74%   83.32%   +0.57%     
==========================================
  Files          10       10              
  Lines        1971     2027      +56     
==========================================
+ Hits         1631     1689      +58     
+ Misses        340      338       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Rejects unsafe control characters in structured line-protocol writes to prevent malformed or split batches.

Changes:

  • Adds shared validation and a dedicated error variant.
  • Applies validation to Point, default-tag, and DataFrame writes.
  • Adds regression tests and release notes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/point.rs Validates structured Point values.
src/write_dataframe.rs Validates DataFrame serialization.
src/error.rs Adds InvalidPointData.
tests/point_tests.rs Tests Point validation and literal escapes.
tests/write_tests.rs Tests default-tag behavior.
CHANGELOG.md Documents the fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CHANGELOG.md Outdated
Comment thread src/write_dataframe.rs Outdated
@bednar
bednar marked this pull request as draft September 1, 2026 13:46
@bednar bednar changed the title fix(point): reject unsupported control characters fix(point): escape line protocol control characters Sep 1, 2026
@bednar
bednar requested a balanced review from Copilot September 1, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@bednar
bednar requested a balanced review from Copilot September 2, 2026 03:42
@bednar
bednar marked this pull request as ready for review September 2, 2026 03:42
@bednar
bednar requested a review from karel-rehor September 2, 2026 03:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The shared implementation covers the stated structured-write paths with appropriate regression tests and no unresolved correctness issues.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

3 participants