odysseus/tests/helpers
Léo 04b8829fb2
Some checks are pending
CI / Focused test guidance (report-only) (push) Waiting to run
CI / Python syntax (compileall) (push) Waiting to run
CI / JS syntax (node --check) (push) Waiting to run
CI / Python tests (pytest) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
ci / docker publish / build (amd64) (push) Waiting to run
ci / docker publish / build (arm64) (push) Waiting to run
ci / docker publish / merge manifest + tag (push) Blocked by required conditions
perf(frontend): share one cached fetch for /api/auth/settings and /api/tools (#5997)
* perf(frontend): share one cached fetch for settings and tools

/api/auth/settings was fetched independently by eight modules and /api/tools by
three on a single load — 4 and 3 requests measured — and any two of those
callers could observe a different snapshot of the same object. chatRenderer.js
is imported under three different ?v= query strings, so it is three separate
module instances each issuing its own /api/tools request.

appConfig.js holds one promise per endpoint, so concurrent and later callers
share it. Every writer invalidates: the settings panel routes its 16 saves
through a single helper, and the admin tools save drops both snapshots because
that route persists disabled_tools into the same settings store. A rejected
fetch clears its slot rather than being memoised, so one blip at boot cannot
leave keybinds, TTS and the search provider on defaults for the session.

The settings panel keeps reading directly: it is the writer and edits what it
reads, so it must see authoritative state.

Cold load, Resource Timing: /api/auth/settings 4 -> 1, /api/tools 3 -> 1, and
0 settings requests on the first load after a login, because the cache now
consumes the sessionStorage prefetch that login.html writes.

Fixes #5996

* fix(admin): refetch tool state when the Agent Tools panel opens

The shared cache made Admin > Tools render the boot snapshot on every
reopen. Its save posts the whole disabled list rebuilt from the checkboxes,
so a tool disabled out of band (the manage_settings tool, another tab) came
back enabled on the next unrelated toggle. Reproduced against the running
app: with api_call disabled by a separate client, toggling app_api off
posted ['app_api'] and silently re-enabled api_call.

The panel now drops the shared entry before reading it, which restores what
dev does today and keeps the startup read that chatRenderer.js shares. Cold
load is still 1 request each for /api/auth/settings and /api/tools, and the
panel costs the same 2 requests per open as dev.

* fix(static): preserve concurrent tool setting changes

---------

Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>
2026-08-16 21:03:05 +01:00
..
__init__.py refactor(tests): add shared CLI test helpers 2026-06-04 15:44:25 +01:00
calendar_routes.py test: localize calendar recurrence helper import (#4944) 2026-06-28 19:04:15 +02:00
cli_loader.py refactor(tests): add shared CLI test helpers 2026-06-04 15:44:25 +01:00
db_stubs.py test: pilot core database stub helper (#3685) 2026-06-09 22:23:33 +02:00
embedding_lanes.py test: split embedding lane tests (#4389) 2026-06-26 18:28:40 +02:00
import_state.py refactor(tests): centralize fake endpoint resolver cleanup 2026-06-05 13:23:46 +01:00
sqlite_db.py refactor(tests): add temp sqlite helper (#2930) 2026-06-07 23:44:16 +02:00
test_settings_shell.js refactor(settings): add registry-backed navigation and finder (#6040) 2026-08-16 02:48:19 +01:00
test_settings_shell_coordinator.mjs perf(frontend): share one cached fetch for /api/auth/settings and /api/tools (#5997) 2026-08-16 21:03:05 +01:00