Skip to content

Fix harden get user settings#744

Merged
Bionic711 merged 2 commits intoDevelopmentfrom
fix-harden-get-user-settings
Mar 2, 2026
Merged

Fix harden get user settings#744
Bionic711 merged 2 commits intoDevelopmentfrom
fix-harden-get-user-settings

Conversation

@paullizer
Copy link
Contributor

  • Chats Page User Settings Hardening
    • Fixed a user-specific chats page failure where only one affected user could not load /chats due to malformed per-user settings data.
    • Root Cause: The chats route assumed user_settings["settings"] was always a dictionary. If that field existed but had an invalid type (for example string, null, or list), the page could fail before rendering.
    • Solution: Hardened get_user_settings() to normalize missing/malformed settings to {} and persist the repaired document. Hardened the chats route to use safe dictionary fallbacks when reading nested settings values.
    • Telemetry: Added repair logging ([UserSettings] Malformed settings repaired) to improve diagnostics for future user-specific data-shape issues.
    • Files Modified: functions_settings.py, route_frontend_chats.py, config.py.
    • Files Added: test_chats_user_settings_hardening_fix.py, CHATS_USER_SETTINGS_HARDENING_FIX.md.
    • (Ref: user settings normalization, /chats route resilience, functional_tests/test_chats_user_settings_hardening_fix.py, docs/explanation/fixes/CHATS_USER_SETTINGS_HARDENING_FIX.md)

…tings` to `{}` and persist the repaired document.
@paullizer paullizer changed the base branch from main to Development February 26, 2026 23:23
Bionic711
Bionic711 previously approved these changes Mar 2, 2026
Copy link
Collaborator

@Bionic711 Bionic711 left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Collaborator

@Bionic711 Bionic711 left a comment

Choose a reason for hiding this comment

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

Approved

@Bionic711 Bionic711 merged commit 3d7e8d4 into Development Mar 2, 2026
6 checks passed
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

Hardens per-user settings handling to prevent /chats from failing when a user’s Cosmos user-settings document has a malformed settings field, and adds regression coverage + documentation for the fix.

Changes:

  • Normalize missing/malformed user_settings["settings"] to {} in get_user_settings() and persist the repaired document with telemetry.
  • Make /chats read nested user settings via safe dict fallbacks.
  • Bump version and add functional test + fix documentation (and release notes entry).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
functional_tests/test_chats_user_settings_hardening_fix.py Adds a functional regression test covering missing/non-dict settings repair + persistence.
docs/explanation/release_notes.md Adds a v0.238.025 bug-fix entry describing the hardening and telemetry.
docs/explanation/fixes/CHATS_USER_SETTINGS_HARDENING_FIX.md Adds fix documentation with root cause, implementation details, and validation references.
application/single_app/route_frontend_chats.py Uses a safe user_settings_dict when reading activeGroupOid / activePublicWorkspaceOid; moves user_id guard earlier.
application/single_app/functions_settings.py Repairs malformed/missing settings to {}, logs repair telemetry, and upserts repaired user document.
application/single_app/config.py Updates VERSION to 0.238.025.

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.

3 participants