open-notebook/tests
Luis Novo 85336f49fa
fix: actually clear credential fields end to end (frontend payload + API null handling) (#1046)
* fix(frontend): actually clear credential fields when emptied in the edit dialog

Clearing base_url (or the Vertex project/location/credentials_path)
in the credential edit dialog silently did nothing: the submit handler
mapped an emptied field to `undefined`, JSON.stringify dropped the key
from the PUT body, and the backend's partial-update semantics kept the
old value — while the UI reported success.

Emptied fields are now sent as an explicit `null`, which the API
already accepts and persists as a cleared value (verified live).
UpdateCredentialRequest's nullable fields are typed accordingly.

Found in v1.11 release testing (pre-existing, not a release regression):
an Ollama credential with a stale IP in base_url could not be cleared
from the UI.

* fix(api): clear credential fields on explicit null, not just empty string

The update handler guarded every field with 'is not None', so a JSON
null sent to clear base_url (or endpoint/api_version/endpoint_*/
project/location/credentials_path/num_ctx) was silently skipped — the
old value survived while the client saw a 200. Combined with the
frontend bug fixed in the previous commit (emptied fields dropped from
the payload entirely), clearing a credential field was impossible from
the UI: during release testing an Ollama credential kept pointing at a
stale IP after being 'cleared', and only an empty-string PUT crafted by
hand actually cleared it.

Field updates are now keyed on presence in model_fields_set: absent
keeps the old value, explicit null or "" clears. name/modalities/
api_key keep their non-null guards (clearing those is not meaningful).

Regression tests cover null-clears, empty-string-clears, absent-keeps
and the Vertex credentials_path case.

* test(frontend): extract credential update payload builder and cover clear-on-empty

Addresses the cubic review: the frontend half of the fix had no
reproducing test. The edit dialog's payload construction now lives in
a pure buildCredentialUpdatePayload() (frontend/src/lib/
credential-update-payload.ts) used by the component, with tests that
fail on the original bug: an emptied base_url (and Vertex project/
location/credentials_path) must survive JSON.stringify as an explicit
null, unchanged fields must be omitted, and emptied num_ctx clears
via 0.
2026-07-11 09:00:06 -03:00
..
conftest.py feat: credential-based API key management (#477) (#540) 2026-02-10 08:30:22 -03:00
README.md Initial commit with all features 2024-10-21 14:56:10 -03:00
test_add_insight_failure_propagation.py fix: surface silent command-submission failures where they matter (#1019) 2026-07-10 13:53:57 -03:00
test_chunking.py fix(embedding): drop degenerate tiny chunks before embedding (#764) (#768) 2026-05-31 09:43:47 -03:00
test_config_endpoint_no_leak.py fix: don't leak internal exception text in API error responses (#1017) 2026-07-10 13:40:27 -03:00
test_connection_test_classification.py fix: make the provider connection test resilient to model retirement (#1035) 2026-07-10 16:26:22 -03:00
test_cors_credentials.py fix: don't combine wildcard CORS origins with allow_credentials (#1013) 2026-07-10 11:10:41 -03:00
test_credential_provider_validation.py fix: restrict CreateCredentialRequest.provider to a known allowlist (#1016) 2026-07-10 13:34:46 -03:00
test_credentials_api.py fix: actually clear credential fields end to end (frontend payload + API null handling) (#1046) 2026-07-11 09:00:06 -03:00
test_crud_404.py fix(api): return 404 instead of 500 for missing resources in CRUD endpoints (#862) (#924) 2026-06-18 08:23:28 -03:00
test_domain.py fix: batch source-insight lookups when building notebook/chat context (#1008) 2026-07-10 10:36:13 -03:00
test_embedding.py feat: use token-based sizing for embedding chunking (#749) 2026-04-19 13:49:09 -03:00
test_embedding_commands.py fix(commands): register legacy embedding aliases (#876) 2026-06-17 13:21:19 -03:00
test_error_message_sanitization.py fix: don't leak internal exception text in API error responses (#1017) 2026-07-10 13:40:27 -03:00
test_graphs.py chore(release): prepare v1.10.0 (#923) 2026-06-18 07:44:05 -03:00
test_max_body_size_middleware.py fix: reject oversized request bodies before auth/routing (#1014) 2026-07-10 11:15:18 -03:00
test_models_api.py fix(api): normalize openai_compatible provider name in models endpoint (#801) 2026-05-29 11:14:29 -03:00
test_note_save_embed_resilience.py fix: surface silent command-submission failures where they matter (#1019) 2026-07-10 13:53:57 -03:00
test_notes_api.py feat: expose embed command_id in note API responses (#545) 2026-02-14 18:11:23 -03:00
test_order_by_validation.py fix: prevent SurrealQL injection in Credential.get_all()'s order_by (#1021) 2026-07-10 14:10:01 -03:00
test_podcast_audio_containment.py fix: contain podcast audio paths and batch job-status lookups (#1018) 2026-07-10 13:48:24 -03:00
test_podcast_job_status_batching.py fix: contain podcast audio paths and batch job-status lookups (#1018) 2026-07-10 13:48:24 -03:00
test_podcast_path.py fix: pass max_tokens through to podcast_creator for outline/transcript generation (#982) 2026-07-03 12:23:19 -03:00
test_recently_viewed_api.py feat: Recently Viewed section for notebooks and sources (#979) 2026-07-03 12:39:14 -03:00
test_repository_config.py refactor(types): type-check domain base model (#961) 2026-06-25 08:16:41 -03:00
test_search_api.py fix(search): reject non-positive limit and survive highlight overflow (#898) 2026-06-16 04:51:34 -03:00
test_source_create_array_limits.py fix: sort sources by title without tripping the SEARCH index, return 422 for invalid form data (#1042) 2026-07-10 21:10:24 -03:00
test_source_path_containment.py fix: harden source upload path handling and cap array inputs (#1015) 2026-07-10 11:32:51 -03:00
test_sources_api.py fix: sort sources by title without tripping the SEARCH index, return 422 for invalid form data (#1042) 2026-07-10 21:10:24 -03:00
test_startup_migration_retry.py fix: make API startup resilient to a not-yet-ready database (#977) 2026-07-03 14:15:09 -03:00
test_transformations_api.py feat: per-transformation custom model selection (#978) 2026-07-03 12:30:50 -03:00
test_upload_toctou_race.py fix: harden source upload path handling and cap array inputs (#1015) 2026-07-10 11:32:51 -03:00
test_upload_type_mitigations.py fix: harden source upload path handling and cap array inputs (#1015) 2026-07-10 11:32:51 -03:00
test_url_validation.py fix: make validate_url() async so DNS resolution doesn't block the event loop (#1011) 2026-07-10 10:43:36 -03:00
test_utils.py fix: handle tiktoken network errors in offline environments (issue #264) 2026-03-10 19:45:14 -05:00
test_vertex_credentials_file_oracle.py fix: don't leak filesystem info via Vertex credential test errors (#1012) 2026-07-10 11:07:04 -03:00

Coming Soon