Skip to content

Add grouped writable options configuration API - #104

Merged
arika0093 merged 3 commits into
mainfrom
feat/grouped-writable-options
Sep 3, 2026
Merged

Add grouped writable options configuration API#104
arika0093 merged 3 commits into
mainfrom
feat/grouped-writable-options

Conversation

@arika0093

Copy link
Copy Markdown
Owner

Summary

  • add grouped static and dependency-injection APIs for applying shared configuration to multiple options types
  • add typed, named, and profiled registration recipes with isolated save-location state and shared provider instances
  • keep existing generic APIs compatible while documenting the grouped APIs as the recommended path
  • add grouped registration tests and update the public API approval

Testing

  • dotnet restore
  • dotnet tool restore
  • dotnet test-rerun --verbosity normal --deleteReports (new tests and public API tests passed; existing JSON output stability tests failed sporadically under the parallel full-suite run)
  • individually reran the three reported JSON tests: all passed
  • public API tests: all passed

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 1a962c1f-fe04-4331-beb6-f849c02db2c5


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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79bedb01cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Configuration.Writable/WritableOptionsBuilder.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: caefbe24ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +42
_options.Clear();
_options.Add(optionBuilder.BuildOptions(instanceName));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Build the replacement before clearing initialized options

When an already initialized type is reinitialized and BuildOptions throws—for example, because the configured file provider rejects the selected directory—this clears the valid registration before the replacement has been built. The failed call therefore leaves the type uninitialized, so a subsequent WritableOptions.GetOptions<T>() throws instead of retaining the previous configuration; the internal grouped replacement path has the same ordering. Build the new configuration into a local before clearing and replacing the list.

Useful? React with 👍 / 👎.

Build replacement configurations before clearing existing registrations so failed initialization leaves valid options intact. Add coverage for direct and grouped initialization paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72eef30b19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +48 to +49
var replace = registeredTypes.Add(typeof(T));
WritableOptions.InitializeInternal(instanceName, builder, replace);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stage all same-type registrations before replacing the old set

When a grouped static initialization contains multiple registrations for the same type and a later recipe fails during configuration or BuildOptions, the first recipe has already cleared the previously valid set and installed only itself. The fresh multi-registration path therefore still leaves partial state after an exception—for example, reinitializing two named instances where the second provider rejects its directory loses all old names and retains only the first replacement—despite the single-registration failure case now preserving prior configuration. Build the complete per-type replacement before mutating the shared instance.

Useful? React with 👍 / 👎.

@arika0093
arika0093 merged commit 3705e23 into main Sep 3, 2026
5 checks passed
@arika0093
arika0093 deleted the feat/grouped-writable-options branch September 3, 2026 04:38
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.

1 participant