feat(options): Derive SentryOptions for typed, live-reloading runtime configuration#425
Open
jan-auer wants to merge 2 commits intofeat/objectstore-optionsfrom
Open
feat(options): Derive SentryOptions for typed, live-reloading runtime configuration#425jan-auer wants to merge 2 commits intofeat/objectstore-optionsfrom
jan-auer wants to merge 2 commits intofeat/objectstore-optionsfrom
Conversation
Introduces two new crates that replace the hand-written boilerplate in objectstore-options: - `objectstore-typed-options` — defines the `SentryOptions` trait, the shared `Error` type, and the generic background `refresh` loop. All dependencies consumed by generated code (arc-swap, serde, serde_json, sentry-options, tokio) are re-exported as hidden items so consumers do not need to declare them directly. Exposes a `derive` feature that re-exports the proc macro. - `objectstore-typed-options-derive` — provides `#[derive(SentryOptions)]`, which generates the global OnceLock singleton, trait impl, `get()`, `init()`, and (under the `testing` feature) `override_with()`. All generated paths are fully qualified through `objectstore_typed_options`, so the derive can be used from any crate. `objectstore-options` is reduced to the concrete struct definitions: - Its dependency list shrinks to `objectstore-typed-options` (with the `derive` feature) and `serde`. - The `init()` free function is gone; callers use `Options::init()`.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2c4aa24. Configure here.
Two structs deriving SentryOptions in the same module previously produced
a duplicate symbol error because __OPTIONS was emitted at module scope with
a fixed name. Wrapping all generated items in const _: () = { … } gives
each derived struct its own anonymous scope, matching the standard
serde-style hygiene idiom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #421.
Separates the generic machinery for typed sentry-options from the Objectstore-specific option types, and introduces a
#[derive(SentryOptions)]macro so that adding a new options struct requires no boilerplate.The work is split following the
serde/serde_derivepattern into two new crates:objectstore-typed-options— theSentryOptionstrait, sharedErrortype, and background refresh loop. Exposes aderivefeature flag that re-exports the proc macro.objectstore-typed-options-derive— the proc macro, which generates the singleton,get(),init(), and test override support for any annotated struct.objectstore-optionsis then reduced to the concrete type definitions, with most of its dependencies removed.