Skip to content

refactor(engine): converge State interface, fold migration into state_init (deepening #1)#254

Merged
ycpss91255 merged 1 commit into
mainfrom
feat/state-deepening
Jun 21, 2026
Merged

refactor(engine): converge State interface, fold migration into state_init (deepening #1)#254
ycpss91255 merged 1 commit into
mainfrom
feat/state-deepening

Conversation

@ycpss91255

Copy link
Copy Markdown
Owner

Summary

Architecture deepening #1 (grilling-locked): state.sh / state_migrate.sh /
state_io.sh now present ONE converged State interface through state.sh (no
physical merge -- combined > the 800 rule, by design). Migration is folded into
state_init via an internal _state_run_migration helper (guarded once per
process, no recursion); migrate/io are declared internal seams. The separate
state_migrate_run call is removed from setup_ubuntu.sh.

Behavior change to note

setup_ubuntu.sh now runs state_init || exit 1 (was state_init || true +
a separate state_migrate_run || exit 1). This is required so a failed
migration inside state_init stays fatal -- but it also means a corrupt
state.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

  • test-unit: 3984 pass, 0 fail (worktree); new state_interface_spec (6 e2e:
    init -> migrate -> record -> export, fatal-migration, idempotency)
  • test-integration: 22/22 (engine-startup export/import/sync round-trips
    exercise the folded migration)
  • lint clean; bash -n clean
  • rebased onto current main (has docs: archetype cookbook for module authors (hybrid archetype + super-call patterns) #5 Environment); no conflicts; merged
    setup_ubuntu.sh verified + Docker startup smoke (detect/list) green
  • CI re-runs the full gate (incl. sharded AC-17 coverage)

Deepening candidate #1. .agents/memory untouched.

Generated with Claude Code.

…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>
@ycpss91255 ycpss91255 enabled auto-merge (squash) June 21, 2026 16:40
@ycpss91255 ycpss91255 merged commit 3f1146e into main Jun 21, 2026
53 checks passed
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.

1 participant