Skip to content

fix: write API defaults#19

Merged
alespour merged 5 commits into
mainfrom
fix/write-api-parity
Jun 15, 2026
Merged

fix: write API defaults#19
alespour merged 5 commits into
mainfrom
fix/write-api-parity

Conversation

@alespour

@alespour alespour commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

Aligns Rust client behaviour with the rest - switches the default write endpoint to v2 for broader InfluxDB 3 family compatibility.

Details:

  • Default changed (use_v2_api: true): writes now use V2 API endpoint (/api/v2/write) by default, making the client compatible with InfluxDB Clustered and InfluxDB Cloud Serverless/Dedicated by default. This change align the behaviour of Rust client with others. Set use_v2_api(false) to use the v3 endpoint.
  • Validation: no_sync=true with use_v2_api=true is now a config error — no_sync is a v3-only feature, caught at build time and at write execution time. Alignment, again.
  • New builder methods: write_use_v2_api, write_accept_partial, write_no_sync on ClientConfigBuilder for easier instantiation.

Note to reviewers: v0.2.0 will be the first public relase (0.1.0 version was only published to crates.io just to set up infrastructure), so the changes are not really breaking.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional

@codecov-commenter

codecov-commenter commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.45%. Comparing base (dbe56b7) to head (1bbd4ca).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   83.41%   83.45%   +0.03%     
==========================================
  Files          10       10              
  Lines        1815     1837      +22     
==========================================
+ Hits         1514     1533      +19     
- Misses        301      304       +3     

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

@alespour alespour force-pushed the fix/write-api-parity branch from a163c75 to bbab379 Compare June 11, 2026 13:01

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

Aligns the Rust client’s default write behavior with other clients by switching the default write endpoint to the V2 compatibility API (/api/v2/write), improving out-of-the-box compatibility across the InfluxDB 3 family. It also adds configuration validation to prevent V3-only options (notably no_sync) from being used with the V2 endpoint.

Changes:

  • Switch WriteOptions default to use_v2_api = true and add validation enforcing no_sync requires use_v2_api=false.
  • Add ClientConfigBuilder convenience setters: write_use_v2_api, write_accept_partial, write_no_sync.
  • Update tests and documentation to reflect the new defaults and constraints.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/write.rs Defaults writes to V2 endpoint and introduces WriteOptions::validate() for incompatible option detection.
src/config.rs Adds builder helpers for common write defaults and validates write options during config build.
src/client.rs Validates per-request write options at execution time to catch invalid overrides (e.g., .no_sync() under V2).
tests/write_tests.rs Updates write tests for new default endpoint and adds a test asserting no_sync requires V3.
tests/retry_tests.rs Ensures retry tests explicitly use V3 to preserve existing test expectations.
tests/config_tests.rs Adds coverage for new default + builder helpers and validates invalid no_sync/V2 combinations.
README.md Updates version/examples and documents environment/connection-string write defaults and endpoint compatibility.
CHANGELOG.md Documents the default endpoint change and V3-only behavior constraints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md
@alespour alespour marked this pull request as ready for review June 11, 2026 13:31
@alespour alespour requested a review from bednar June 12, 2026 07:18

@bednar bednar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 🚀

@alespour alespour merged commit e31fd18 into main Jun 15, 2026
10 checks passed
@alespour alespour deleted the fix/write-api-parity branch June 15, 2026 09:09
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.

4 participants