Skip to content

feat: add diff line count to plans table results view#1054

Merged
adityachoudhari26 merged 4 commits intomainfrom
claude/issue-1036-20260423-1736
Apr 23, 2026
Merged

feat: add diff line count to plans table results view#1054
adityachoudhari26 merged 4 commits intomainfrom
claude/issue-1036-20260423-1736

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

Show +added/-removed line counts alongside the "View diff" button in the release target results table, similar to GitHub's diff display.

Closes #1036

Generated with Claude Code

Show +added/-removed line counts (via LCS diff) alongside the "View diff"
button in the release target results table, similar to GitHub's diff display.

Co-authored-by: Aditya Choudhari <adityachoudhari26@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 18:35
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 23, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ adityachoudhari26
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 1 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 40 minutes and 1 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4a3a1698-8698-48f9-844a-cd086b981090

📥 Commits

Reviewing files that changed from the base of the PR and between ee4f0c8 and 9722abc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • apps/web/app/routes/ws/deployments/page.$deploymentId.plans.$planId.tsx
  • packages/trpc/package.json
  • packages/trpc/src/routes/deployment-plans.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-1036-20260423-1736

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 and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds GitHub-style +added/-removed diff line counts next to the “View diff” action in the deployment plan results table to better communicate change magnitude. Closes #1036.

Changes:

  • Compute per-result diff stats (added/removed line counts) in the TRPC deployment.plans.results response.
  • Render the diff stats next to the “View diff” button in the plan results table UI.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/trpc/src/routes/deployment-plans.ts Fetches diff inputs and computes diffStats for each plan result returned by the results endpoint.
apps/web/app/routes/ws/deployments/page.$deploymentId.plans.$planId.tsx Displays diffStats next to “View diff” in the Changes column.
Comments suppressed due to low confidence (1)

packages/trpc/src/routes/deployment-plans.ts:229

  • diffStats is computed for every row, even when hasChanges is false/null or the status isn’t completed. This adds unnecessary work and amplifies the cost of computeDiffStats. Consider guarding the call (e.g., only compute when r.hasChanges === true) and otherwise return null.
            resource: { id: r.resourceId, name: r.resourceName },
            agent: {
              id: (agent.id as string | undefined) ?? "",
              name: (agent.name as string | undefined) ?? "",
              type: (agent.type as string | undefined) ?? "",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +27
function computeDiffStats(
current: string | null,
proposed: string | null,
): { added: number; removed: number } | null {
if (current == null || proposed == null) return null;
const a = current.split("\n");
const b = proposed.split("\n");
const m = a.length;
const n = b.length;
let prev = new Array<number>(n + 1).fill(0);
for (let i = 1; i <= m; i++) {
const curr = new Array<number>(n + 1).fill(0);
for (let j = 1; j <= n; j++) {
curr[j] =
a[i - 1] === b[j - 1]
? (prev[j - 1] ?? 0) + 1
: Math.max(prev[j] ?? 0, curr[j - 1] ?? 0);
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

computeDiffStats uses a dynamic-programming LCS over all lines, which is O(m*n) time per result. Since deployment.plans.results can return many rows and the UI polls it every 5s, large configs/diffs could cause significant CPU load (and potential DoS if someone can create very large current/proposed). Consider switching to a diff algorithm/library with better typical performance (e.g., Myers line diff) and/or enforcing a hard cap on max lines/bytes (returning null/omitting stats when exceeded).

Copilot uses AI. Check for mistakes.
Comment on lines 188 to +192
status: schema.deploymentPlanTargetResult.status,
hasChanges: schema.deploymentPlanTargetResult.hasChanges,
message: schema.deploymentPlanTargetResult.message,
contentHash: schema.deploymentPlanTargetResult.contentHash,
current: schema.deploymentPlanTargetResult.current,
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The results query now selects current/proposed (potentially large TEXT blobs) for every row just to compute line counts. This increases DB I/O and memory/GC pressure even though the response doesn’t return these strings. To reduce load, consider avoiding selecting full contents here (e.g., store precomputed added/removed counts on the result, or fetch contents only for rows with hasChanges === true via a separate query).

Copilot uses AI. Check for mistakes.
@adityachoudhari26 adityachoudhari26 merged commit f9620bb into main Apr 23, 2026
8 of 9 checks passed
@adityachoudhari26 adityachoudhari26 deleted the claude/issue-1036-20260423-1736 branch April 23, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plans table view for release target should show diff count

3 participants