Skip to content

feat: Add ChangeGraph release intelligence kit - #326

Open
Mayankverma210405 wants to merge 8 commits into
Lamatic:mainfrom
Mayankverma210405:feat/changegraph-release-intelligence
Open

feat: Add ChangeGraph release intelligence kit#326
Mayankverma210405 wants to merge 8 commits into
Lamatic:mainfrom
Mayankverma210405:feat/changegraph-release-intelligence

Conversation

@Mayankverma210405

@Mayankverma210405 Mayankverma210405 commented Aug 5, 2026

Copy link
Copy Markdown

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-impact Lamatic flow
  • generate-release-plan Lamatic flow
  • Runnable Next.js application
  • Browser-side ZIP parsing
  • Secret redaction
  • Structural workflow diffing
  • Blast-radius analysis
  • Deterministic risk scoring
  • Safe, manual-review, and blocked-release decisions
  • Deterministic fallbacks for malformed AI output
  • Targeted test generation
  • Rollback manifest generation
  • Environment templates and setup documentation

Validation

  • TypeScript validation passes
  • ESLint passes
  • Production build succeeds
  • Production dependency audit reports zero vulnerabilities
  • Both Lamatic flows are deployed
  • Identical-flow scenario tested
  • Moderate-risk scenario tested
  • High-risk blocked-release scenario tested
  • Invalid AI-output fallback tested
  • All @reference paths resolve
  • .env.local is excluded
  • PR modifies only kits/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.

  • Added the ChangeGraph release-intelligence kit under kits/changegraph-release-intelligence.
  • Added environment templates, ignore rules, setup documentation, and a default constitution.
  • Added two Lamatic flows:
    • analyze-change-impact: triggerNodeInstructorLLMNoderesponseNode. It performs structured semantic impact analysis.
    • generate-release-plan: triggerNodeInstructorLLMNoderesponseNode. It generates blockers, targeted tests, deployment steps, rollback data, and release notes.
  • Added Lamatic configuration, flow prompts, and Groq Llama 3.3 70B model configurations.
  • Added a Next.js application with ZIP upload, browser-side parsing, server-side /api/analyze processing, report rendering, and responsive styling.
  • Added secure archive processing with file limits, path validation, binary filtering, and secret redaction.
  • Added safe workflow parsing without executing exported TypeScript.
  • Added deterministic structural diffing for flows, nodes, edges, schemas, and supporting files.
  • Added blast-radius analysis with downstream graph traversal and affected-node tracking.
  • Added deterministic risk scoring for schema, permission, safety, model, prompt, edge, and downstream changes.
  • Added sanitized change-package generation with stable ordering.
  • Added Zod validation for analysis requests, semantic results, release plans, and cross-field consistency.
  • Added Lamatic client configuration, flow execution, error handling, and server-only credential checks.
  • Added orchestration with AI response validation and deterministic fallbacks.
  • Added safe, manual-review, and blocked promotion decisions.
  • Added targeted test and rollback manifest generation.
  • Added shared TypeScript models for parsed workflows, diffs, blast radius, risk, semantic findings, and release plans.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This 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.

Changes

ChangeGraph release intelligence

Layer / File(s) Summary
Kit definition and operating docs
kits/changegraph-release-intelligence/README.md, kits/changegraph-release-intelligence/lamatic.config.ts, kits/changegraph-release-intelligence/flows/*, kits/changegraph-release-intelligence/prompts/*, kits/changegraph-release-intelligence/model-configs/*, kits/changegraph-release-intelligence/.env.example, kits/changegraph-release-intelligence/apps/.env.example, kits/changegraph-release-intelligence/.../.gitignore, kits/changegraph-release-intelligence/apps/README.md, kits/changegraph-release-intelligence/constitutions/default.md, kits/changegraph-release-intelligence/agent.md
Adds kit metadata, flow definitions, prompts, model configurations, environment examples, ignore rules, constitution, and documentation for setup, pipeline behavior, fallback handling, and limits.
App shell and dashboard
kits/changegraph-release-intelligence/apps/package.json, kits/changegraph-release-intelligence/apps/{eslint.config.mjs,postcss.config.mjs,tsconfig.json,next.config.ts}, kits/changegraph-release-intelligence/apps/app/*, kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx
Adds the Next.js application scaffold, root layout, dark-theme styles, upload workflow, release metadata form, analysis controls, report display, reset behavior, and warning rendering.
Workflow ingestion and comparison
kits/changegraph-release-intelligence/apps/types/changegraph.ts, kits/changegraph-release-intelligence/apps/lib/{secret-redactor,archive-reader,flow-parser,structural-diff,blast-radius,change-package}.ts
Adds shared report and workflow types, secret redaction, ZIP ingestion with limits, non-executing workflow parsing, structural diff generation, blast-radius traversal, and deterministic change-package serialization.
Validation and deterministic scoring
kits/changegraph-release-intelligence/apps/lib/{schemas,risk-score}.ts
Adds request and payload schemas, JSON extraction and validation helpers, change-package consistency checks, deterministic risk rules, score thresholds, and promotion decisions.
Server execution and report assembly
kits/changegraph-release-intelligence/apps/lib/lamatic-client.ts, kits/changegraph-release-intelligence/apps/actions/orchestrate.ts, kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
Adds validated Lamatic client access, semantic-analysis and release-plan orchestration, deterministic fallback generation, authoritative risk and decision overrides, and the POST /api/analyze route. Routes validate requests, recalculate risk, execute analysis, and return no-cache reports.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the project and validation, but it omits the required checklist sections and several repository requirement confirmations. Add the template checklist, select Kit, and confirm scope, secrets, naming, file structure, local validation, CI status, and review-comment resolution.
Docstring Coverage ⚠️ Warning Docstring coverage is 6.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the addition of the ChangeGraph release intelligence kit.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/changegraph-release-intelligence

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between adcfa70 and 269a784.

⛔ Files ignored due to path filters (2)
  • kits/changegraph-release-intelligence/apps/app/favicon.ico is excluded by !**/*.ico
  • kits/changegraph-release-intelligence/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (38)
  • kits/changegraph-release-intelligence/.env.example
  • kits/changegraph-release-intelligence/.gitignore
  • kits/changegraph-release-intelligence/README.md
  • kits/changegraph-release-intelligence/agent.md
  • kits/changegraph-release-intelligence/apps/.env.example
  • kits/changegraph-release-intelligence/apps/.gitignore
  • kits/changegraph-release-intelligence/apps/README.md
  • kits/changegraph-release-intelligence/apps/actions/orchestrate.ts
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/app/globals.css
  • kits/changegraph-release-intelligence/apps/app/layout.tsx
  • kits/changegraph-release-intelligence/apps/app/page.tsx
  • kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx
  • kits/changegraph-release-intelligence/apps/eslint.config.mjs
  • kits/changegraph-release-intelligence/apps/lib/archive-reader.ts
  • kits/changegraph-release-intelligence/apps/lib/blast-radius.ts
  • kits/changegraph-release-intelligence/apps/lib/change-package.ts
  • kits/changegraph-release-intelligence/apps/lib/flow-parser.ts
  • kits/changegraph-release-intelligence/apps/lib/lamatic-client.ts
  • kits/changegraph-release-intelligence/apps/lib/risk-score.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts
  • kits/changegraph-release-intelligence/apps/lib/secret-redactor.ts
  • kits/changegraph-release-intelligence/apps/lib/structural-diff.ts
  • kits/changegraph-release-intelligence/apps/next.config.ts
  • kits/changegraph-release-intelligence/apps/package.json
  • kits/changegraph-release-intelligence/apps/postcss.config.mjs
  • kits/changegraph-release-intelligence/apps/tsconfig.json
  • kits/changegraph-release-intelligence/apps/types/changegraph.ts
  • kits/changegraph-release-intelligence/constitutions/default.md
  • kits/changegraph-release-intelligence/flows/analyze-change-impact.ts
  • kits/changegraph-release-intelligence/flows/generate-release-plan.ts
  • kits/changegraph-release-intelligence/lamatic.config.ts
  • kits/changegraph-release-intelligence/model-configs/analyze-change-impact_instructor-llmnode-356-copy-979_generative-model-name.ts
  • kits/changegraph-release-intelligence/model-configs/generate-release-plan_instructor-llmnode-863_generative-model-name.ts
  • kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_system_0.md
  • kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.md
  • kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md
  • kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_user_1.md

Comment thread kits/changegraph-release-intelligence/.env.example Outdated
Comment thread kits/changegraph-release-intelligence/agent.md Outdated
Comment thread kits/changegraph-release-intelligence/apps/actions/orchestrate.ts
Comment thread kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
Comment thread kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
Comment thread kits/changegraph-release-intelligence/apps/lib/structural-diff.ts
Comment thread kits/changegraph-release-intelligence/apps/lib/structural-diff.ts
Comment thread kits/changegraph-release-intelligence/flows/generate-release-plan.ts Outdated
@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation passed. The kit loaded successfully in Lamatic Studio.

This PR is ready for final review and merge.

@akshatvirmani

Copy link
Copy Markdown
Contributor

@Mayankverma210405 PR LGTM!

there are some coderabbit comments left please resolve them

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

The override is partial, so a mismatched plan reports a blocked release with zero blockers.

The deterministic override protects riskScore and promotionDecision. 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: [], and decisionSummary: "The candidate is safe to promote." The deterministic engine returns block_release. Line 703 rewrites promotionDecision to block_release. blockers, decisionSummary, and deploymentChecklist keep 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. deploymentChecklist still 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 win

Add an exhaustiveness guard for CHANGE_CATEGORIES.

as const satisfies readonly ChangeCategory[] rejects invalid members, but it allows missing members. If a ChangeCategory value is added while CHANGE_CATEGORIES stays at twelve entries, createCategoryCounts leaves that key as undefined; incrementing it produces NaN; and changePackage.summary.categoryCounts fails ChangePackageSchema, so the analyze route returns 400. Add a type-level assertion that fails the build when ChangeCategory has a value omitted from CHANGE_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

📥 Commits

Reviewing files that changed from the base of the PR and between 269a784 and bf7944d.

📒 Files selected for processing (14)
  • kits/changegraph-release-intelligence/.env.example
  • kits/changegraph-release-intelligence/agent.md
  • kits/changegraph-release-intelligence/apps/.env.example
  • kits/changegraph-release-intelligence/apps/actions/orchestrate.ts
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/lib/blast-radius.ts
  • kits/changegraph-release-intelligence/apps/lib/change-package.ts
  • kits/changegraph-release-intelligence/apps/lib/flow-parser.ts
  • kits/changegraph-release-intelligence/apps/lib/risk-score.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts
  • kits/changegraph-release-intelligence/apps/lib/structural-diff.ts
  • kits/changegraph-release-intelligence/flows/generate-release-plan.ts
  • kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.md
  • kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md

Comment thread kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
Comment thread kits/changegraph-release-intelligence/apps/lib/schemas.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Mission: rebuild the plan when the deterministic score differs.

A score mismatch only produces a warning. The final plan then combines the deterministic riskScore with model-generated decisionSummary, 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 win

Move Lamatic-envelope unwrapping into the fallback catch blocks.

unwrapLamaticResult() throws an opaque envelope error for non-success responses, so the failure happens before parseSemanticAnalysisPayload and parseReleasePlanPayload enter their deterministic fallback catches. Put each unwrap in its corresponding try block 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 win

Mission: bind blast-radius data to server-verified graph data.

calculateRiskAssessment uses only blastRadius.indirectlyAffectedNodeIds.length for the wide-blast-radius contribution. This count comes from the request body after Zod validation, while structuralDiff comes from changePackage.changes. A caller can submit an empty request-supplied blast-radius and receive fewer score points. Compute blastRadius from structuralDiff/server-verifiable workflow graph data, or validate that the submitted blast-radius nodes and ids are bound to the changes that produced structuralDiff.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between bf7944d and 01e3a9b.

⛔ Files ignored due to path filters (1)
  • kits/changegraph-release-intelligence/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • kits/changegraph-release-intelligence/apps/actions/orchestrate.ts
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/lib/change-package.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts
  • kits/changegraph-release-intelligence/apps/package.json
  • kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lift

Keep unbounded graph traversal behind the execution guard. Caller-supplied baselineGraph and candidateGraph can drive the deterministic traversal before the execution slot is acquired, while the schema accepts node/edge arrays without size limits.

  • Move calculateBlastRadius and calculateRiskAssessment to after acquireExecutionSlot at /kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts:549 so MAX_GLOBAL_CONCURRENT bounds this phase as well. Release the slot in the existing finally.
  • Add explicit node and edge count limits to WorkflowGraphFlowSchema in /kits/changegraph-release-intelligence/apps/lib/schemas.ts so oversized graphs fail validation before calculateBlastRadius runs.
🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 01e3a9b and a88e9be.

📒 Files selected for processing (7)
  • kits/changegraph-release-intelligence/apps/actions/orchestrate.ts
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx
  • kits/changegraph-release-intelligence/apps/lib/blast-radius.ts
  • kits/changegraph-release-intelligence/apps/lib/change-package.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts
  • kits/changegraph-release-intelligence/apps/types/changegraph.ts

Comment thread kits/changegraph-release-intelligence/apps/lib/schemas.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Move the execution slot acquisition adjacent to the try that releases it.

Agent, observe the gap. acquireExecutionSlot runs at line 500. The try...finally that calls releaseExecutionSlot opens at line 528. Lines 520-524 execute between them. If any statement in that window throws, the outer catch at line 682 returns a 500 and the slot is never released. activeGlobalExecutions then stays incremented for the lifetime of the process. After four such failures the route returns 503 to every client until redeploy.

crypto.randomUUID() and performance.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 requestId and executionStartedAt inside the try, or open the try immediately 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

📥 Commits

Reviewing files that changed from the base of the PR and between a88e9be and e28b045.

📒 Files selected for processing (3)
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/lib/blast-radius.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts

@Mayankverma210405

Copy link
Copy Markdown
Author

@akshatvirmani coderabbit comments resolved and [Lamatic/AgentKit] Run failed: (Phase 2 testing)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a88e9be and 6f502f0.

📒 Files selected for processing (3)
  • kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts
  • kits/changegraph-release-intelligence/apps/lib/blast-radius.ts
  • kits/changegraph-release-intelligence/apps/lib/schemas.ts

Comment on lines +580 to +581
flowExecutionCount =
FLOW_EXECUTIONS_PER_ANALYSIS;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants