Repository navigation
feat: add foundational fork-at-step trace support - #12
Merged
Merged
Conversation
Implements fork-at-step debugging to create new traces at specific execution points while preserving all valid execution history before the fork point. Core features: - Fork engine to select events/steps in existing traces - Preserves structural integrity and parent-child relationships - Supports forking by step number or event ID - Creates new trace with preserved event IDs but new run_id - Tracks provenance with ForkInfo metadata linking to parent trace - Validates fork points to prevent broken dependencies - CLI command: stepfork fork --at-step N or --at-event ID - Comprehensive unit and integration tests Implementation: - src/stepfork/fork/models.py: ForkInfo, ForkPoint, ForkResult models - src/stepfork/fork/engine.py: ForkEngine class with core fork logic - src/stepfork/cli/fork.py: CLI command with Rich formatting - tests/: 18 tests covering fork operations, validation, and CLI All tests pass, mypy strict checks pass, ruff linting passes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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
Implements fork-at-step debugging with typed override system for Stepfork v0.2. Fork traces at specific execution points, optionally modify recorded outputs, and preserve complete provenance metadata.
What's Included
Core Fork Engine
--at-step N) or event ID (--at-event ID)Override System (Python API Only)
OverrideSpec(step=N, output={...})orOverrideSpec(event_id=..., output={...})CLI Command
Note: Overrides are only available through Python API, not CLI.
Python API
Implementation Details
src/stepfork/fork/models.py: ForkInfo, ForkPoint, ForkResult, OverrideSpecsrc/stepfork/fork/engine.py: ForkEngine with validation and override applicationsrc/stepfork/fork/overrides.py: OverrideRegistry for managing overridessrc/stepfork/cli/fork.py: CLI interface (no override support)tests/: 43 tests (13 engine + 15 override + 5 integration + 10 edge cases)What's NOT Included
How It Works
.sftracebundleLimitations
Testing
✅ 523 tests pass (43 fork-specific)
✅ mypy strict passes
✅ ruff format & check pass
✅ Forked traces pass validation
✅ CLI smoke tested
✅ Edge cases covered (by event_id, step 0, validation, priority)
Verified Correctness
🤖 Generated with Claude Code