Skip to content

fix(#401): unify Phase type definitions into single source of truth - #426

Merged
admarble merged 3 commits into
mainfrom
feature/401-unify-phase-type-definitions-into-single-source-of
Mar 25, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/401-unify-phase-type-definitions-into-single-source-of

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Consolidate three divergent Phase definitions (types.ts, state-schema.ts, run-log-schema.ts) into a single canonical Zod schema + inferred TS type in types.ts
  • Eliminate the Phase as StatePhase aliased import in batch-executor.ts
  • Add as const + Zod schemas for merge-check verdict types (CheckVerdict, BatchVerdict)
  • Fix misleading topological sort comment in batch-executor.ts
  • Add integration test verifying all Phase consumers reference the same schema object

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Single Phase definition (Zod + TS type) ✅ src/lib/workflow/types.ts:12-23
AC-2 state-schema and run-log-schema reference canonical definition ✅ Both re-export from types.ts
AC-3 All existing imports compile and tests pass ✅ npm run build + npm test (1908 passed)
AC-4 Phase as StatePhase alias eliminated ✅ batch-executor.ts:15 removed
AC-5 Merge-check verdict types use as const + Zod ✅ src/lib/merge-check/types.ts
AC-6 Integration test ensures Phase consumers agree ✅ phase-types.test.ts (10 tests)

Test plan

  • npm run build passes
  • npm run lint passes (0 errors, 0 warnings)
  • npm test passes (1908/1910 — 2 pre-existing timeout failures unrelated to this change)
  • New phase-types.test.ts verifies schema identity across modules

Closes #401

🤖 Generated with Claude Code

Consolidate three divergent Phase definitions into a single canonical
Zod schema in types.ts. Both state-schema.ts and run-log-schema.ts now
re-export from the canonical source, eliminating the Phase as StatePhase
alias in batch-executor.ts. Add Zod schemas for merge-check verdict
types and fix misleading topological sort comment.

Entire-Checkpoint: 0cac90807e23
worktree-discovery.ts was importing Phase from state-schema.ts (a
re-export) instead of the canonical source in types.ts. No behavioral
change — aligns the import with the single-source-of-truth pattern.
@admarble
admarble merged commit bb3362e into main Mar 25, 2026
5 checks passed
@admarble
admarble deleted the feature/401-unify-phase-type-definitions-into-single-source-of branch March 25, 2026 05:38
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.

Unify Phase type definitions into single source of truth

1 participant