refactor(engine): converge State interface, fold migration into state_init (deepening #1)#254
Merged
Merged
Conversation
…tate_init (deepening #1) state.sh / state_migrate.sh / state_io.sh now present ONE State interface through state.sh (no physical merge — combined > 800 rule). Migration is folded into state_init via an internal _state_run_migration helper (guarded once per process, no recursion); the separate `state_migrate_run` call is removed from setup_ubuntu.sh, and `state_init` is now fatal-on-failure (|| exit 1) so a failed migration (or a corrupt state.json) aborts startup with the file + .bak left intact (ADR-0008), rather than swallow-and-continue. migrate/io are declared internal seams. Adds state_interface_spec.bats (init -> migrate -> record -> export end-to-end) and a CONTEXT.md note. Claude-Session: https://claude.ai/code/session_01NX5H2vuMTv4mBmjpPYoS3s Co-authored-by: Claude Opus 4.8 <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
Architecture deepening #1 (grilling-locked):
state.sh/state_migrate.sh/state_io.shnow present ONE converged State interface throughstate.sh(nophysical merge -- combined > the 800 rule, by design). Migration is folded into
state_initvia an internal_state_run_migrationhelper (guarded once perprocess, no recursion); migrate/io are declared internal seams. The separate
state_migrate_runcall is removed fromsetup_ubuntu.sh.Behavior change to note
setup_ubuntu.shnow runsstate_init || exit 1(wasstate_init || true+a separate
state_migrate_run || exit 1). This is required so a failedmigration inside
state_initstays fatal -- but it also means a corruptstate.json at startup now aborts (with quarantine + recovery guidance) instead
of swallow-and-continue. Fail-fast + quarantine is the more honest contract; flag
if you want the old continue-anyway behavior.
Test plan
init -> migrate -> record -> export, fatal-migration, idempotency)
exercise the folded migration)
setup_ubuntu.sh verified + Docker startup smoke (detect/list) green
Deepening candidate #1.
.agents/memoryuntouched.Generated with Claude Code.