feat: Add ChangeGraph release intelligence kit - #326
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds the ChangeGraph release-intelligence kit. It includes Lamatic flows, a Next.js dashboard, workflow archive parsing, structural and blast-radius analysis, deterministic risk scoring, server orchestration, API validation, and setup documentation. ChangesChangeGraph release intelligence
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
There was a problem hiding this comment.
Actionable comments posted: 18
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/changegraph-release-intelligence/.env.example`:
- Line 1: Remove the UTF-8 BOM from the first line of both environment
templates: kits/changegraph-release-intelligence/.env.example lines 1-1 and
kits/changegraph-release-intelligence/apps/.env.example lines 1-1. Save both
files as UTF-8 without a BOM while preserving their existing environment keys
and values.
In `@kits/changegraph-release-intelligence/agent.md`:
- Around line 1-3: Complete the agent.md documentation for analyze-change-impact
by adding the agent identity, purpose, capabilities, guardrails, input and
output flow descriptions, and integration reference required by the kit
guidelines. Replace the TODO placeholder while preserving the existing agent
name.
In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts`:
- Around line 219-259: Remove the silent change limits in the targeted-test
generation and buildDeterministicFallbackSemanticAnalysis flows so every change
is represented, or explicitly record any intentional truncation in releaseNotes,
unknowns, and warnings. Ensure the resulting plan clearly communicates omitted
changes to operators rather than implying complete coverage.
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 143-165: Update the unauthenticated POST endpoint and its request
path around orchestrateChangeGraph to enforce per-IP rate limiting, including
oversized-request protection, and cap concurrent flow executions per client or
globally. Track and emit flow-execution count and latency metrics around each
orchestrated execution, while preserving the existing content-type validation
and response behavior.
- Around line 95-123: Remove the redundant missing-environment-variable
conditional from determineErrorStatus, since it returns the same 500 status as
the fallback. Preserve the existing 502 classification and the final 500
fallback.
- Around line 167-222: Update the request-size guard in the analyze route so the
pre-read check does not treat a missing Content-Length as valid; the logic
around request.headers.get("content-length") and request.text() should reject
chunked or undecared-length uploads before buffering, or enforce
MAX_REQUEST_BYTES while streaming. Keep the existing oversized-response paths in
place, and anchor the fix in the analyze route flow that currently computes
declaredLength, reads rawBody, and checks actualBytes.
In `@kits/changegraph-release-intelligence/apps/lib/blast-radius.ts`:
- Around line 176-181: Update isResourceChange to exclude components already
resolved as flow/node identifiers and require a recognized file extension before
entering the resource path. Ensure node and schema components such as flow/name
or flow/name->... are not classified as resources, while genuine file-reference
components continue through the existing resource handling.
- Around line 503-526: Refactor seed collection to have addSeed deduplicate with
a Set keyed by flowPath::nodeId::changeId instead of scanning seeds with
some(...). In the flow-level traversal logic, cache nodeMap(flow) and
buildAdjacency(flow) once per flow and reuse those maps for every seed. Update
traverseSeed to track distinct paths per node and stop enqueueing paths once
MAX_PATHS_PER_NODE is reached, while preserving traversal behavior for paths
within the cap.
In `@kits/changegraph-release-intelligence/apps/lib/change-package.ts`:
- Around line 22-35: Centralize category definitions and counting: in
kits/changegraph-release-intelligence/apps/lib/change-package.ts:22-35, export
CHANGE_CATEGORIES as const satisfies readonly ChangeCategory[] and retain
createCategoryCounts as the sole counter; in
kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts:21-34,
remove the local array and calculateCategoryCounts and import
createCategoryCounts from `@/lib/change-package`; in
kits/changegraph-release-intelligence/apps/lib/schemas.ts:383-396, build
CategoryCountsSchema from CHANGE_CATEGORIES and NonNegativeIntegerSchema so new
categories are included automatically.
In `@kits/changegraph-release-intelligence/apps/lib/flow-parser.ts`:
- Around line 439-444: Update the bare assignment regex in flow-parser’s pattern
list so it only matches environment-style variable declarations, not any
uppercase assignment or Markdown-like text. Keep the other three patterns
unchanged, and tighten the existing
/^\s*(?:export\s+)?([A-Z][A-Z0-9_]{2,})\s*=/m-style match by restricting it
within the same pattern block in flow-parser so
WorkflowPackageSummary.environmentReferences only collects likely env vars.
In `@kits/changegraph-release-intelligence/apps/lib/risk-score.ts`:
- Around line 93-138: Update countTerms to count every occurrence of each term
in the serialized value rather than returning one count per term, including
repeated and non-overlapping matches. Keep safetyInstructionRemoved using the
resulting beforeCount and afterCount comparison so reductions in repeated safety
instructions trigger the existing rule.
- Around line 382-482: Update schemaLooksBreaking and the schema-fact collection
flow to parse JSON-encoded schema strings before calling collectSchemaFacts,
while preserving already-structured object and array inputs. Ensure both
change.before and change.after use the parsed values so additive optional fields
are evaluated structurally rather than falling through to the generic
text-difference result.
In `@kits/changegraph-release-intelligence/apps/lib/schemas.ts`:
- Around line 61-91: Update ConfidenceSchema to reject or otherwise explicitly
handle the ambiguous value 1 rather than treating it as normalized 100%
confidence; preserve percentage conversion for values above 1. Replace
RiskScoreSchema’s z.coerce.number() with explicit numeric validation so null,
empty strings, arrays, and other non-numeric inputs are rejected instead of
becoming zero, while retaining the 0–100 bounds and integer rounding.
In `@kits/changegraph-release-intelligence/apps/lib/structural-diff.ts`:
- Around line 17-30: Update VOLATILE_KEYS and normalizeForComparison so
positional keys width, height, x, and y are stripped only within node position
objects, not from arbitrary nested configuration objects; preserve removal of
the other volatile keys at every depth.
- Around line 203-246: Update inferNodeCategory to use one ordered category
chain: remove the duplicate fallback branch and place the schema check before
the model check so configurations containing both schema and model fields
classify as schema. Preserve the existing fallback and retry checks without
adding additional classification logic.
In `@kits/changegraph-release-intelligence/flows/generate-release-plan.ts`:
- Line 59: Update the riskScore type in the advance_schema declaration and the
response schema near the flow output to number instead of string, preserving it
as a numeric value throughout the release-plan flow.
In
`@kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.md`:
- Line 78: Separate the instruction sections in the prompt by adding a newline
after “Do not invent runtime measurements, failures, or performance effects.”
and before “LOW-RISK CALIBRATION RULES:”.
In
`@kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md`:
- Line 1: Update the opening identity instruction in the release-planning agent
prompt to remove the fused “AssistantYou” text and separate the intended
identity statement into one clear, grammatically correct instruction.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 24534a49-8eef-4f9d-ac55-35a376ed8091
⛔ Files ignored due to path filters (2)
kits/changegraph-release-intelligence/apps/app/favicon.icois excluded by!**/*.icokits/changegraph-release-intelligence/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (38)
kits/changegraph-release-intelligence/.env.examplekits/changegraph-release-intelligence/.gitignorekits/changegraph-release-intelligence/README.mdkits/changegraph-release-intelligence/agent.mdkits/changegraph-release-intelligence/apps/.env.examplekits/changegraph-release-intelligence/apps/.gitignorekits/changegraph-release-intelligence/apps/README.mdkits/changegraph-release-intelligence/apps/actions/orchestrate.tskits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/app/globals.csskits/changegraph-release-intelligence/apps/app/layout.tsxkits/changegraph-release-intelligence/apps/app/page.tsxkits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsxkits/changegraph-release-intelligence/apps/eslint.config.mjskits/changegraph-release-intelligence/apps/lib/archive-reader.tskits/changegraph-release-intelligence/apps/lib/blast-radius.tskits/changegraph-release-intelligence/apps/lib/change-package.tskits/changegraph-release-intelligence/apps/lib/flow-parser.tskits/changegraph-release-intelligence/apps/lib/lamatic-client.tskits/changegraph-release-intelligence/apps/lib/risk-score.tskits/changegraph-release-intelligence/apps/lib/schemas.tskits/changegraph-release-intelligence/apps/lib/secret-redactor.tskits/changegraph-release-intelligence/apps/lib/structural-diff.tskits/changegraph-release-intelligence/apps/next.config.tskits/changegraph-release-intelligence/apps/package.jsonkits/changegraph-release-intelligence/apps/postcss.config.mjskits/changegraph-release-intelligence/apps/tsconfig.jsonkits/changegraph-release-intelligence/apps/types/changegraph.tskits/changegraph-release-intelligence/constitutions/default.mdkits/changegraph-release-intelligence/flows/analyze-change-impact.tskits/changegraph-release-intelligence/flows/generate-release-plan.tskits/changegraph-release-intelligence/lamatic.config.tskits/changegraph-release-intelligence/model-configs/analyze-change-impact_instructor-llmnode-356-copy-979_generative-model-name.tskits/changegraph-release-intelligence/model-configs/generate-release-plan_instructor-llmnode-863_generative-model-name.tskits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_system_0.mdkits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.mdkits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.mdkits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_user_1.md
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
Studio Runtime Validation (Phase 2)✅ Studio validation passed. The kit loaded successfully in Lamatic Studio. This PR is ready for final review and merge. |
|
@Mayankverma210405 PR LGTM! there are some coderabbit comments left please resolve them |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
kits/changegraph-release-intelligence/apps/actions/orchestrate.ts (1)
679-706: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winThe override is partial, so a mismatched plan reports a blocked release with zero blockers.
The deterministic override protects
riskScoreandpromotionDecision. It leaves every decision-dependent field from the model untouched.Trace the mismatch case. The release-plan flow validates successfully and returns
promotionDecision: "safe_to_promote",blockers: [], anddecisionSummary: "The candidate is safe to promote."The deterministic engine returnsblock_release. Line 703 rewritespromotionDecisiontoblock_release.blockers,decisionSummary, anddeploymentChecklistkeep the model's safe-release content.The operator then reads a plan that states the release is blocked, lists no blocker, and summarizes the candidate as safe.
deploymentCheckliststill instructs promotion. The warning at line 692 is in a separate array and does not repair the plan body.This is the exact scenario the deterministic authority is meant to cover, so the plan must stay self-consistent. When the decision mismatches, discard the model plan and use the deterministic one.
🐛 Proposed fix: fall back to the deterministic plan on a decision mismatch
+ const decisionMismatch = + generatedReleasePlan.promotionDecision !== + deterministicRisk.decision; + if ( generatedReleasePlan.promotionDecision !== deterministicRisk.decision ) { warnings.push( `The release-plan flow returned "${generatedReleasePlan.promotionDecision}", but the deterministic engine decided "${deterministicRisk.decision}". The deterministic decision was preserved.`, ); } + /* + * A mismatched decision invalidates every decision-dependent field + * in the generated plan, including blockers, decisionSummary, and + * deploymentChecklist. Rebuild the plan deterministically. + */ + const basePlan = decisionMismatch + ? buildDeterministicFallbackReleasePlan( + input, + semanticAnalysis, + `The release-plan flow returned "${generatedReleasePlan.promotionDecision}" instead of "${deterministicRisk.decision}".`, + ) + : generatedReleasePlan; + const releasePlan: ReleasePlan = { - ...generatedReleasePlan, + ...basePlan, // AI output must not override deterministic safety controls. riskScore: deterministicRisk.score, promotionDecision: normalizeDecision( deterministicRisk.decision, ), };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts` around lines 679 - 706, Update the release-plan construction around generatedReleasePlan and deterministicRisk so that any promotionDecision mismatch discards the model plan and uses the complete deterministic plan instead of only overriding riskScore and promotionDecision. Preserve the existing warning behavior, and ensure blockers, decisionSummary, deploymentChecklist, and all other decision-dependent fields remain consistent with deterministicRisk.kits/changegraph-release-intelligence/apps/lib/change-package.ts (1)
22-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd an exhaustiveness guard for
CHANGE_CATEGORIES.
as const satisfies readonly ChangeCategory[]rejects invalid members, but it allows missing members. If aChangeCategoryvalue is added whileCHANGE_CATEGORIESstays at twelve entries,createCategoryCountsleaves that key asundefined; incrementing it producesNaN; andchangePackage.summary.categoryCountsfailsChangePackageSchema, so the analyze route returns 400. Add a type-level assertion that fails the build whenChangeCategoryhas a value omitted fromCHANGE_CATEGORIES.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/lib/change-package.ts` around lines 22 - 35, Add a type-level exhaustiveness assertion adjacent to CHANGE_CATEGORIES that verifies every ChangeCategory member is represented, while retaining the existing invalid-member validation. Ensure adding a new ChangeCategory without updating CHANGE_CATEGORIES causes a compile-time failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 58-123: Update clientKey() to derive the identifier from the
deployment’s trusted platform client-address helper, removing direct reliance on
the leftmost x-forwarded-for value. Update consumeRateLimit() to purge expired
requestCounts entries before any new-key insertion, while preserving the
existing rate-limit behavior and MAX_REQUESTS_PER_WINDOW enforcement.
In `@kits/changegraph-release-intelligence/apps/lib/schemas.ts`:
- Around line 55-95: Update ConfidenceSchema to accept the ambiguous value 1
instead of adding a validation issue or returning z.NEVER; normalize it to full
confidence (1) while preserving the existing finite-range checks and percentage
conversion for other values. Keep the semantic-analysis payload valid so
parseSemanticAnalysisPayload does not trigger the deterministic fallback and
discard model findings.
In
`@kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md`:
- Line 48: Resolve the conflicting blocker rules in the release-plan
instructions by explicitly defining precedence between the deterministic safe
decision and the unresolved high/critical-risk exception. Update the guidance
around promotionDecision, riskScore, and blockers so the model produces one
unambiguous outcome for inputs satisfying both conditions, while preserving the
evidence requirement for high or critical priority.
---
Outside diff comments:
In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts`:
- Around line 679-706: Update the release-plan construction around
generatedReleasePlan and deterministicRisk so that any promotionDecision
mismatch discards the model plan and uses the complete deterministic plan
instead of only overriding riskScore and promotionDecision. Preserve the
existing warning behavior, and ensure blockers, decisionSummary,
deploymentChecklist, and all other decision-dependent fields remain consistent
with deterministicRisk.
In `@kits/changegraph-release-intelligence/apps/lib/change-package.ts`:
- Around line 22-35: Add a type-level exhaustiveness assertion adjacent to
CHANGE_CATEGORIES that verifies every ChangeCategory member is represented,
while retaining the existing invalid-member validation. Ensure adding a new
ChangeCategory without updating CHANGE_CATEGORIES causes a compile-time failure.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c5dc2301-051e-4d86-8d94-fa9e8bd5b5a5
📒 Files selected for processing (14)
kits/changegraph-release-intelligence/.env.examplekits/changegraph-release-intelligence/agent.mdkits/changegraph-release-intelligence/apps/.env.examplekits/changegraph-release-intelligence/apps/actions/orchestrate.tskits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/lib/blast-radius.tskits/changegraph-release-intelligence/apps/lib/change-package.tskits/changegraph-release-intelligence/apps/lib/flow-parser.tskits/changegraph-release-intelligence/apps/lib/risk-score.tskits/changegraph-release-intelligence/apps/lib/schemas.tskits/changegraph-release-intelligence/apps/lib/structural-diff.tskits/changegraph-release-intelligence/flows/generate-release-plan.tskits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.mdkits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
kits/changegraph-release-intelligence/apps/actions/orchestrate.ts (2)
679-719: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMission: rebuild the plan when the deterministic score differs.
A score mismatch only produces a warning. The final plan then combines the deterministic
riskScorewith model-generateddecisionSummary,blockers, and checklist fields that can describe a different score.Include the score mismatch in the fallback condition. This keeps all score-dependent fields consistent with the authoritative deterministic value.
Based on PR objective: the deterministic risk score and promotion decision are authoritative.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts` around lines 679 - 719, Update the fallback condition for basePlan to rebuild via buildDeterministicFallbackReleasePlan when either decisionMismatch or the deterministic risk score differs from generatedReleasePlan.riskScore. Preserve the existing warning behavior and ensure the final releasePlan uses one consistent deterministic score across all score-dependent fields.
570-574: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winMove Lamatic-envelope unwrapping into the fallback catch blocks.
unwrapLamaticResult()throws an opaque envelope error for non-success responses, so the failure happens beforeparseSemanticAnalysisPayloadandparseReleasePlanPayloadenter their deterministic fallback catches. Put each unwrap in its correspondingtryblock around parsing and fall back to the deterministic payload.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts` around lines 570 - 574, Move the unwrapLamaticResult call for analysisResponse into the try block that invokes parseSemanticAnalysisPayload, so envelope failures are handled by that parser’s deterministic fallback catch. Apply the same change to the release-plan response and parseReleasePlanPayload flow, preserving each existing deterministic fallback payload.kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts (1)
506-510: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winMission: bind blast-radius data to server-verified graph data.
calculateRiskAssessmentuses onlyblastRadius.indirectlyAffectedNodeIds.lengthfor thewide-blast-radiuscontribution. This count comes from the request body after Zod validation, whilestructuralDiffcomes fromchangePackage.changes. A caller can submit an empty request-supplied blast-radius and receive fewer score points. ComputeblastRadiusfromstructuralDiff/server-verifiable workflow graph data, or validate that the submitted blast-radius nodes and ids are bound to the changes that producedstructuralDiff.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts` around lines 506 - 510, Update the risk-assessment flow around calculateRiskAssessment so the blast-radius data cannot be reduced or spoofed through the request body. Derive blastRadius from structuralDiff and server-verified workflow graph data, or validate that submitted blast-radius nodes and IDs correspond to the changes producing structuralDiff before passing it to calculateRiskAssessment; preserve the existing wide-blast-radius scoring behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@kits/changegraph-release-intelligence/apps/actions/orchestrate.ts`:
- Around line 679-719: Update the fallback condition for basePlan to rebuild via
buildDeterministicFallbackReleasePlan when either decisionMismatch or the
deterministic risk score differs from generatedReleasePlan.riskScore. Preserve
the existing warning behavior and ensure the final releasePlan uses one
consistent deterministic score across all score-dependent fields.
- Around line 570-574: Move the unwrapLamaticResult call for analysisResponse
into the try block that invokes parseSemanticAnalysisPayload, so envelope
failures are handled by that parser’s deterministic fallback catch. Apply the
same change to the release-plan response and parseReleasePlanPayload flow,
preserving each existing deterministic fallback payload.
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 506-510: Update the risk-assessment flow around
calculateRiskAssessment so the blast-radius data cannot be reduced or spoofed
through the request body. Derive blastRadius from structuralDiff and
server-verified workflow graph data, or validate that submitted blast-radius
nodes and IDs correspond to the changes producing structuralDiff before passing
it to calculateRiskAssessment; preserve the existing wide-blast-radius scoring
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6a8af3df-6718-4fb8-9036-e61f2b1fc8a8
⛔ Files ignored due to path filters (1)
kits/changegraph-release-intelligence/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
kits/changegraph-release-intelligence/apps/actions/orchestrate.tskits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/lib/change-package.tskits/changegraph-release-intelligence/apps/lib/schemas.tskits/changegraph-release-intelligence/apps/package.jsonkits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts (1)
490-546: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftKeep unbounded graph traversal behind the execution guard. Caller-supplied
baselineGraphandcandidateGraphcan drive the deterministic traversal before the execution slot is acquired, while the schema accepts node/edge arrays without size limits.
- Move
calculateBlastRadiusandcalculateRiskAssessmentto afteracquireExecutionSlotat/kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts:549soMAX_GLOBAL_CONCURRENTbounds this phase as well. Release the slot in the existingfinally.- Add explicit node and edge count limits to
WorkflowGraphFlowSchemain/kits/changegraph-release-intelligence/apps/lib/schemas.tsso oversized graphs fail validation beforecalculateBlastRadiusruns.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts` around lines 490 - 546, Move the calculateBlastRadius and calculateRiskAssessment calls in the analyze route to execute only after acquireExecutionSlot, keeping slot release in the existing finally block so this traversal is concurrency-bounded. In WorkflowGraphFlowSchema, add explicit maximum counts for nodes and edges so oversized baselineGraph and candidateGraph inputs fail validation before traversal; apply the corresponding schema change in blast-radius.ts at lines 674-698 as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/changegraph-release-intelligence/apps/lib/schemas.ts`:
- Around line 687-744: Normalize workflow summary paths consistently with graph
snapshots before validation. Update verifyGraphSummary to apply the same path
normalization used by createWorkflowGraphSnapshot to summary.flowPaths, or
derive the summary from the shared ParsedWorkflowExport; preserve the existing
flow-path mismatch issue only for genuinely different normalized paths.
---
Outside diff comments:
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 490-546: Move the calculateBlastRadius and calculateRiskAssessment
calls in the analyze route to execute only after acquireExecutionSlot, keeping
slot release in the existing finally block so this traversal is
concurrency-bounded. In WorkflowGraphFlowSchema, add explicit maximum counts for
nodes and edges so oversized baselineGraph and candidateGraph inputs fail
validation before traversal; apply the corresponding schema change in
blast-radius.ts at lines 674-698 as well.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 28b90661-917e-4f1e-ac5a-3e07c82e9144
📒 Files selected for processing (7)
kits/changegraph-release-intelligence/apps/actions/orchestrate.tskits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsxkits/changegraph-release-intelligence/apps/lib/blast-radius.tskits/changegraph-release-intelligence/apps/lib/change-package.tskits/changegraph-release-intelligence/apps/lib/schemas.tskits/changegraph-release-intelligence/apps/types/changegraph.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts (1)
499-528: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winMove the execution slot acquisition adjacent to the
trythat releases it.Agent, observe the gap.
acquireExecutionSlotruns at line 500. Thetry...finallythat callsreleaseExecutionSlotopens at line 528. Lines 520-524 execute between them. If any statement in that window throws, the outercatchat line 682 returns a 500 and the slot is never released.activeGlobalExecutionsthen stays incremented for the lifetime of the process. After four such failures the route returns 503 to every client until redeploy.
crypto.randomUUID()andperformance.now()are unlikely to throw today. The hazard is structural: any future statement added to that window leaks a global counter with no recovery path.Move
requestIdandexecutionStartedAtinside thetry, or open thetryimmediately after the slot is acquired.♻️ Proposed restructure
let flowExecutionCount = 0; + const requestId = + crypto.randomUUID(); + + const executionStartedAt = + performance.now(); + try {Remove the earlier declarations:
- const requestId = - crypto.randomUUID(); - - const executionStartedAt = - performance.now(); - let flowExecutionCount = 0;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts` around lines 499 - 528, Move the try boundary in the route handler so it begins immediately after acquireExecutionSlot confirms executionSlot.allowed, ensuring every subsequent statement is covered by the existing finally that calls releaseExecutionSlot. Relocate requestId and executionStartedAt inside that try block, while preserving the current rejection response and normal execution flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 499-528: Move the try boundary in the route handler so it begins
immediately after acquireExecutionSlot confirms executionSlot.allowed, ensuring
every subsequent statement is covered by the existing finally that calls
releaseExecutionSlot. Relocate requestId and executionStartedAt inside that try
block, while preserving the current rejection response and normal execution
flow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a8b46237-b8b3-40ea-982e-209e8551444e
📒 Files selected for processing (3)
kits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/lib/blast-radius.tskits/changegraph-release-intelligence/apps/lib/schemas.ts
|
@akshatvirmani coderabbit comments resolved and [Lamatic/AgentKit] Run failed: (Phase 2 testing) |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts`:
- Around line 580-581: Update the flow-execution counter around
orchestrateChangeGraph so it is initialized to zero and incremented or assigned
only after flows complete, rather than preset to FLOW_EXECUTIONS_PER_ANALYSIS
before execution begins. Ensure the error path reports the number of completed
executions, including zero when the first flow fails; if partial-failure
attribution is required, have orchestrateChangeGraph return the executed-flow
count.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c96d83e3-0e4b-43bf-99ec-3ec042a3fc2a
📒 Files selected for processing (3)
kits/changegraph-release-intelligence/apps/app/api/analyze/route.tskits/changegraph-release-intelligence/apps/lib/blast-radius.tskits/changegraph-release-intelligence/apps/lib/schemas.ts
| flowExecutionCount = | ||
| FLOW_EXECUTIONS_PER_ANALYSIS; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
The flow-execution counter reports two executions before either one runs.
You set flowExecutionCount to FLOW_EXECUTIONS_PER_ANALYSIS at line 580, then call orchestrateChangeGraph at line 583. If the first Lamatic flow throws, the error branch at lines 665-677 still logs flowExecutionCount: 2.
orchestrateChangeGraph executes the semantic-analysis flow first and the release-plan flow second, and it catches only parse failures, not transport failures. A provider outage on flow 1 therefore records two executions that never billed.
This metric exists to make spend anomalies visible. An always-2 counter cannot do that. Count the executions that completed.
📊 Proposed fix: report the attempted count separately from the completed count
- flowExecutionCount =
- FLOW_EXECUTIONS_PER_ANALYSIS;
-
const orchestration =
await orchestrateChangeGraph({Then set the counter after the call resolves:
const orchestration =
await orchestrateChangeGraph({
...
});
+ flowExecutionCount =
+ FLOW_EXECUTIONS_PER_ANALYSIS;
+
console.info(The error branch then logs 0, which is accurate for a failure before completion. If you need partial-failure attribution, return the executed-flow count from orchestrateChangeGraph instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts` around
lines 580 - 581, Update the flow-execution counter around orchestrateChangeGraph
so it is initialized to zero and incremented or assigned only after flows
complete, rather than preset to FLOW_EXECUTIONS_PER_ANALYSIS before execution
begins. Ensure the error path reports the number of completed executions,
including zero when the first flow fails; if partial-failure attribution is
required, have orchestrateChangeGraph return the executed-flow count.
Summary
Adds ChangeGraph, a pre-deployment semantic change-intelligence and safe-promotion kit for Lamatic workflows.
ChangeGraph compares baseline and candidate workflow exports, identifies structural changes, calculates downstream blast radius, applies deterministic risk scoring, and generates semantic findings, targeted tests, deployment checks, and rollback guidance.
Included
analyze-change-impactLamatic flowgenerate-release-planLamatic flowValidation
@referencepaths resolve.env.localis excludedkits/changegraph-release-intelligence/Live demo
https://changegraph-release-intelligence.vercel.app
Notes
The deterministic risk score and promotion decision are authoritative. Lamatic model output provides semantic explanation and planning assistance but cannot override the deterministic release decision.
kits/changegraph-release-intelligence.analyze-change-impact:triggerNode→InstructorLLMNode→responseNode. It performs structured semantic impact analysis.generate-release-plan:triggerNode→InstructorLLMNode→responseNode. It generates blockers, targeted tests, deployment steps, rollback data, and release notes./api/analyzeprocessing, report rendering, and responsive styling.