Skip to content

fix(dashboard): number only source lines in the diff viewer - #538

Merged
Sertaç Özercan (sozercan) merged 3 commits into
orka-agents:mainfrom
jabrailkhalil:fix/diff-viewer-line-numbers
Sep 12, 2026
Merged

Sertaç Özercan (sozercan) merged 3 commits into
orka-agents:mainfrom
jabrailkhalil:fix/diff-viewer-line-numbers

Conversation

@jabrailkhalil

@jabrailkhalil Jabrail (jabrailkhalil) commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

The task result Diff tab now numbers only source lines. Git metadata and missing-final-newline markers stay visible without advancing the counters, and a trailing patch newline no longer creates a phantom row.

The parser tracks each hunk's old/new line counts so source lines such as --- old marker and +++ new marker keep deletion/addition styling and their correct line numbers. Once a hunk is complete, it recognizes the next file's headers, including unified patches without diff --git separators. Implicit counts, zero counts, blank context lines, and later hunks retain their expected behavior.

Validation:

  • The two new header-like-source regression tests fail on the previous PR head and pass with the fix.
  • bun run test src/components/tasks/diff-viewer.test.tsx src/components/tasks/task-result-viewer.test.tsx: 17 passed.
  • bun run lint: passed.
  • bun run test: all 126 files and 1,110 tests passed.
  • bun run build: passed.

Fixes #524.

Copilot AI balanced review requested due to automatic review settings September 9, 2026 19:34

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T14:41:03.586508Z a0b4ccb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The task result diff viewer assigned source line numbers to Git
metadata and "\ No newline at end of file" markers, and those rows also
advanced the old/new counters, so a normal patch showed wrong numbers
next to actual code changes. A trailing patch newline added a phantom
numbered row with no content.

Rework the parser in diff-viewer.tsx:

- Only real source lines advance the counters and carry numbers:
  additions advance the new-file counter, deletions the old-file one,
  and context lines (a leading space) advance both.
- Metadata rows ("index ...", "\ No newline at end of file") stay
  visible without numbers and never advance counters. The empty item
  produced by a trailing patch newline is dropped entirely instead of
  rendering as a numbered row.
- Hunk headers still set the starting counters, so later hunks and
  additional files start at their declared positions.

Add fixtures covering the reported single-line example (both changed
lines numbered 1), metadata without numbers, a multi-file patch with a
later hunk, a blank context line that still counts, and the trailing
newline behavior.

Fixes orka-agents#524.

Signed-off-by: jabrailkhalil <jabrailkhalil@gmail.com>
Copilot AI review requested due to automatic review settings September 9, 2026 19:45

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings September 10, 2026 20:29

Copilot AI 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.

🟢 Approval recommended

The parser changes satisfy the issue requirements and are covered by focused edge-case tests.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

1 similar comment
@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

1 similar comment
@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

@sozercan Sertaç Özercan (sozercan) left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Jabrail (@jabrailkhalil) thanks, lgtm! do you mind signing the cla and we can merge

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copilot AI review requested due to automatic review settings September 12, 2026 14:35
@sozercan
Sertaç Özercan (sozercan) merged commit 2fecf09 into orka-agents:main Sep 12, 2026
9 checks passed

Copilot AI 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.

🟢 Approval recommended

The implementation satisfies the linked issue’s acceptance criteria with focused regression coverage.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0b4ccbd5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

// keep them visible, but never assign source line numbers or advance
// counters. The empty item produced by a trailing patch newline is
// dropped entirely.
if (line === '') continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve interior blank lines in binary patches

When a structured result contains the canonical git diff --binary output produced in workers/common/workspace.go:390, an interior blank line separates the forward and reverse literal/delta blocks. This unconditional continue removes every empty row rather than only the final artifact from split('\n'), so the viewer no longer faithfully renders—and users cannot accurately copy—the binary patch. Retain interior empty rows and skip only the trailing split element.

Useful? React with 👍 / 👎.

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.

Correct line numbers around Git diff metadata and missing final newlines

3 participants