v0 Wave G: planner — Run Plan binding - #42
Conversation
🤖 CodeAnt AI — Review Status
|
|
Running ultrareview automatically — This PR adds a new Run Plan binding feature and changes the public PipelineDefinition.inputs type from array to record, a cross-cutting contract change affecting core, IR, and all consumers — a subtle bug in reachability or input binding could break pipeline execution across the system.. I'll post findings when complete. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change converts pipeline inputs to keyed records and adds planner RunPlan binding. The planner resolves reachable steps, binds defaults and overrides, validates inputs, creates identifiers, exposes typed errors, and publishes the new API. ChangesGraph input schema
Planner API and RunPlan binding
Estimated code review effort: 4 (Complex) | ~45 minutes Mergeability Score: 🟠 High · up to The planner can still produce invalid run plans or crash while handling malformed inputs, and cyclic graphs may reach execution without a schedulable plan. Several documented API and validation contracts also remain inconsistent, while a configured complexity check is failing; these issues should be resolved before merge. Sequence Diagram(s)sequenceDiagram
participant Planner
participant bindRunPlan
participant DefinitionGraph
participant RunPlan
Planner->>bindRunPlan: bindRunPlan(options)
bindRunPlan->>DefinitionGraph: locate entry and resolve reachable steps
bindRunPlan->>DefinitionGraph: resolve and validate inputs
bindRunPlan->>RunPlan: construct identifiers and timestamped plan
RunPlan-->>Planner: return bound RunPlan
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
|
I can't run this ultrareview because you've reached your trial's review limit. Trial plans have lower review limits than paid plans. Upgrade now to resume reviews. To help optimise your usage, you can tune cubic to get the most out of your usage limits:
|
There was a problem hiding this comment.
Review Summary
This PR introduces Run Plan binding functionality for the planner package, which binds Definition Graphs with entry points and inputs into concrete RunPlans for execution. The implementation includes transitive closure computation for reachable steps, input binding with validation, and comprehensive error handling.
Critical Issue Found
Performance Regression: The computeReachableSteps function contains a critical performance issue that must be fixed before merge. The array spread operators in lines 102-103 create unnecessary copies on every iteration, resulting in O(n²) complexity for the adjacency list construction.
Changes Reviewed
- ✅ New
bindRunPlanimplementation with proper validation - ✅ Error handling with appropriate
PlannerErrorcodes - ✅ Cross-cutting fix:
PipelineDefinition.inputschanged from array to object (maintains input names) - ✅ Updated IR validation to match new schema
- ✅ Comprehensive test coverage (58 passing tests)
The implementation is well-structured with clear separation of concerns. Once the performance issue is resolved, this will be ready to merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
MergerNeeds Review This is a substantial planner/API and secret-handling change, but Commit |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
PR Summary by QodoPlanner: add bindRunPlan RunPlan binding + preserve pipeline input names
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
There was a problem hiding this comment.
Pull Request Overview
The current implementation introduces a significant discrepancy with Spec 13 regarding reachability logic; the planner currently traverses both producers and dependents, whereas the specification mandates following only producer edges (backward traversal). Additionally, the reachability calculation lacks validation for referenced producers, which could lead to runtime failures if the graph contains broken references.
Codacy analysis indicates the PR is not up to standards, primarily due to high cyclomatic complexity in packages/planner/src/bind.ts. The computeReachableSteps function alone has a complexity of 18. Refactoring this logic into modular helpers is required to improve maintainability and ensure the core BFS logic is verifiable.
About this PR
- Discrepancy in reachability logic: The implementation and PR description specify a 'both directions' (forward and backward) transitive closure, whereas the updated Spec 13 (§ Data models) specifies following only 'dependencies[].producer' edges (backward).
1 comment outside of the diff
packages/ir/src/validate.ts
line 118⚪ LOW RISK
Suggestion: This validation function is reaching the complexity threshold. While currently readable, consider using a loop for checking required array properties to reduce the branching factor.function validatePipelineStructure(value: unknown): void { if (typeof value !== "object" || value === null) { throw new ValidationError("invalid pipeline: expected object"); } const p = value as Record<string, unknown>; if (typeof p.id !== "string") throw new ValidationError("invalid pipeline: missing 'id'"); if (typeof p.inputs !== "object" || p.inputs === null || Array.isArray(p.inputs)) { throw new ValidationError("invalid pipeline: missing 'inputs' object"); } for (const key of ["entries", "steps", "outputs"]) { if (!Array.isArray(p[key])) throw new ValidationError(`invalid pipeline: missing '${key}' array`); } for (const step of p.steps as any[]) { validateStepStructure(step); } }
Test suggestions
- bindRunPlan produces a RunPlan for a single-step graph
- bindRunPlan includes all reachable steps and excludes unrelated steps
- bindRunPlan resolves inputs correctly using defaults and user overrides
- bindRunPlan throws MISSING_INPUT for required inputs without a value
- bindRunPlan throws ENTRY_NOT_FOUND or ROOT_NOT_FOUND for invalid references
- bindRunPlan generates a deterministic ID excluding volatile fields
- computeReachableSteps handles transitive closure and diamond dependencies without duplicates
- computeReachableSteps returns empty list for empty roots
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
Code Review by Qodo
1.
|
3e7610c to
af258ed
Compare
af258ed to
5bed005
Compare
5bed005 to
984aac6
Compare
984aac6 to
adfa6db
Compare
fd48fb4 to
b585792
Compare
b585792 to
400396c
Compare
400396c to
c044fc4
Compare
be8931c to
e5563b9
Compare
2e04245 to
c853291
Compare
|
❌ The last analysis has failed. |
c853291 to
fda3d58
Compare
Rebuilt @sverka/planner with bindRunPlan: binds a Definition Graph's Entry + user inputs into a concrete RunPlan for the native engine. - bindRunPlan: selects reachable steps, binds inputs, computes IDs - computeReachableSteps: transitive closure from entry roots (both directions) - PlannerError: ENTRY_NOT_FOUND, ROOT_NOT_FOUND, MISSING_INPUT, INVALID_GRAPH - Reuses existing discovery + plan synthesis logic unchanged Changed PipelineDefinition.inputs from Input[] to Record<string, Input> to preserve input names through synthesis. Updated core, IR validation, and test fixtures accordingly. 58 planner tests pass (17 new bind tests + 41 existing). All 7 affected packages green: 229 tests total. No any types. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Search all pipelines in findEntry (not just the first one). - Validate dependency producers before building the RunPlan. - Follow only producer/prerequisite edges backward in computeReachableSteps. - Validate pipeline input descriptor fields (type, required, secret, description, default). - Omit secret input values from RunPlan.inputs and from the content-addressed plan ID. - Update graph and bind tests for record-based inputs and sink roots. Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
- Validate runtime graph shape in bindRunPlan before dereferencing fields. - Run core validateGraph on the selected pipeline to detect cycles and semantic errors. - Use an index-based queue in computeReachableSteps and mark nodes reachable on enqueue. - Validate input descriptor type for secret and optional inputs. - Add INVALID_INPUT PlannerErrorCode and use it for type-mismatched user/default values. - Update Spec 13 to document options-object contract, inputs record, INVALID_INPUT, and structural validation. Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
…ptors Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
Split validatePipelineInput (complexity 13→3) into per-field validators and validatePipelineShape (complexity 12→3) into field/child helpers. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
fda3d58 to
c06b5e0
Compare
|



User description
Summary
@sverka/plannerwithbindRunPlan: binds a Definition Graph's Entry + user inputs into a concrete RunPlan for the native enginecomputeReachableSteps: transitive closure from entry roots (both directions)PlannerError: ENTRY_NOT_FOUND, ROOT_NOT_FOUND, MISSING_INPUT, INVALID_GRAPHPipelineDefinition.inputschanged fromInput[]toRecord<string, Input>to preserve input names through synthesis. Updated core, IR validation, and test fixtures.Test plan
anytypesGenerated with Devin
Summary by cubic
Produces a deterministic RunPlan from a selected entry in
@sverka/planner, with fast-fail graph validation and secrets-safe plan IDs. Old: no binder. New:bindRunPlancomputes reachable steps, binds inputs, and omits secret values from the plan and its ID.@sverka/corevalidateGraphon the selected pipeline; malformed graphs, cycles, and unknowndependencies[].producerraisePlannerError("INVALID_GRAPH").ENTRY_NOT_FOUND/ROOT_NOT_FOUND.dependencies[].producerbackward from roots and excludes unrelated steps.Record<string, Input>; defaults merge with user overrides with strict type checks. Type mismatches raiseINVALID_INPUT; missing required values raiseMISSING_INPUT. Secret inputs are omitted fromRunPlan.inputsand excluded from@sverka/ircomputeRunPlanId.Planner.bindRunPlan(...);@sverka/plannerexportsbindRunPlan,computeReachableSteps, andPlannerError(addsINVALID_INPUT).RunPlanincludesgraphId, a content-addressedid, andcreatedAt.@sverka/plannernow depends on@sverka/coreand@sverka/ir.@sverka/corere-exports graph types.@sverka/irvalidator enforces inputs object shape and validatestype,required,secret,description, and default type consistency.Migration
PipelineDefinition.inputs: Input[]withRecord<string, Input>and update array iterations toObject.entries/Object.keys.Written for commit c06b5e0. Summary will update on new commits.
CodeAnt-AI Description
Bind definition graphs into executable run plans
What Changed
Impact
✅ Executable plans from selected pipeline entries✅ Unrelated steps excluded from runs✅ Clear errors for invalid entries and missing inputs💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.