Skip to content

Reduce V2 group-switch latency and add bootstrap phase timing - #1727

Merged
Paul Lizer (paullizer) merged 3 commits into
microsoft:paullizer-react-v2-uifrom
paullizer:paullizer-v2-performance-investigation
Oct 8, 2026
Merged

Paul Lizer (paullizer) merged 3 commits into
microsoft:paullizer-react-v2-uifrom
paullizer:paullizer-v2-performance-investigation

Conversation

@paullizer

@paullizer Paul Lizer (paullizer) commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Group switching unnecessarily waited for the complete V2 bootstrap, whose observed production median was approximately 5.1 seconds. Confirm the saved selection through authenticated GET /api/v2/scope instead, retaining preflight and final access checks, draft protection, and read-only recovery after ambiguous writes.
  • Preserve catalogs during scope confirmation, reject malformed or competing selections, and prevent overlapping bootstrap responses from restoring an old selection. Bootstrap and scope reads use no-store; other requests retain their existing cache behavior.
  • Add flat numeric bootstrap phase timings to Application Insights, regression coverage, and documentation. The review follow-up standardizes all scope response tuples and brings the application version to 0.261.306.

Initial-load optimization is intentionally deferred. This change is not deployed, and production switch improvements remain unmeasured. Browser cache-lock attribution is a hypothesis, not an established root cause.

Linked issue

Refs #1725

That P1 issue tracks the broader backend bootstrap optimization and should remain open after this quick fix merges.

Release Notes & Latest Features

  • New Feature
  • Bug Fix
  • UI Enhancement
  • Breaking Change
  • Internal only

Is this visible to end users?

  • Yes
  • No

Is this admin-facing (Admin Settings, governance, deployment, config)?

  • Yes
  • No

Should this become a Latest Feature card?

  • Yes
  • No
  • Already added

Screenshot needed for the card?

  • Yes
  • No
  • Attached

Version bump

  • application/single_app/config.py VERSION third segment bumped, or not needed because this is docs-only
  • deployers/version.txt bumped, or not needed because deployers/ was not changed

Application version: 0.261.304 -> 0.261.306, including the 0.261.305 quick fix and 0.261.306 response-contract review follow-up. No deployer changes.

Testing / validation

Python backend tests used a session-local environment with repository-pinned Flask 3.1.3 and Werkzeug 3.1.6. Backend and browser tests use isolated storage/HTTP fixtures, not live Azure performance measurements. Backend, route-policy, and documentation checks were rerun for the review fix; the JavaScript, build, and browser results below cover the original quick fix, whose frontend code is unchanged by the follow-up.

  • python -m pytest functional_tests\test_v2_scope_and_bootstrap_timings.py functional_tests\test_v2_group_workspace_context.py functional_tests\test_v2_bootstrap_branding_and_navigation.py functional_tests\test_v2_admin_settings_live_shell_refresh.py -q --tb=short --disable-warnings - 117 passed, 16 existing return-value warnings. Includes three new response-tuple cases for success, missing identity, and storage failure.
  • node functional_tests\test_v2_bootstrap_refresh_logic.mjs - 14/14 passed; node functional_tests\test_v2_group_workspace_context_logic.mjs - 30 checks passed.
  • npm run build from application\v2_ui - passed, including TypeScript; existing large-bundle warning remains out of scope. Generated local static assets are not committed.
  • $env:PYTHONPATH="$PWD;$PWD\ui_tests\fixtures;$PWD\ui_tests"; python -m pytest ui_tests\test_v2_group_workspace_shell.py -q --tb=short - 30 passed, including desktop/mobile switching without an extra bootstrap request.
  • python functional_tests\route_tests\test_route_blueprint_policy_inventory.py && python functional_tests\route_tests\test_route_unauthenticated_policy_contract.py && python functional_tests\route_tests\test_route_policy_test_coverage.py - 14/14, 9/9, and 3/3 passed.
  • python functional_tests\test_docs_app_surface_coverage.py && python functional_tests\test_docs_site_quality.py - 7/7 and 6/6 passed; regenerated inventory has no semantic change.
  • python scripts\check_broken_access_control.py application\single_app\route_backend_v2.py - passed.
  • python scripts\check_xss_sinks.py application\single_app\route_backend_v2.py application\v2_ui\src\lib\apiClient.ts application\v2_ui\src\lib\endpoints.ts application\v2_ui\src\lib\types.ts application\v2_ui\src\stores\bootstrapStore.ts application\v2_ui\src\stores\groupWorkspaceStore.ts - passed for the original quick fix; python scripts\check_xss_sinks.py application\single_app\route_backend_v2.py also passed for the review follow-up.

Documentation

  • Release notes updated, or not needed
  • Feature documentation updated, or not needed
  • Fix documentation updated, or not needed

Added docs/explanation/fixes/V2_GROUP_SWITCH_LATENCY_FIX.md, including timing-query instructions and production-validation limitations. Updated release notes and logging-tag reference. No new user-facing feature page is needed.

Security checklist

  • New Flask routes include @swagger_route(security=get_auth_security())
  • Settings sent to non-admin frontends use sanitize_settings_for_user()
  • Browser JavaScript is served from local SimpleChat static assets only; no CDN-hosted JS
  • No secrets, keys, connection strings, or local-only artifacts are included

The new endpoint returns only the caller's identity and authorized active-scope fields, never raw settings or catalogs. Storage failures return an explicit 503. Phase-timing events contain numeric durations, not identities, settings, or catalog contents.

Confirm group selections through a protected scope-only endpoint instead of rebuilding bootstrap catalogs. Preserve access checks and response ordering, add bootstrap phase timings and regression coverage, and document version 0.261.305. Refs microsoft#1725 for the separate backend optimization.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread application/single_app/route_backend_v2.py Fixed
Paul Lizer (paullizer) and others added 2 commits October 8, 2026 18:01
Use response, status, and headers consistently for scope success and failure paths. Add regression coverage for all three return paths, update related documentation, and bump the application patch version to 0.261.306.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merge base 817f9dd and preserve VERSION 0.261.306 when resolving the version conflict. Retain the V2 performance fix and incoming workflow cleanup/recovery changes.

Validation: 225 focused Python tests and 112 subtests, 58 JavaScript checks, 26 route-policy checks, and 13 documentation checks passed. All 10 failures from the broader Python run reproduced on untouched base and are pre-existing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@paullizer
Paul Lizer (paullizer) merged commit 27cbfca into microsoft:paullizer-react-v2-ui Oct 8, 2026
11 checks passed
Paul Lizer (paullizer) added a commit to paullizer/simplechat that referenced this pull request Oct 9, 2026
…o the plan-replay branch

Merged with rerere off. The only conflict was docs/explanation/release_notes.md:
V2's file is kept byte-identical and this PR's section sits on top of it as a pure
insertion. chat-controls.md and the two route-policy tests auto-merged with
independent hunks. config.py merged cleanly because both sides are at 0.261.306;
this PR's references move to 0.261.307 in the following commit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants