Skip to content

feat(migration): Add Resumable Staged Migration Planning#3

Draft
bigH wants to merge 69 commits into
mainfrom
refactoring
Draft

feat(migration): Add Resumable Staged Migration Planning#3
bigH wants to merge 69 commits into
mainfrom
refactoring

Conversation

@bigH
Copy link
Copy Markdown
Owner

@bigH bigH commented May 1, 2026

Summary

  • Add durable migration planning state with .planning/state.json, accepted stage stdout, resumable one-step planning, and refinement feedback.
  • Add staged planning publish transactions with locks, snapshot checks, rollback, and failed-transaction handling.
  • Add canonical migration list|doctor|review|refine commands with safer visible-migration and slug/path resolution.
  • Run planning ticks before phase execution and source-target routing, with consistency gates blocking invalid migrations.
  • Update README, AGENTS, live migration docs, and broad pytest coverage for planning, publishing, consistency, CLI, and loop behavior.

Components Touched

flowchart TD
  CLI[cli.py] --> MCLI[migration_cli.py]
  MCLI --> Review[review_cli.py]
  MCLI --> Refine[planning.py refine]

  Loop[loop.py] --> Tick[migration_tick.py]
  Tick --> Planning[planning.py]
  Tick --> Phases[phases.py]

  Planning --> State[planning_state.py]
  Planning --> Publish[planning_publish.py]
  Publish --> Consistency[migration_consistency.py]
  Tick --> Consistency

  Docs[README.md / AGENTS.md] -. documents .-> CLI
  Tests[tests/*] -. covers .-> MCLI
  Tests -. covers .-> State
  Tests -. covers .-> Publish
  Tests -. covers .-> Tick
Loading

Why

Migration planning needed a durable, resumable path instead of relying on transient agent output. This makes planning auditable, lets review and refinement publish through the same staged transaction boundary, and keeps automation from executing invalid or human-gated migrations.

Related PRs

None. This PR carries the staged migration planning stack.

Validation

  • uv run pytest -> 880 passed in 73.56s

Reviewer Notes

  • Filesystem transaction safety is load-bearing. Please look closely at rollback, dirty-live, and failed-transaction handling.
  • The broad diff is intentional: planning state, publish transactions, CLI, review/refine, scheduler integration, docs, and tests need to land together.

🤖 Generated with OpenAI Codex
🧠 Steered & Validated by Hiren Hiranandani

bigH added 30 commits April 28, 2026 23:44
Why:
Removes duplicated bypass log formatting across modules and protects the scope-expansion artifact contract with focused coverage.

Validation:
uv run pytest
Why:
Removes regex-heavy duplicate grammar handling in a boundary parser while preserving behavior with tighter edge-case tests.

Validation:
uv run pytest
Why:
Removes repeated load-bearing parsing logic in planning.py while preserving phase discovery behavior and locking section-over-legacy precedence with tests.

Validation:
uv run pytest
Why:
This makes a load-bearing retry state machine smaller and easier to change while preserving rollback and validation semantics under direct test.

Validation:
uv run pytest
Why:
Preserves a real safety invariant by fixing a test helper that could miss branching calls in direct run_command imports and still pass.

Validation:
uv run pytest
Why:
This locks down migration-facing effort semantics and removes duplicated result-building logic that could drift.

Validation:
uv run pytest
Why:
removes repeated manifest discovery logic in a load-bearing module while preserving human-review and effort-budget scheduling semantics

Validation:
uv run pytest
Why:
Removes duplicated boundary checks in init, making repo-relative path rules easier to maintain while preserving the tested contract for both flags.

Validation:
uv run pytest
Why:
This preserves the real scope-candidate contract while deleting test-coupled internals that made small cleanups harder than necessary.

Validation:
uv run pytest
Why:
Removes repeated summary/rationale fallback branches and locks the boundary-text contract behind one helper plus direct tests.

Validation:
uv run pytest
Why:
Preserves the current kind-based selection contract while preventing silent misrouting if future refactors produce duplicate candidate kinds.

Validation:
uv run pytest
Why:
Removes a duplicated load-bearing package string while adding a higher-value test for the actual --version CLI boundary

Validation:
uv run pytest
Why:
Preserves the same upgrade behavior with a smaller, truer test file that is easier to extend without copy-paste drift.

Validation:
uv run pytest
Why:
Removes duplicated attempt/transition field plumbing in failure reporting while preserving the tested commit-vs-failure boundary.

Validation:
uv run pytest
Why:
Centralizing RouteResult and DecisionRecord assembly removes duplicate error-mapping logic in a hot orchestration path and makes future cleanup safer

Validation:
uv run pytest
Why:
Preserves behavior while deleting private test scaffolding that duplicated shared fixture logic, reducing drift risk in a sensitive test path.

Validation:
uv run pytest
Why:
Preserves caller-visible status parsing and retry defaults while making the module smaller, more direct, and better protected by boundary-level tests.

Validation:
uv run pytest
Why:
Preserves CLI guard behavior while reducing test-only drift against the canonical run-loop argument shape.

Validation:
uv run pytest
Why:
Preserves a small but real safety net by making taste CLI tests fail truthfully and share one arg-construction path, which reduces maintenance drift in the taste test cluster.

Validation:
uv run pytest
Why:
Removes pointless count-based indirection in git state checks while adding direct coverage for dirty-state helpers and empty-commit rejection.

Validation:
uv run pytest
Why:
Removes duplicated test setup and replaces it with one shared fail-fast helper, making the run-loop tests smaller and easier to change without touching behavior.

Validation:
uv run pytest
Why:
Preserves the effort-override contract while removing effort-domain logic from loop.py, improving locality and reducing orchestration noise.

Validation:
uv run pytest
Why:
Preserves a small but real cleanup that makes the run-once test cluster simpler and less drift-prone without changing behavior.

Validation:
uv run pytest
Why:
Reduces duplicated fixture mechanics in the CLI taste-warning tests, making the protected warning behavior easier to read and safer to extend.

Validation:
uv run pytest
Why:
This makes `targeting` easier to read and change by replacing exception-shaped local validation with direct validity checks, with behavior pinned by tests.

Validation:
uv run pytest
Why:
preserves behavior while removing repeated failure-event construction that could drift across classifier error paths

Validation:
uv run pytest
bigH added 30 commits May 3, 2026 21:58
…429T020915/revise

Why:
planning.revise accepted; next step: review-2
Why:
Cuts misleading test dependencies/noise in a single module cluster without changing behavior, making tests easier to read and maintain.

Validation:
uv run pytest
Why:
Improves test-code truthfulness and reduces maintenance ambiguity with zero user-facing or runtime behavior change.

Validation:
uv run pytest
Why:
Reduces repeated regex compilation in a hot matching path while preserving behavior with an explicit boundary guard test.

Validation:
uv run pytest
…260507T130532

Why:
planning.approaches accepted; next step: pick-best
…g-20260507T130532/pick-best

Why:
planning.pick-best accepted; next step: expand
…g-20260507T130532/expand

Why:
planning.expand accepted; next step: review
…g-20260507T130532/review

Why:
planning.review accepted; next step: revise
…g-20260507T130532/revise

Why:
planning.revise accepted; next step: review-2
Why:
Reduces parser brittleness/duplication while preserving behavior, with direct tests locking the intended parsing contract.

Validation:
uv run pytest
Why:
Deletes dead abstraction layers, keeps behavior identical, and makes the persistence path shorter and easier to audit.

Validation:
uv run pytest
Why:
Removes duplicated load-bearing gate logic and adds a planning-path regression test, reducing drift risk while preserving behavior.

Validation:
uv run pytest
…260507T140152

Why:
planning.approaches accepted; next step: pick-best
…n-20260507T140152/pick-best

Why:
planning.pick-best accepted; next step: expand
…n-20260507T140152/expand

Why:
planning.expand accepted; next step: review
…n-20260507T140152/review

Why:
planning.review accepted; next step: revise
…n-20260507T140152/revise

Why:
planning.revise accepted; next step: review-2
…n-20260507T140152/review-2

Why:
planning.review-2 accepted; next step: final-review
…n-20260507T140152/final-review

Why:
Deterministic, low-risk refactor plan with correct effort tiers and no human decision gates.
…on-20260507T140152/phase-1-characterize-current-contracts.md

Why:
Locks current migration_consistency contracts before internal refactoring, reducing behavior-regression risk in later extraction phases.

Validation:
uv run pytest
…on-20260507T140152/phase-2-extract-rule-groups-behind-stable-api.md

Why:
Improves readability and maintainability of consistency execution-gate logic without changing public contracts or caller behavior.

Validation:
uv run pytest
…on-20260507T140152/phase-3-normalize-shared-internal-policy-predicates.md

Why:
Reduces duplicated gating logic and branch redundancy in migration consistency policy checks while preserving execution semantics and keeping full test suite green.

Validation:
uv run pytest
…on-20260507T140152/phase-4-integration-verification-sweep.md

Why:
No code changes were necessary; this phase verified integration contracts and preserved behavior across callers.

Validation:
uv run pytest
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