You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auth_source was added to the MongoDB connection schema this morning in #625. It has no input in the connection form, and a config that carries it loses it on the next structured-form save.
ui/components/connection_config_fields.py::mongodb_fields() renders host, port, user, password, database. No auth_source control.
ui/state/connection_state.py::_build_config(), mongodb branch (lines 754–764), writes exactly those five keys.
ui/state/connection_state.py::_populate_form_from_config(), mongodb branch, reads exactly those five keys.
The defect
auth_source is reachable only via the raw-JSON escape hatch, and it does not survive contact with the structured form:
User sets {"auth_source": "orders", …} through raw JSON. Runs work.
Later they open that connection in the structured form — to fix a typo in the host, say — and click Save.
_build_config() rebuilds the config from its five fields. auth_source is gone.
build_connection_uri re-defaults the absent key to admin, and the next run fails authentication.
The user changed a hostname and their authentication silently reverted. Nothing in the UI indicates a field was discarded.
This is exactly the population #550 exposed the setting for: users whose MongoDB user lives inside the target database rather than in admin.
Why the existing test did not catch it
tests/test_services/test_mongodb_auth_source.py::TestTheDefaultIsDeclared::test_it_is_exposed_in_the_connection_schema carries the docstring "A setting with no surface is the core#499 mistake." It asserts on CONFIG_SCHEMAS["mongodb"]["properties"].
But connection_schemas.py and the Reflex form are two hand-maintained string sources with no code linking them — the schema module's own docstring still describes UI form rendering as (future). So the test asserts the schema surface while the mistake it was written to prevent lives in the UI surface. It passes, and the setting has no surface.
Scope is wider than one key
_build_config() and _populate_form_from_config() are hand-written, per-type, and exhaustive-by-omission for every connector. Any config key present in one and absent from the other is silently dropped on save. auth_source is the instance that exists today; the same shape will reproduce for tls and srv in #626 if only one side is written.
Fix
Product's spec for #626 covers the auth_source input, since it is one field in the same function and the field TLS/SRV has to compose with. Filing this separately so the defect is tracked even if delivery splits, and because the general case is bigger than #626:
Add the auth_source input to mongodb_fields(), plus form_auth_source + setter.
Add the line to both_build_config() and _populate_form_from_config().
Regression test written red-first: a config carrying auth_source, loaded into the form and saved unchanged, retains every key. It must fail against current dev.
Low urgency (0 users, and the raw-JSON path is not a documented flow), but it is silent data loss in a credential-adjacent setting, and item 4 is the durable version.
Summary
auth_sourcewas added to the MongoDB connection schema this morning in #625. It has no input in the connection form, and a config that carries it loses it on the next structured-form save.Found while writing SPEC_MONGODB_TLS_SRV.md for #626. Verified against
origin/dev@f6851eb.Evidence
returns nothing. Concretely:
ui/components/connection_config_fields.py::mongodb_fields()renders host, port, user, password, database. Noauth_sourcecontrol.ui/state/connection_state.py::_build_config(),mongodbbranch (lines 754–764), writes exactly those five keys.ui/state/connection_state.py::_populate_form_from_config(),mongodbbranch, reads exactly those five keys.The defect
auth_sourceis reachable only via the raw-JSON escape hatch, and it does not survive contact with the structured form:{"auth_source": "orders", …}through raw JSON. Runs work._build_config()rebuilds the config from its five fields.auth_sourceis gone.build_connection_urire-defaults the absent key toadmin, and the next run fails authentication.The user changed a hostname and their authentication silently reverted. Nothing in the UI indicates a field was discarded.
This is exactly the population #550 exposed the setting for: users whose MongoDB user lives inside the target database rather than in
admin.Why the existing test did not catch it
tests/test_services/test_mongodb_auth_source.py::TestTheDefaultIsDeclared::test_it_is_exposed_in_the_connection_schemacarries the docstring "A setting with no surface is the core#499 mistake." It asserts onCONFIG_SCHEMAS["mongodb"]["properties"].But
connection_schemas.pyand the Reflex form are two hand-maintained string sources with no code linking them — the schema module's own docstring still describes UI form rendering as(future). So the test asserts the schema surface while the mistake it was written to prevent lives in the UI surface. It passes, and the setting has no surface.Scope is wider than one key
_build_config()and_populate_form_from_config()are hand-written, per-type, and exhaustive-by-omission for every connector. Any config key present in one and absent from the other is silently dropped on save.auth_sourceis the instance that exists today; the same shape will reproduce fortlsandsrvin #626 if only one side is written.Fix
Product's spec for #626 covers the
auth_sourceinput, since it is one field in the same function and the field TLS/SRV has to compose with. Filing this separately so the defect is tracked even if delivery splits, and because the general case is bigger than #626:auth_sourceinput tomongodb_fields(), plusform_auth_source+ setter._build_config()and_populate_form_from_config().auth_source, loaded into the form and saved unchanged, retains every key. It must fail against currentdev.CONFIG_SCHEMASproperties through_populate_form_from_config()→_build_config()and asserts nothing is lost. That catches the whole class rather than this instance, and would have caught this one on the day MongoDB Test Connection ignores auth_source — fails on connections whose runs succeed (core#550 gap) #625 merged.Severity
Low urgency (0 users, and the raw-JSON path is not a documented flow), but it is silent data loss in a credential-adjacent setting, and item 4 is the durable version.