Skip to content

Rust authentication docs and examples match stored-login behavior - #2097

Merged
zlareb1 merged 5 commits into
ClickHouse:mainfrom
yorkhellen:docs/rust-auth-configuration
Dec 4, 2026
Merged

zlareb1 merged 5 commits into
ClickHouse:mainfrom
yorkhellen:docs/rust-auth-configuration

Conversation

@yorkhellen

@yorkhellen yorkhellen commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1935

Changelog category

  • Bug Fix

Changelog entry

Rust authentication documentation describes stored credential discovery and renewal. The stored-login example reads an explicit namespace so its authenticated memory lookup succeeds.

Why

An empty API key does not disable stored credential discovery. The README needs to describe credential precedence, server binding and token replacement on HTTP 401. The renew_login example also passes an empty namespace to memory.get, which requires an addressed namespace.

Scope and risk

The packaged SDK README, example guide, renew_login.rs and its regression tests change. The example reads LOOM_NAMESPACE and rejects missing or blank values before loading credentials. A stored-login HTTP fixture verifies the selected namespace, memory key and Authorization header.

The SDK authentication implementation and wire contracts remain unchanged. The website reference will be updated after crate 0.1.2 is published.

Compatibility, rollout and rollback

  • Wire: no operations or fields change.
  • Example configuration: renew_login requires a nonblank LOOM_NAMESPACE.
  • Operator steps: none.
  • Rollback: reverting restores the documentation and example; no stored data changes.

Tests

Validation after synchronizing with main at dea732eb8:

  • Local format, lint, type checks and all generator checks pass.
  • .venv/bin/python -m pytest tests/unit/test_doc_links.py tests/unit/test_public_copy.py -q: 291 passed.
  • cargo +1.85.1 fmt --all -- --check passes.
  • cargo +1.85.1 test --locked --all-targets --all-features: 650 passed, zero failed, eight existing ignored tests.
  • cargo +1.85.1 test --locked --doc --all-features: 10 passed, zero failed.
  • Dependency resolution uses CI's CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback; the local lockfile is not committed.
  • cargo +1.85.1 clippy --locked --all-targets --all-features -- -D warnings passes.
  • API documentation builds with RUSTDOCFLAGS="-D warnings".
  • cargo +1.85.1 publish --locked --all-features --dry-run passes without publishing. The package verifier confirms the archive matches head afaf45f13, including the example and regression tests.
  • Fresh independent review of all four changed files at afaf45f13 found no defects. The two Rust regressions and scoped README link/public-copy checks independently pass.
  • Full server unit and integration suites remain for CI. Hosted Actions on afaf45f13 report action_required and need maintainer approval before execution.

AI assistance in the code

  • AI-generated (TRAE): an agent wrote the documentation, example repair and regression tests, checked the credential behavior, and ran the checks listed above.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused documentation tests pass.
  • Generated files need no changes.
  • No migrations or plugin changes.
  • No frontend changes.
  • Repository text passes the public-copy check.
  • Commits are signed off.
  • Rust tests and crate packaging pass.
  • Fresh independent review completes with no findings.
  • Hosted CI passes.

An empty API key continues credential discovery. Explain profile precedence and token renewal in the packaged guides.

Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 4, 2026 2:21am UTC
loom-telemetry Ready Ready Preview Dec 4, 2026 2:21am UTC

Request Review

…de 401

Keep the explicit-scope profile snippet instead of advertising the existing scope-free example. Describe changed-token retries for route requests.

Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
@zlareb1 zlareb1 self-assigned this Dec 3, 2026
zlareb1
zlareb1 previously approved these changes Dec 3, 2026

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

No blocking findings. I checked the documented credential precedence, server binding and renewal against the builder and the operation and route clients. The examples use the supported profile flag and builder methods.

…iguration

Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Authenticated memory.get requires a namespace; the token resolves only the org.
Read LOOM_NAMESPACE and reject missing or blank values before loading credentials.
Regression tests check the outgoing request and configuration errors.

Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
(cherry picked from commit a687861)
Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
The profile supplies the server and tokens; the memory lookup still needs an addressed namespace.

Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
@yorkhellen yorkhellen changed the title Rust SDK documentation describes stored credential discovery and renewal Rust authentication docs and examples match stored-login behavior Dec 4, 2026
@yorkhellen

Copy link
Copy Markdown
Contributor Author

@zlareb1 This PR now includes the stored-login example repair at 506628c and its runnable command at afaf45f. renew_login requires a nonblank LOOM_NAMESPACE; the profile still supplies its server and tokens. The two regressions verify the outgoing namespace and bearer header, plus missing/blank configuration errors.

On Rust 1.85.1, all targets/features pass 650 tests with eight existing ignored tests; all ten doctests pass. Documentation checks pass 291 tests. Clippy, API docs, package dry-run and archive verification pass; fresh independent review found no defects in the four-file diff.

The title and body describe the expanded scope. Hosted Actions need maintainer approval, and the website reference remains scheduled for after the crate release. Please recheck afaf45f.

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

Pinned Biome rejects the same assertion in Chat.test.tsx on the PR merge and clean main. The check passes with the formatting repair. PR job · Main job · Repair #2107

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

The stored-login example requires a namespace and sends it with the profile token. The two example tests pass. The authentication guide matches credential discovery, server binding and token renewal in the SDK.

@zlareb1
zlareb1 merged commit 3287256 into ClickHouse:main Dec 4, 2026
75 of 77 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.

2 participants