Skip to content

Conversation

@IanMayo
Copy link
Member

@IanMayo IanMayo commented Feb 11, 2026

Summary

Implement replay and parameter tuning capabilities for the Log Service, enabling analysts to edit parameters on past tool executions and automatically replay all subsequent operations with the new values. This feature adds a Replay Engine module, parameter validation utilities, and extends the Log Service with tuning, revert, and restore operations.

Key Changes

Core Replay Infrastructure

  • Replay Engine (services/session-state/src/log/replayEngine.ts): Pure function module that orchestrates sequential tool re-invocation via dependency-injected callbacks. Builds replay plans from timeline analysis, handles version checking, and manages execution with cancellation support.
  • Parameter Validation (services/session-state/src/log/parameterValidation.ts): Type-specific validation for float, integer, duration, enum, boolean, and string parameters with constraint checking (min/max, patterns, allowed values).

Type System Extensions

  • Extended LogEntry interface with optional deleted field for soft-delete tracking
  • Added comprehensive replay types: ReplayPlan, ReplayEntry, TuneTarget, ReplayResult, ReplayProgress, ArtifactVersion, ReplayHaltReason
  • Added ParameterTypeInfo and ParameterValue types for parameter metadata

Log Service Methods

  • tuneEntry(): Edit a parameter on a past entry and cascade replay all subsequent operations
  • revertTo(): Permanently truncate timeline at a specified entry
  • revertThis(): Soft-delete an entry and replay all subsequent operations
  • restoreEntry(): Restore a previously soft-deleted entry and replay
  • Extended LogServiceDeps with optional replay dependencies: executeTool, loadSnapshot, resolveToolVersion, writeGeoJson

UI Components

  • ParameterEditor (shared/components/src/LogPanel/ParameterEditor.tsx): Inline parameter editing component with type-specific controls (number inputs, duration fields, enum dropdowns, boolean toggles, text inputs). Supports read-only display for non-tunable parameters.
  • ReplayProgress (shared/components/src/LogPanel/ReplayProgress.tsx): Progress indicator showing replay phase, entry count, current tool, and cancel button.
  • Added corresponding CSS modules with VS Code theme variable integration

VS Code Extension Integration

  • Extended logPanelView.ts with Phase 6 message handlers for tune, revert, restore, and cancel operations
  • Updated webview bridge (logPanel.tsx) to forward replay progress and result messages
  • Added deleted and tuneAnnotation fields to timeline entry serialization

Timeline Assembly

  • Extended assembleTimeline() with includeDeleted option to optionally include soft-deleted entries in timeline reconstruction

Testing

  • Comprehensive unit tests for Replay Engine (replayEngine.test.ts): plan construction, entry filtering, parameter application, version checking, execution sequencing, cancellation
  • Parameter validation tests (parameterValidation.test.ts): all type validators with boundary conditions
  • Log Service operation tests (tuneEntry.test.ts, revertTo.test.ts, revertThis.test.ts): integration with replay engine and state management

Documentation

  • Feature specification (specs/076-replay-tune/spec.md): user scenarios, acceptance criteria, design decisions
  • Implementation plan and quickstart guides
  • Data model documentation with entity relationships
  • Research notes on architecture decisions (callback-based replay engine, cross-snapshot support)
  • Evidence artifacts and media content templates

Implementation Details

  • Dependency Injection: Replay Engine accepts callbacks for tool execution, snapshot loading, and version resolution, enabling testability without VS Code dependencies
  • Soft Deletes: Entries marked with deleted: true are skipped during replay but preserved in provenance for audit trails
  • Cross-Snapshot Replay: Supports reconstructing state from snapshot chain when tuning entries from earlier segments
  • Cancellation: AbortController integration allows halting replay mid-execution with state rollback
  • Version Checking: Validates tool versions match recorded versions before execution; halts with detailed error if mismatch detected
  • Parameter Unwrapping: Handles both wrapped (ParameterValue) and raw

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N

Defines the replay/tune feature (E02 Phase 6):
- Parameter tuning with positional replay of subsequent entries
- Revert-to-here (permanent truncation) and revert-this (soft-delete + replay)
- Cross-snapshot replay across snapshot boundaries
- Tool version mismatch detection and halt
- Typed parameter editing affordances in Log Panel
- Artifact versioning on re-run

Dependencies: #71 (Log Recording), #74 (Snapshots), #72 (Log Panel)

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
Phase 0-2 artifacts:
- plan.md: technical context, constitution check, project structure
- research.md: 10 key design decisions with rationale
- data-model.md: new types (ReplayPlan, ReplayResult, etc.)
- contracts/replay-engine.ts: Replay Engine interface contract
- quickstart.md: implementation order and verification steps
- media/planning-post.md: blog post draft
- media/linkedin-planning.md: LinkedIn summary

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
82 tasks across 8 phases:
- Phase 1: Setup (6 tasks)
- Phase 2: Foundation/Replay Engine (11 tasks)
- Phase 3: US1 Tune Parameter - MVP (21 tasks)
- Phase 4: US2 Revert To (8 tasks)
- Phase 5: US3 Revert This (11 tasks)
- Phase 6: US4 Cross-Snapshot (7 tasks)
- Phase 7: US5 Version Mismatch (6 tasks)
- Phase 8: Polish, evidence, media, PR (12 tasks)

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
…ations

Add full replay and parameter tuning capability (Feature 076):

Backend (session-state):
- ReplayEngine: thin orchestrator with serializable JSON plans, DI callbacks
  for tool execution (designed for future Python migration)
- Parameter validation: float, integer, duration, enum, boolean, string
- LogService: tuneEntry, revertTo, revertThis, restoreEntry methods
- Timeline: includeDeleted option for soft-delete support
- Types: ReplayPlan, ReplayEntry, TuneTarget, ReplayResult, and more

UI (shared/components):
- ParameterEditor: inline editing with type-specific controls and validation
- ReplayProgress: progress bar with phases and cancel button
- LogEntry: deleted/tuned badges, tunable parameter click, restore button
- Strings: i18n-ready replay and tuning messages

VS Code integration:
- logPanelView: tune/revert/restore message handlers with replay coordination
- logPanel.tsx: replay state management and message forwarding

Tests: 56 new tests (replayEngine, parameterValidation, tuneEntry, revertTo,
revertThis) — all passing.

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
- Add shipped blog post and LinkedIn summary
- Add test summary evidence (56 tests, all passing)
- Mark Phases 1-8 tasks complete in tasks.md

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
@github-actions
Copy link

github-actions bot commented Feb 11, 2026

🚀 Preview Deployments

Web Shell (Standalone App)

📱 Open Web Shell

Use this for Playwright testing and demos - runs outside Storybook.

Storybook (Component Library)

📚 Open Storybook

Browse all components, stories, and documentation.


All Links
Environment Web Shell Storybook
This PR Open App Open Storybook
Main branch Open App Open Storybook

Updated on commit 78a57e4

- Add curly braces to all single-line if-return statements (curly rule)
- Use explicit comparisons for strict-boolean-expressions:
  entry.deleted === true, entry.tune != null

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
- Fix eqeqeq: entry.tune != null → entry.tune !== null in logPanelView.ts
- Update logService.test.ts stub tests: correct method signatures and
  error messages now that tuneEntry/revertTo/revertThis are implemented
  (was expecting "not implemented", now correctly expects "not available"
  when replay deps are missing)

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
The main session-state index.ts was missing re-exports for all Phase
076 types (ReplayResult, ReplayEngine, etc.) and functions
(createReplayEngine, validateParameter, isValidIsoDuration). This
caused TS2459 in logPanelView.ts which imports ReplayResult.

https://claude.ai/code/session_01H84e8Tca6x9htU9hDaNS5N
@IanMayo IanMayo merged commit d268dd3 into main Feb 11, 2026
7 checks passed
@IanMayo IanMayo deleted the claude/speckit-start-076-Hl0fi branch February 11, 2026 23:28
github-actions bot pushed a commit that referenced this pull request Feb 11, 2026
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