diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 000000000..2bc49cca0 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,3 @@ +When updating tests, be sure to always focus on leaving the logic of the test alone. If you can't make the test work without changing the logic, ask the operator (me) when the test is failing, all the context of the test , and we can decide if we should marke it skip, delete it, or find some way to fix it -- perhaps the application implementation has indeed drifted from the spec. + +Please mark ignore any features related to gift cards, schools, teachers, and lessons. Or twitter auth. diff --git a/agent-tasks/client-simulator/async-bridge-spike/progress.md b/agent-tasks/client-simulator/async-bridge-spike/progress.md index 522ad7e76..66f01f68d 100644 --- a/agent-tasks/client-simulator/async-bridge-spike/progress.md +++ b/agent-tasks/client-simulator/async-bridge-spike/progress.md @@ -170,3 +170,65 @@ Determine whether frontend code can support `await context.jamClient.method()` f - `SessionStoreModern.es6` sets marker `window.__JK_USE_MODERN_SESSION_STORE__ = true` before creating store. - `SessionStore.js.coffee` now aliases to existing store when marker is set (`@SessionStore = if context.__JK_USE_MODERN_SESSION_STORE__ then context.SessionStore else Reflux.createStore(...)`) so legacy store does not register duplicate listeners in modern bundle. - Kept `require_directory ..` in modern application manifest to avoid regressing other root-level script dependencies. +- Added REST-level single-flight guard in `JK.Rest.joinSession` (`web/app/assets/javascripts/jam_rest.js`) keyed by `session_id|client_id`. +- Duplicate in-flight join calls now reuse the same jqXHR instead of issuing a second POST. +- Added cleanup on `always()` to release key after completion. +- Hardened implementation to avoid mutating caller `options` object (payload cloned before removing `session_id`). +- Added high-signal debug instrumentation for duplicate join investigation: +- `jam_rest.js`: join dedupe map moved from per-instance to global shared map (`JK.__pendingJoinSessionRequests`) because multiple `JK.Rest()` instances exist. +- `jam_rest.js`: logs `[join-dedupe] create|reuse|release` with `dedupe_key`, `rest_instance_id`, and `trace_token`. +- `SessionStore.js.coffee`: logs legacy store load/init/onJoinSession (`[session-store] legacy-*`) with marker/count context. +- `SessionStoreModern.es6`: logs modern store load/init/onJoinSession (`[session-store] modern-*`) with load-count context. +- Added extra join-source tracing because duplicate attempt source is still unknown: +- `session_utils.js`: logs `[join-source] SessionUtils.joinSession` with call count + stack. +- `CallbackStore.js.coffee`: logs `[join-source] generic-callback join_session` with payload + stack before dispatching `SessionActions.joinSession`. +- This should distinguish UI-initiated join from native/generic-callback initiated join. +- Root-cause analysis from console logs: duplicate join came from two SessionStore pipelines running (legacy + modern), not from REST payload issues. +- Why prior marker was insufficient: load-order race when `react-components.js` is included indirectly (`require_directory ..`), where legacy SessionStore may load before modern marker is set. +- Added load-order-independent modern mode flag: +- `client_bundles/session_store_modern_mode.js` sets `window.__JK_SKIP_LEGACY_SESSION_STORE__ = true`. +- `application_client_modern.js` now requires this flag before broad includes. +- `SessionStore.js.coffee` now no-ops when either `__JK_SKIP_LEGACY_SESSION_STORE__` or `__JK_USE_MODERN_SESSION_STORE__` is set. +- Implemented `debugging_console_spec.md` diversion: +- Added env-gated gon flag: `gon.log_to_server` set from `ENV['LOG_TO_SERVER'] == '1'` in `client_helper.rb`. +- Added new API endpoint `POST /api/debug_console_logs` (`ApiDebugConsoleLogsController#create`) that writes pretty JSON log dumps to `web/tmp/console-logs/YYYYMMDD-HHMMSS-