Repository navigation
Add replay-ready interaction logging for session recording - #64
Merged
Merged
Conversation
…wo-step analysis, SLD, combined actions) https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
Add comprehensive replay agent contract with: - Sequence numbers for deterministic ordering - Correlation IDs linking async start/complete pairs - Duration tracking for completed events - Full details payload per event type for self-contained replay - Wait-point semantics for async operations - Extended event coverage (settings, path picker, confirm dialog, combine modal, zoom, voltage range, asset clicks, inspect query) https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
Log every user interaction as a timestamped event during a session and save it as `interaction_log.json` alongside `session.json`. The log captures enough data for an automated agent to deterministically replay the exact same session. New files: - frontend/src/utils/interactionLogger.ts — singleton logger with correlation IDs and duration tracking for async operations - frontend/src/utils/interactionLogger.test.ts — unit tests (8 tests) - docs/interaction-logging.md — full documentation and replay contract Changes: - types.ts: add InteractionType (34 event types), InteractionLogEntry - sessionUtils.ts: include interaction_log in SessionResult - api.ts: pass interaction_log to saveSession endpoint - main.py: write interaction_log.json in session folder - App.tsx: instrument ~25 handlers with logger calls - CombinedActionsModal.tsx: log modal open/close, pair toggle/estimate/simulate - CLAUDE.md, docs/save-results.md: document new feature All 243 existing tests pass. No new TypeScript errors introduced. https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
Port the InteractionLogger class and all handler instrumentation from the React app to the standalone single-file interface. Same 34 event types are logged: config, contingency, analysis step1/step2, actions (select/favorite/reject/manual), combined actions (modal/toggle/ estimate/simulate), diagram tabs, zoom, SLD overlay, voltage range, session save/reload. The interaction log is included in session.json and passed as a separate interaction_log field to POST /api/save-session, producing interaction_log.json alongside the session snapshot. https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
After rebasing onto main's hook-based refactoring, re-add interaction logging calls to the 5 custom hooks (useSettings, useActions, useAnalysis, useDiagrams, useSession) and App.tsx. Fix broken CombinedActionsModal.tsx merge artifacts (duplicate code, missing hasLS variable, async in non-async useEffect). https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
- interactionLogger: concurrent correlations, all 34 event types, JSON serialization, complex details, duration tracking, seq continuity - useActions: verify action_favorited, action_rejected, manual_action_simulated - useAnalysis: verify step1/step2 start/complete with correlation IDs, overload_toggled, prioritized_actions_displayed, empty branch guard - useDiagrams: verify zoom_in/out/reset, view_mode_changed, sld_overlay_opened/closed/tab_changed, asset_clicked, action_selected/deselected - useSettings: verify settings_opened/cancelled, path_picked - useSession: verify session_saved, session_reload_modal_opened, interaction_log passed to buildSessionResult and api.saveSession https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ
marota
pushed a commit
that referenced
this pull request
Apr 30, 2026
Reconciliation of section 2 (0.5.0): - Drop misattributed PRs that were actually pre-rebrand: save/reload (#49/#52), MW Start (#62), interaction-logging (#64), SLD highlights (#63), load shedding initial integration (#61). All now properly cited in section 1.5–1.6. - Disambiguate App.tsx refactor history: PR #56 (hooks, 2100 → 800, pre-rebrand) vs PR #74 (components, 1000 → 650, 0.5.0) vs PR #75 (memoization Phase 2, same LoC). - Add accurate 0.5.0 PRs: #66 (vectorization w/ benchmark table), #69/#70/#71 (UI polish), #72 (curtailment), #73 (loads_p/gens_p format + configurable MW), #74/#75 (App.tsx decomposition), #78 (PST tap re-simulation), #84/#86/#87/#90 (detachable tabs). - Add a recap table summarizing what's truly new in 0.5.0. Diagrams added (Mermaid, GitHub-rendered): - Gantt timeline of all 4 phases (top of doc). - High-level architecture (frontend / backend / data). - Two-step analysis sequence diagram (section 1.6). - App.tsx LoC evolution flow (section 2.4). - Backend mixin decomposition before/after PR #104/#106 (section 3). - PyPSA-EUR pipeline flowchart (section 4). https://claude.ai/code/session_01Pg7fuCUG2edfm5PyHS6SbN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive interaction logging to ExpertAssist, enabling deterministic session replay. Every user action is recorded as a timestamped event with all parameters needed for an automated agent to reproduce the exact same session without human input.
Key Changes
New
InteractionLoggerutility (frontend/src/utils/interactionLogger.ts): Singleton class that records user interactions with monotonically increasing sequence numbers, ISO timestamps, and correlation IDs for async start/complete pairs. Includes unit tests.Extended type system (
frontend/src/types.ts): AddedInteractionTypeenum covering 50+ event types across configuration, analysis, actions, visualization, and session management. AddedInteractionLogEntryinterface withseq,timestamp,type,details,correlation_id, andduration_msfields.Instrumented App.tsx handlers: Added
interactionLogger.record()calls to all major user interaction handlers (settings, config loading, analysis steps, action selection, visualization controls, etc.). Async operations log both*_startedand*_completedevents with correlation IDs.Session persistence: Modified
buildSessionResult()to includeinteraction_login saved sessions. Updated backendSaveSessionRequestto accept optionalinteraction_logfield. Logs are saved alongsidesession.jsonasinteraction_log.json.Comprehensive documentation: Added
.claude/plan.md(655 lines) with detailed design principles, event contracts, and replay agent specifications. Addeddocs/interaction-logging.md(456 lines) as user-facing documentation.Standalone HTML support: Integrated
InteractionLoggerintostandalone_interface.htmlwith full event recording across all UI interactions.Implementation Details
Replay contract: Each event's
detailsfield contains all parameters needed to reproduce the action (e.g.,config_loadedincludes all 13 configuration parameters). No inference required.Async semantics: Events triggering API calls log both start and completion events linked by
correlation_id. Replay agents wait for completion conditions (API response, UI state change) before proceeding.Deterministic ordering: Events ordered by
seqnumber (not just timestamp) to handle collisions. Each event is self-contained and maps to a specific UI gesture.No performance impact: Logger is a simple in-memory array, cleared on new study load. No React state coupling, no re-renders triggered.
Test coverage: Added
interactionLogger.test.tswith 8 test cases covering recording, correlation IDs, completion tracking, and log copying.https://claude.ai/code/session_01P6uiNH28sCXf972sLBrvEJ