Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Several improvements to SettingsDb APIs#9101

Merged
hl662 merged 6 commits intomasterfrom
nam/settingsDb-improvements
Mar 19, 2026
Merged

Several improvements to SettingsDb APIs#9101
hl662 merged 6 commits intomasterfrom
nam/settingsDb-improvements

Conversation

Copy link
Contributor

hl662 commented Mar 18, 2026 *
edited
Loading

Working on adding more tests than just happy path and skeleton assertions, discovered a few problems around SettingsDb/WorkspaceDb versioned lookups and editable cache behavior.

  • Fix editable SettingsDb / WorkspaceDb caching so repeated requests reuse the same instance for the same resolved db, with regression coverage for local lookups, semver-equivalent selectors, and default-name/version cases.
  • Honor requested versions when creating cloud SettingsDb / WorkspaceDb entries, and default omitted cloud versions to 0.0.0.
  • Add prototype guarding for getSetting() using Object.hasOwn().
  • Remove the circular dependency by extracting SettingsEditorImpl.ts from SettingsImpl.ts.
  • Clarify editor docs around local createEmptyDb(...) path/overwrite behavior and resolved-db caching semantics.

hl662 self-assigned this Mar 18, 2026
hl662 requested review from a team as code owners March 18, 2026 16:34
ben-polinsky requested a review from Copilot March 18, 2026 16:45
Copilot started reviewing on behalf of ben-polinsky March 18, 2026 16:46 View session
Copilot AI reviewed Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves the backend SettingsDb/SettingsEditor implementation to avoid subtle caching and prototype-safety issues, while also restructuring internal code to remove a circular dependency and adding tests to cover the discovered behaviors.

Changes:

  • Fixes editable SettingsDb caching so versioned requests don't incorrectly reuse the same cached instance.
  • Hardens SettingsDb.getSetting against inherited prototype properties via Object.hasOwn.
  • Splits SettingsEditor implementation into SettingsEditorImpl.ts to break a circular dependency, and adds targeted tests.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/common/src/DbCloudContainerInfo.ts Strengthens security guidance for baseUri (frontend-safe, no credentials).
core/backend/src/workspace/WorkspaceEditor.ts Adds safety note about file overwrite/path responsibility.
core/backend/src/workspace/SettingsEditor.ts Updates SettingsEditor wiring + docs; clarifies caching intent and adds path safety note.
core/backend/src/test/workspace/SettingsDb.test.ts Adds tests for prototype-guarding and editable DB cache key behavior.
core/backend/src/internal/workspace/SettingsImpl.ts Removes SettingsEditor implementation from this file; exports shared helper.
core/backend/src/internal/workspace/SettingsEditorImpl.ts New extracted SettingsEditor implementation; introduces version-aware caching logic.
core/backend/src/internal/workspace/SettingsDbImpl.ts Adds prototype-guarding in getSetting.
common/changes/@itwin/core-common/nam-settingsDb-improvements_2026-03-18-16-16.json Change record for core-common.
common/changes/@itwin/core-backend/nam-settingsDb-improvements_2026-03-18-16-16.json Change record for core-backend.
common/api/core-backend.api.md API report update for added documentation on EditableSettingsDb.container.

johnnyd710 reviewed Mar 18, 2026
johnnyd710 reviewed Mar 18, 2026
johnnyd710 approved these changes Mar 19, 2026
hl662 enabled auto-merge (squash) March 19, 2026 12:46
ben-polinsky approved these changes Mar 19, 2026
ben-polinsky approved these changes Mar 19, 2026
hl662 merged commit 8569dc8 into master Mar 19, 2026
15 checks passed
hl662 deleted the nam/settingsDb-improvements branch March 19, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

johnnyd710 johnnyd710 approved these changes

ben-polinsky ben-polinsky approved these changes

Assignees

hl662

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants