Skip to content

test: lock in instance-attribute reads in api_bootstrapper_config#57

Merged
lesnik512 merged 1 commit into
mainfrom
fix/settings-bootstrapper-regression-test
Jun 26, 2026
Merged

test: lock in instance-attribute reads in api_bootstrapper_config#57
lesnik512 merged 1 commit into
mainfrom
fix/settings-bootstrapper-regression-test

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Context

Ports the regression test from litestar-sqlalchemy-template#32.

That PR fixed a bug where Settings.api_bootstrapper_config built its config from the module-global settings singleton instead of self, so any non-singleton Settings instance (or access during the singleton's own construction) silently produced the singleton's values.

State in this repo

The production code here already reads self.* — the bug is absent. What was missing was a test guarding against it being reintroduced. This PR adds only that test.

Test

tests/test_settings.py constructs Settings(service_name="custom-service", service_version="9.9.9") and asserts api_bootstrapper_config reflects the instance rather than the global. Passes GREEN against the current (correct) code; would fail if the self.* reads ever regressed to settings.*.

ruff format --check, ruff check --no-fix, and ty check all pass on the new file.

🤖 Generated with Claude Code

Port the regression test from litestar-sqlalchemy-template#32. The
production bug fixed there (api_bootstrapper_config reading the module
-global `settings` singleton instead of `self`) is already absent here,
but there was no test guarding against it being reintroduced.

The test constructs a non-singleton Settings instance and asserts its
api_bootstrapper_config reflects that instance, not the global.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 531565d into main Jun 26, 2026
2 checks passed
@lesnik512 lesnik512 deleted the fix/settings-bootstrapper-regression-test branch June 26, 2026 17:53
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