Skip to content

Send x-build-version header for every request#229

Merged
luckysori merged 1 commit into
masterfrom
feat/send-version-master
May 25, 2026
Merged

Send x-build-version header for every request#229
luckysori merged 1 commit into
masterfrom
feat/send-version-master

Conversation

@luckysori
Copy link
Copy Markdown
Collaborator

Resolves #195.


I merged #210 against a different branch by mistake.

We are sending x-build-version on every request and fail if the sdk version is too old

resolves #195
@luckysori luckysori requested a review from bonomat May 25, 2026 04:32
@luckysori luckysori self-assigned this May 25, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@luckysori, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 31 minutes and 4 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 842545f1-5141-49c4-88ec-9577c0798329

📥 Commits

Reviewing files that changed from the base of the PR and between d3c4820 and b7dcf8c.

📒 Files selected for processing (6)
  • ark-grpc/src/client.rs
  • ark-grpc/src/error.rs
  • ark-rest/src/client.rs
  • ark-rest/src/error.rs
  • ark-rest/tests/wasm.rs
  • e2e-tests/tests/e2e_rest_client_get_info.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/send-version-master

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.

Copy link
Copy Markdown

@arkanaai arkanaai Bot left a comment

Choose a reason for hiding this comment

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

✅ Approved — clean implementation

Reviewed all 6 changed files + full file context + cross-repo impact + git history + issue #195 requirements.

Summary

Adds x-build-version / X-Build-Version header to every gRPC and REST request, using CARGO_PKG_VERSION (currently 0.9.0). Adds is_version_mismatch() helper to both error types for detecting BUILD_VERSION_TOO_OLD server rejections.

What's correct

  • gRPC (ark-grpc/src/client.rs): VersionInterceptor applied to both ArkServiceClient and IndexerServiceClient via with_interceptor. Uses a shared Channel (cloned cheaply — it's Arc-wrapped). Clean.
  • REST (ark-rest/src/client.rs): reqwest::Client::builder().default_headers() — propagates to all requests including SSE event streams (lines 305, 530 use self.configuration.client). Clean.
  • Version source: env!("CARGO_PKG_VERSION")&'static str at compile time. from_static() is valid. Correct.
  • Connection optimization: gRPC connect() now creates one channel shared by both service clients instead of two separate connections. Strictly better.
  • Custom Debug impl: Required because InterceptedService doesn't derive Debug. The impl is reasonable.
  • Test coverage: is_version_mismatch tests cover: matching status, wrong message, wrong code, non-tonic source, no source. Good coverage.

Breaking change — acceptable

ark_rest::Client::new() signature changed: -> Self-> Result<Self, Error>. All in-tree callers updated (wasm tests, e2e tests). No external consumers found across the full monorepo (/root/arkana/repos/). Downstream crates depending on ark-rest will get a compile error — this is a semver-minor break at worst, and version is pre-1.0 (0.9.0), so acceptable.

Minor observations (non-blocking)

  1. ark-rest/src/error.rs:44-47is_version_mismatch is less precise than the gRPC version. The REST impl does source.to_string().contains("BUILD_VERSION_TOO_OLD") without checking HTTP status code. The gRPC version checks both FailedPrecondition AND message content. In practice unlikely to cause false positives, but worth noting the asymmetry.

  2. No integration test that the header is actually sent. Issue #195 lists "Add tests verifying the header is sent" as a requirement. The current tests only cover error detection. A test that inspects outgoing headers (e.g., against a mock server) would close that gap. Not blocking for merge.

  3. reqwest::Client::builder().build() is infallible in practice (only fails with conflicting TLS config). The Result return from Client::new() is technically correct but will never fail with the current code. Fine for future-proofing.

Not protocol-critical — no VTXOs, signing, forfeit paths, or round lifecycle touched. Ship it.

@luckysori luckysori merged commit fdc6b5d into master May 25, 2026
25 checks passed
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.

Send x-build-version header (arkd version compat, PR #960)

2 participants