Repository navigation
fix(dashboard): number only source lines in the diff viewer - #538
Sertaç Özercan (sozercan) merged 3 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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>
8f5c853 to
47be31d
Compare
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
|
@microsoft-github-policy-service rerun |
1 similar comment
|
@microsoft-github-policy-service rerun |
|
@microsoft-github-policy-service rerun |
1 similar comment
|
@microsoft-github-policy-service rerun |
There was a problem hiding this comment.
Jabrail (@jabrailkhalil) thanks, lgtm! do you mind signing the cla and we can merge
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
💡 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 |
There was a problem hiding this comment.
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 👍 / 👎.
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 markerand+++ new markerkeep deletion/addition styling and their correct line numbers. Once a hunk is complete, it recognizes the next file's headers, including unified patches withoutdiff --gitseparators. Implicit counts, zero counts, blank context lines, and later hunks retain their expected behavior.Validation:
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.