Repository navigation
Add onboarding helpers to the Rust SDK - #1785
Conversation
Let applications label operation calls, inspect token claims and operation roles, and request the Loom guide or Mentor brief without installing a plugin. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Namespace role hints exclude operations authorized on other scopes. Consumer defaults survive labels the server removes, and Mentor helpers preserve the server's reported window. Published documentation waits for the crate release. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit d534051. Configure here.
An empty namespace passes memory model validation and can reach a write handler. Omitting it permits tokenless defaults and rejects authenticated writes that need an explicit namespace. Explicit targets are preserved. Executable suffix removal includes the dot and leaves suffix-free platforms unchanged. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Whitespace-only namespaces can reach write handlers without a namespace authorization target. Omit them so required-field validation refuses the write. Windows executable suffixes are case-insensitive; strip them without changing the program name's casing. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
zlareb1
left a comment
There was a problem hiding this comment.
Two focused tests reproduce the findings on this head. An invalid scoped role produces a positive write hint, and a retry delay holds the guide call past its startup timeout. The existing Rust suite passes with all features.
zlareb1
left a comment
There was a problem hiding this comment.
Three failures reproduce on the CI base without the Rust changes. The extraction field and sender census tests fail locally on both trees. They pass on current main with the two repairs applied. The attestation test fails at the same superseder assertion in both hosted runs. Its repair covers assertion order at equal standing and the separate lower-standing case.
- Extraction classification PR job · Repair #1747
- Sender census PR job · Repair #1796
- Attestation PR job · Base job · Repair #1781
Dropping malformed namespace roles lets flat writer claims produce a false permission hint. Retain each scoped entry so its map stays authoritative. Guide and Mentor calls have a ten-second deadline that includes retry and pacing waits. Return Error::Timeout when that deadline expires. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
zlareb1
left a comment
There was a problem hiding this comment.
The role-map tests preserve scoped authority for invalid values, including a map with no valid entry. All six onboarding regressions pass. They cover the whole-call deadline across retry and pacing waits and the blocking client. The generated Rust files match the registry.

Related: #52
Related: #1754
Changelog category
Changelog entry
Rust clients can label calls by consumer, inspect token and operation role hints, and request the Loom guide and Mentor brief.
Why
A Rust application needs a way to fetch Loom instructions and usage advice without a plugin. The SDK also gives the application permission hints before it sends an operation.
Scope and risk
sdk-rust:<program>; explicit names, including"-"and"*", are preserved..consumer(...)supplies a default when the operation body has no usable label. Label normalization follows the server's printable-character rule. The server's verified token claim takes precedence.token_claims(),permissions(max_age), andcan_call(op)provide advisory information. Namespace role hints exclude operations authorized on other scopes. A malformed role entry retains the scoped map's authority and produces an unknown hint; valid sibling entries remain usable. The server performs the actual authorization.guide(),mentor(), andmentor_with_window(). These helpers issue requests only when called. A ten-second deadline covers the whole call, including HTTP attempts, retry backoff and pacing waits; expiration returnsError::Timeout.Compatibility, rollout and rollback
Error::Timeoutis a new variant of the non-exhaustive error enum. Its category isDependency;retryable()returns false.Tests
make format lint typecheckpasses. Rust generation and fixture checks pass without drift.cargo test --locked --all-targets --all-features,cargo test --locked --doc --all-features,cargo clippy --locked --all-targets --all-features -- -D warningsandRUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps --all-featurespass. Stable doctests, Clippy and documentation also pass. Both toolchains pass 137 client tests and nine doctests.cargo test --locked --all-targetspasses with default features. The all-features run passes 137 client tests, including the six review regressions, and all library and generated contract tests. The unchangedsoftware_factory_memoryexample test fails intermittently on the local macOS host withWouldBlockat its socket reader; an isolated rerun also fails there. The example's listener is nonblocking and its accepted socket is read without resetting blocking mode. Hosted Linux checks remain for CI.Some(true)before the fix andNoneafter it. Tests cover numeric, null, boolean, list, object and unknown string roles, plus a valid sibling namespace.Error::Timeoutat the ten-second deadline. Tests cover HTTP 503 withRetry-After: 60, HTTP 429 pacing withRetry-After: 12, and blocking retry backoff.cargo package --locked --all-featuresbuilds the committed distributable crate; the release helper's provenance and license check passes.8a74384feare running after maintainer approval. Lint and format pass; the four Rust matrices and other test jobs remain in progress.8a74384fereports no verified P0–P3 findings. Its separate run passes 27 library tests, 137 client tests, nine doctests and 51 generator/search-contract tests.Before the latest base merge, an SDK-only example ran against an isolated Loom server and ClickHouse with both Rust versions. It checked tokenless defaults, a read-only caller's real
403, consumer precedence in stored events, and separate Mentor lookback windows. That live scenario was not rerun after this merge.AI assistance in the code
AI-generated: TRAE authored the changes and ran the checks above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist