Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e595bac
Add a local Viewed toggle to remote diffs and remove the new-tab control
BunsDev Nov 12, 2026
453d97f
Move between Code Review's areas and files with the keyboard
BunsDev Nov 12, 2026
39d2c53
Open a pull request faster in Code Review
BunsDev Nov 12, 2026
f151380
Show comment HTML as readable text and the pull request number in inb…
BunsDev Nov 12, 2026
7c8f365
docs(code-review): record Viewed, the removed new-tab control and the…
BunsDev Nov 12, 2026
0f28862
Read comment HTML in one pass instead of with a backtracking pattern
BunsDev Nov 12, 2026
fad2951
Code Review: list comments made on diff lines in Activity
BunsDev Nov 12, 2026
4ed8ba0
Code Review: remove fallback buttons that could never act
BunsDev Nov 12, 2026
35b52b0
test(code-review): wait for the file focus before typing in the filter
BunsDev Nov 12, 2026
97b0e60
Merge commit '35b52b0' into cr-inline-comments
BunsDev Nov 12, 2026
c599dd7
Merge remote-tracking branch 'origin/main' into cr-inline-comments
BunsDev Nov 12, 2026
38bab09
Integrate ready line-comment Activity feature on current main
BunsDev Nov 13, 2026
defa81e
fix: preserve review comment location provenance
BunsDev Nov 13, 2026
57d2773
fix: retain valid locations on file review comments
BunsDev Nov 13, 2026
249154d
docs: record integrated comment qualification and remaining gates
BunsDev Nov 13, 2026
7bce382
ci: leave iPhone tests time after slow runner setup
BunsDev Nov 13, 2026
f9bef70
docs: retain first inline integration CI outcome
BunsDev Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
# Not a required check: the PR already ran it, and main runs it again after the merge.
if: github.event_name != 'merge_group'
runs-on: macos-latest
timeout-minutes: 30
# Run 43360620861 spent 14.5 minutes before UI tests and hit 30 minutes while cases were
# still passing. Leave roughly 30 minutes for the suite on a similarly slow runner;
# individual test deadlines, assertions and the retained cancellation evidence stay unchanged.
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
- name: Sample memory through the job
Expand Down
35 changes: 35 additions & 0 deletions apps/desktop/e2e/code-review-regressions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,38 @@ test("local Changes stay local: a remote PR touching the same path never reaches
file: fs.readFileSync(path.join(repo, "src", "holds", "move.ts"), "utf8") }).toEqual(before);
expect(h.calls().filter((c) => !READ_ENDPOINT.test(c))).toEqual([]);
});

test("real use (F3): comments on lines of the diff are shown in Activity with their file and line, under the Comments filter, as inert text", async () => {
const world = baseWorld();
const who = { id: 3003, login: "bea-fixture", type: "User" };
// The base world lists no timeline: an empty one lets the activity read finish.
world.routes["repos/example-org/lending/issues/73/timeline"] = [];
world.routes["repos/example-org/lending/deployments"] = [];
world.routes["repos/example-org/lending/pulls/73/comments"] = [
{ id: 801, user: who, created_at: "2026-10-18T20:31:00Z", body: "Should this keep the position when the branch is closed?\n\n<script>window.__pwned=true</script>", path: "src/holds/move.ts", line: 41, side: "RIGHT" },
{ id: 802, user: who, created_at: "2026-10-18T20:32:00Z", body: "It does; see the closure test.", path: "src/holds/move.ts", line: 41, side: "RIGHT", in_reply_to_id: 801 },
{ id: 803, user: who, created_at: "2026-10-18T20:33:00Z", body: "This helper is gone now.", path: "src/holds/queue.ts", line: null, side: "LEFT" },
{ id: 804, user: who, created_at: "2026-10-18T20:34:00Z", body: "Whole file feedback.", path: "src/holds/move.ts", subject_type: "file", line: 1, side: "RIGHT" },
{ id: 805, user: who, created_at: "2026-10-18T20:35:00Z", body: "Before-side feedback.", path: "src/holds/move.ts", subject_type: "line", line: 9, side: "LEFT" },
];
h = await launchWithGh(world);
const { page } = h;
await tid(page, "rail-code-review").click();
await prRow(page, "example-org/lending#73").click();
const activity = tid(page, "cr-activity");
const item = (id: number) => activity.locator(`[data-activity-id="line-comment:${id}"]`);
await expect(item(801)).toContainText("commented on src/holds/move.ts · line 41");
await expect(item(801)).toContainText("Should this keep the position when the branch is closed?");
await expect(item(802)).toContainText("replied on src/holds/move.ts · line 41");
await expect(item(803)).toContainText("commented on src/holds/queue.ts · current line unavailable");
await expect(item(804)).toContainText("commented on src/holds/move.ts · file");
await expect(item(804)).toContainText("Comment on a file");
await expect(item(804)).not.toContainText("line no longer");
await expect(item(805)).toContainText("commented on src/holds/move.ts · line 9 (before)");
await page.getByLabel("Activity filter").selectOption("comment");
await expect(activity.locator('[data-activity-id^="line-comment:"]')).toHaveCount(5);
await expect(activity.locator('[data-activity-id^="commit:"]')).toHaveCount(0);
expect(await page.evaluate(() => (window as unknown as { __pwned?: boolean }).__pwned)).toBeUndefined();
expect(h.calls().filter((c) => c.startsWith("repos/example-org/lending/pulls/73/comments"))).toEqual(["repos/example-org/lending/pulls/73/comments?per_page=100&page=1"]);
expect(h.calls().filter((c) => !READ_ENDPOINT.test(c) && !c.startsWith("repos/example-org/lending/deployments?"))).toEqual([]);
});
2 changes: 1 addition & 1 deletion apps/desktop/e2e/code-review-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const prRow = (p: Page, slug: string) => p.locator(`[data-testid="code-re
export const settle = (p: Page) => p.evaluate(() => window.modex!.invoke("code-review:read", { op: "connection", requestId: `settle-${Date.now()}` }));

/** Every endpoint the read service may ask for (docs/design/code-review.md, Read operations). */
export const READ_ENDPOINT = /^(user|search\/issues\?[^/]+|repos\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+(\/(pulls(\/\d+(\/files)?)?|compare\/[0-9a-f]{40}\.\.\.[0-9a-f]{40}|issues\/\d+\/timeline|commits\/[0-9a-f]{40}\/(check-runs|status)|contents\/[^?]+))?(\?[^/]*)?)$/;
export const READ_ENDPOINT = /^(user|search\/issues\?[^/]+|repos\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+(\/(pulls(\/\d+(\/(files|comments))?)?|compare\/[0-9a-f]{40}\.\.\.[0-9a-f]{40}|issues\/\d+\/timeline|commits\/[0-9a-f]{40}\/(check-runs|status)|contents\/[^?]+))?(\?[^/]*)?)$/;

/**
* resizeWindow, but within the display. These launches can't set MODEX_E2E (it disables the read service), so
Expand Down
17 changes: 17 additions & 0 deletions apps/desktop/src/main/engine/code-review/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,23 @@ export function hasNext(header: string | undefined): boolean {
return typeof header === "string" && /<[^>]+>;\s*rel="next"/.test(header);
}

/** One comment on a line of the diff, from `pulls/{n}/comments`. Null when malformed. */
export function lineComment(value: unknown): Extract<PrActivity, { kind: "line-comment" }> | null {
const item = object(value);
const commentId = id(item?.id), at = time(item?.created_at), who = actor(item?.user);
if (!item || !commentId || !at || !who || typeof item.path !== "string" || !item.path || item.path.length > 4096) return null;
const subject = item.subject_type === undefined ? "line" : item.subject_type;
if (subject !== "line" && subject !== "file") return null;
// File subjects may carry valid line/side metadata too; the subject, not nullness,
// determines their target. Only file subjects may omit those location fields.
const line = subject === "file" && item.line === undefined ? null : item.line;
const side = subject === "file" && item.side === undefined ? null : item.side;
if (line !== null && (typeof line !== "number" || !Number.isSafeInteger(line) || line < 1)) return null;
if (side !== null && side !== "LEFT" && side !== "RIGHT") return null;
return { kind: "line-comment", id: commentId, at, actor: who, body: text(item.body, 262_144), path: item.path,
subject, line, side, replyTo: id(item.in_reply_to_id) };
}

/** Provider deployment + its latest status; a comment URL never enters this mapping. */
export function deployment(value: unknown, latest: unknown): Extract<PrActivity, { kind: "deployment" }> | null {
const record = object(value), status = object(latest);
Expand Down
33 changes: 29 additions & 4 deletions apps/desktop/src/main/engine/code-review/read-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type PrStack, type PrActivity, type PrCheck, type PrContext, type PrFiles, type PrKey, type PrOverview, type PrRevision, type PrSummary, type ReadResult, type ResolvedPr, type Unavailable,
} from "../../../shared/code-review.js";
import { ghHostsStamp, ghTransport, type GhAnswer, type GhCall, type GhTransport } from "./gh.js";
import { deployment, changedFile, checkRun, commitStatus, hasNext, json, pull, repository, searchRow, timeline, type Pull, type Repository } from "./github.js";
import { deployment, lineComment, changedFile, checkRun, commitStatus, hasNext, json, pull, repository, searchRow, timeline, type Pull, type Repository } from "./github.js";

/**
* Main's Code Review reads (#321): narrow GETs through the person's `gh` login, each bound to the
Expand Down Expand Up @@ -794,9 +794,10 @@ export class CodeReviewService {
if (pr) {
activity.unshift({ kind: "opened", id: `pr-${pr.id}`, at: pr.createdAt, actor: pr.author });
// Asked only once the timeline has arrived: a failed timeline costs GitHub no further request.
const read = await this.deployments(context, key, pr);
activity.push(...read.records);
deploymentFailure = read.failure;
// Line comments are not in the timeline; they are their own list. Both reads run together.
const [read, comments] = await Promise.all([this.deployments(context, key, pr), this.lineComments(context, key)]);
activity.push(...read.records, ...comments.records);
deploymentFailure = read.failure ?? comments.failure;
}
const more = hasNext(fetched.headers.link);
const next = more && number < TIMELINE_PAGES ? `p${number + 1}` : null;
Expand All @@ -809,6 +810,30 @@ export class CodeReviewService {
return { state: "ready", value: activity, fetchedAt, coverage };
}

/**
* The first page of comments on lines of the diff (100, oldest first). A failure is reported, not thrown,
* unless the read was cancelled or the account is gone; more than one page is reported as capped.
*/
private async lineComments(context: Context, key: PrKey): Promise<{ records: PrActivity[]; failure: Unavailable | "capped" | null }> {
const records: PrActivity[] = [];
let failure: Unavailable | "capped" | null = null;
try {
const fetched = await this.get(context, `${repoPath(this.repoFor(key))}/pulls/${key.number}/comments?per_page=${PAGE}&page=1`, { maxBytes: 8 * MB });
const listed: unknown = json(fetched.body);
if (!Array.isArray(listed)) throw new ReadFailure("failed", DETAIL.failed);
if (hasNext(fetched.headers.link)) failure = "capped";
for (const item of listed.slice(0, PAGE)) {
const mapped = lineComment(item);
if (mapped) records.push(mapped); else failure = "failed";
}
} catch (error) {
const caught = this.failure(error);
if (caught.cancelled || caught.reason === "signed-out") throw error;
failure = caught.reason;
}
return { records, failure };
}

/**
* A bounded current-head preview read, independent of arbitrary links in bot comments. Endpoint strings are
* built from main's repository and numeric provider IDs only. A failure is reported, not thrown, unless the
Expand Down
Loading
Loading