Skip to content

test(worker-bottomup): end-to-end Phase 7 migration test (#62)#271

Merged
charlie83Gs merged 3 commits intomainfrom
feat/phase7-e2e-test
Apr 20, 2026
Merged

test(worker-bottomup): end-to-end Phase 7 migration test (#62)#271
charlie83Gs merged 3 commits intomainfrom
feat/phase7-e2e-test

Conversation

@charlie83Gs
Copy link
Copy Markdown
Contributor

Summary

Stitches the planner (`plan_auto_dispatch`) and the workflow body
(`run_graph_migration`) together against a real DB — the closest
integration test we can build without spinning up a live Hatchet worker.

Covers the full round-trip in one test, mirroring the production
dispatch sequence:

  1. Plugin at v2 with a noop migration registered
  2. v1 graph seeded
  3. `plan_auto_dispatch` surfaces exactly one plan for the graph
  4. `run_graph_migration` advances it to v2 with audit row as `success`
  5. Re-planning returns empty (graph caught up)
  6. Second dispatch is a no-op (`applied_migration_ids == []`)

Relationship to other Phase 7 tests

  • `test_auto_dispatch.py` — planner alone (10 tests)
  • `test_graph_migration_workflow.py` — workflow body alone (7 tests)
  • `test_startup_auto_dispatch.py` — dispatch loop alone (3 tests)
  • This PR — the three pieces composed end-to-end

Each file isolates one component; this one proves they work together.

Base branch

Based on `feat/graph-migration-workflow` (PR #267) since the test
imports `run_graph_migration` from that branch. Will rebase onto
`main` automatically once #267 merges.

Test plan

  • `uv run --project services/worker-bottomup pytest services/worker-bottomup/tests/integration/test_migration_e2e.py -x -v` — 1/1
  • CI green

🤖 Generated with Claude Code

The durable wrapper that composes the Phase 7 primitives with per-hop
commits — so a worker crash mid-plan leaves earlier audit rows and
flipped graph state persisted, and the next dispatch resumes from the
last applied ``to_version`` via the idempotent-replay path in
``run_hop`` (``success`` / ``skipped`` audit rows short-circuit).

The executor helper (``kt_db.migration_executor.execute_migration``) is
a single-session composition of the same primitives; this workflow
deliberately doesn't call it because single-session has no durability
between hops — exactly the property the workflow layer exists to add.

The orchestration body lives in a framework-agnostic helper
(``run_graph_migration``) so integration tests hit it against a real
session factory without Hatchet infrastructure. 7 tests cover:
single/multi-hop success (proving audit rows commit mid-plan via fresh
reads), mid-plan failure with correct ``last_applied`` stamping,
re-migrate resume via idempotent replay (completed hops NOT
re-invoked), unknown plugin failing cleanly without touching graph
state, already-at-target no-op, and target-ahead plan trimming.

Registered on the orchestrator worker and ``worker-all``.
Stitches the planner (plan_auto_dispatch) and the workflow body
(run_graph_migration) together against a real DB — the closest
integration test we can build without a live Hatchet worker.

Covers the full round-trip: plugin at v2 + noop migration → planner
finds the out-of-date v1 graph → workflow helper advances it → audit
row lands as 'success' → planner returns empty on re-plan → second
dispatch is a no-op. 5 assertion phases in one test, mirroring the
production dispatch sequence.

Paired with:
* test_auto_dispatch.py — planner alone
* test_graph_migration_workflow.py — workflow body alone
* test_startup_auto_dispatch.py — dispatch loop alone

Those isolate each component; this test proves they compose.
Base automatically changed from feat/graph-migration-workflow to main April 20, 2026 21:32
# Conflicts:
#	services/worker-bottomup/src/kt_worker_bottomup/workflows/graph_migration.py
#	services/worker-bottomup/tests/integration/test_graph_migration_workflow.py
@charlie83Gs charlie83Gs merged commit 592398d into main Apr 20, 2026
8 checks passed
@charlie83Gs charlie83Gs deleted the feat/phase7-e2e-test branch April 20, 2026 21:50
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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