feat(flow): upgrade to @cadre-dev/framework 0.2.0 type-safe APIs#172
Merged
feat(flow): upgrade to @cadre-dev/framework 0.2.0 type-safe APIs#172
Conversation
- Replace Record<string,unknown> + as-any cast with FlowRunnerOptions<T> - Add explicit dependsOn edges to all non-root flow nodes - Add TaskGraphOutput type and fromStep DataRef for phase1→5 handoff - Create Phase5CheckpointAdapter for nested flow checkpoint - Extract 7 substep functions from monolithic executeTask() - Build per-task and wave-barrier flows via framework DSL - Replace manual hasPhase5Substep/markPhase5Substep with framework checkpoint skip - Add computeTopologicalWaves (Kahn's algorithm) for wave grouping - Add convergence-check step to raise terminal exhaustion on wave failure - Export Phase5CheckpointAdapter and TaskGraphOutput from flow module - Update flow-dsl, step-phase-5, and step-phase-5-wave tests
- Restore onNodeStart/onNodeComplete/onNodeSkip hooks in runtime.ts so KB server starts after Phase 0, phase completion is tracked incrementally, and logger.setPhase() sets context per node - Re-add signal: this.abortController.signal to FlowRunnerOptions - Fix completedTaskCount to count actual completions from flow result - Restore runWaveEndQualityGates call after nested flow completes - Re-emit wave lifecycle events (wave-started, wave-completed, wave-barrier-entered, wave-barrier-released) in buildWaveBarrierFlow - Add __flowCheckpoint and __phase5FlowCheckpoint to CheckpointState type; remove unsafe Record<string, unknown> casts in adapters - Replace inline import() type with proper TaskGraphOutput import - Update tests to use typed checkpoint state fields
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
Upgrades AAMF flow infrastructure to use
@cadre-dev/framework0.2.0 type-safe APIs, replacing workarounds from the 0.1.0 era.Changes
WU1: Type-safe FlowRunner options
Record<string, unknown>+as anycast withFlowRunnerOptions<MigrationFlowContext>onNodeStart/onNodeComplete/onNodeSkiphooks (now typed in 0.2.0)signal: this.abortController.signalfor external cancellation supportonNodeCompletehookcheckpoint.completePhase,progress.updatePhase) fires per-node, not batch post-flowWU2: Explicit
dependsOnedgesdependsOnto every non-root node in the migration flowWU3: DataRef for Phase 1 to 5 handoff
TaskGraphOutputinterface extendingPhaseResultfromStep("task-graph-construction")input to theiterative-migrationstepphase1TaskGraphResult, then filesystemWU4: Nested FlowRunner for Phase 5
buildPerTaskFlow()builds a per-task nested flow with substep nodes (migrate, commit, parity, build, test, complete)buildWaveBarrierFlow()builds a wave-barrier nested flow with parallel branches, convergence loops, and commit barrierscomputeTopologicalWaves()groups tasks into dependency-ordered waves via Kahn's algorithmPhase5CheckpointAdapterstores nested flow checkpoint under typed__phase5FlowCheckpointfieldrunMigrateSubstep,runCommitSubstep,runParitySubstep,runParityGateSubstep,runMinorRepassSubstep,runFormatSubstep,runBuildSubstep,runTestSubstepwave-started,wave-completed,wave-barrier-entered,wave-barrier-released)completedTaskCountderived fromflowResult.completedExecutionIdsfor accurate metricsrunWaveEndQualityGatesfires after nested flow for non-enforce quality policies__flowCheckpointand__phase5FlowCheckpointadded toCheckpointStatetype (eliminates unsafeRecord<string, unknown>casts)queueparameter made optional inrunCommandWithRecovery(was already unused in body)Verification
npx tsc --noEmit— cleannpx vitest run— 1475 passed, 177 skipped, 0 failed