You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR makes sample history append-only and typed. Instead of one generic graph mutation stream, every runtime mutation is represented in the appropriate typed WAL table while current-state projections stay available for fast reads.
What Actually Changes
Adds typed WAL models in core/persistence/samples/models.py:
SampleStatusEventRow
SampleTaskEventRow
SampleEdgeEventRow
SampleWorkerEventRow
SampleEvaluatorEventRow
SampleSandboxEventRow
SampleAnnotationEventRow
Adds application event helpers in core/application/samples/events.py:
SampleRuntimeEventAppender
SampleRuntimeEventReadService
SampleRuntimeEventView
Adds timestamp replay/slicing in core/application/samples/state.py.
Reworks RuntimeGraphRepository so graph writes append typed task/edge/component events while maintaining sample_graph_nodes and sample_graph_edges as projections.
Removes generic graph mutation DTOs from runtime application models.
Removes generic mutation/annotation persistence from graph persistence models.
Deletes the old dashboard graph-mutation mapper.
Replaces backend /samples/{sample_id}/mutations with /samples/{sample_id}/events.
There is intentionally no generic sample_events table and no component interner. Worker/evaluator/sandbox events store full snapshot JSON directly.
Projection tables still exist and are written alongside WAL rows; the typed WAL is the durable history source.
Event ordering is (event_timestamp, id), not the old mutation sequence column.
node.field_changed has no direct v1 typed replacement; field-specific changes should become explicit typed events or remain projection-only.
The dashboard still adapts dashboard/sample.runtime_event into the existing graph-mutation reducer shape. That is middle-stack compatibility, not the final dashboard model.
Initial typed WAL rows can still be created from definition rows until sample materialization lands later.
Cleaned Later
PR 05 materializes authored public samples into these WAL/projection rows.
PRs 08 and 10 expose/render typed read APIs and dashboard surfaces more directly.
PR 11 deletes the definition-backed initialization path.
Validation Notes
Key coverage includes test_typed_sample_wal.py, test_sample_state_replay.py, test_sample_annotation_events.py, test_typed_sample_wal_boundaries.py, typed event smoke assertions, and dashboard event contract updates.
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
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.
Review Guide
Stack position: PR 01, base
codex/episode-sample-pr00, headcodex/episode-sample-pr01-typed-wal.Implements RFC Docs
03a-persistence-schemas.md: runtime config snapshots and sample runtime WAL tables.03b-implementation-churn.md: prereq PR 01, typed sample WAL tables.03c-postgres-table-inventory.md: typed sample WAL inventory.09-implementation-plan/02-pr-01-typed-sample-wal-tables.md.Why This PR Exists
This PR makes sample history append-only and typed. Instead of one generic graph mutation stream, every runtime mutation is represented in the appropriate typed WAL table while current-state projections stay available for fast reads.
What Actually Changes
core/persistence/samples/models.py:SampleStatusEventRowSampleTaskEventRowSampleEdgeEventRowSampleWorkerEventRowSampleEvaluatorEventRowSampleSandboxEventRowSampleAnnotationEventRowcore/application/samples/events.py:SampleRuntimeEventAppenderSampleRuntimeEventReadServiceSampleRuntimeEventViewcore/application/samples/state.py.RuntimeGraphRepositoryso graph writes append typed task/edge/component events while maintainingsample_graph_nodesandsample_graph_edgesas projections./samples/{sample_id}/mutationswith/samples/{sample_id}/events.Gotchas / Review Risks
sample_eventstable and no component interner. Worker/evaluator/sandbox events store full snapshot JSON directly.(event_timestamp, id), not the old mutation sequence column.node.field_changedhas no direct v1 typed replacement; field-specific changes should become explicit typed events or remain projection-only.dashboard/sample.runtime_eventinto the existing graph-mutation reducer shape. That is middle-stack compatibility, not the final dashboard model.Cleaned Later
Validation Notes
Key coverage includes
test_typed_sample_wal.py,test_sample_state_replay.py,test_sample_annotation_events.py,test_typed_sample_wal_boundaries.py, typed event smoke assertions, and dashboard event contract updates.