feat: apply review suggestions across files
CI / lint (pull_request) Successful in 3m32s
CI / build-release (pull_request) Successful in 7s
CI / browser-journey (pull_request) Successful in 6m13s
CI / release-candidate (pull_request) Has been skipped

Closes #1386
This commit is contained in:
timmy committed 2026-08-25 08:02:16 +00:00
1 parent 7bb22e3525
commit 1c02dcb217
6 files changed
+238 -53

No files matched your search

+16 -12
View File
@@ -575,9 +575,10 @@ function bindFeedbackControls(doc, controller, getSelected, getDetail, getLogin)
if (!active?.suggestion) return;
const pending = active.suggestion;
const path = pending.file.path;
const stagedPath = Object.keys(active.batch)[0];
if (stagedPath && stagedPath !== path) {
qs('#pull-feedback-status').textContent = 'Commit the staged file before batching suggestions from another file.';
const stagedCount = Object.values(active.batch)
.reduce((total, file) => total + file.suggestions.length, 0);
if (stagedCount >= 8) {
qs('#pull-feedback-status').textContent = 'Commit this bounded batch before staging more suggestions.';
return;
}
const entry = active.batch[path] || {file:pending.file, suggestions:[]};
@@ -633,10 +634,10 @@ function bindFeedbackControls(doc, controller, getSelected, getDetail, getLogin)
qs('#pull-feedback-status').textContent = 'Committing and verifying all suggested changes…';
try {
const result = await controller.commitFeedbackBatch(active.item, {
file:{
path:entries[0].file.path, content:entries[0].content,
expectedBlobSha:entries[0].file.blob_sha,
},
files:entries.map(entry => ({
path:entry.file.path, content:entry.content,
expectedBlobSha:entry.file.blob_sha,
})),
suggestionCount:count, message, expectedHeadSha:active.detail.head_sha,
});
active.detail.head_sha = result.head_sha;
@@ -1064,16 +1065,19 @@ function createPullSheet({ fetchJson, storage, onState, createConversationPager
method:'POST',
headers:{ Accept:'application/json', 'Content-Type':'application/json' },
body:JSON.stringify({
file:{
path:draft.file.path, content:draft.file.content,
expected_blob_sha:draft.file.expectedBlobSha,
},
files:draft.files.map(file => ({
path:file.path, content:file.content,
expected_blob_sha:file.expectedBlobSha,
})),
suggestion_count:draft.suggestionCount,
message:draft.message, expected_head_sha:draft.expectedHeadSha,
}),
}).then(result => {
const expectedPaths = draft.files.map(file => file.path);
if (!result?.head_sha || result.head_sha === draft.expectedHeadSha ||
result.path !== draft.file.path || result.suggestion_count !== draft.suggestionCount) {
!Array.isArray(result.paths) || result.paths.length !== expectedPaths.length ||
result.paths.some((path, index) => path !== expectedPaths[index]) ||
result.suggestion_count !== draft.suggestionCount) {
throw new Error('The suggestion batch was not confirmed.');
}
return result;