Skip to content

Commit f4f0787

Browse files
authored
Merge branch 'master' into fix/cloud-restore-lsc-false-broken-schema
2 parents 93bbb41 + e7afcac commit f4f0787

82 files changed

Lines changed: 3031 additions & 1507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/opencode-review-comment.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,54 @@ jobs:
1515
runs-on: ubuntu-latest
1616
if: >-
1717
github.event.issue.pull_request &&
18-
contains(github.event.comment.body, '/review')
18+
startsWith(github.event.comment.body, '/review')
1919
outputs:
2020
pr_number: ${{ steps.pr.outputs.pr_number }}
2121
head_sha: ${{ steps.pr.outputs.head_sha }}
2222
base_sha: ${{ steps.pr.outputs.base_sha }}
23+
review_focus: ${{ steps.pr.outputs.review_focus }}
2324
steps:
2425
- name: Get PR info
2526
id: pr
2627
env:
2728
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
COMMENT_BODY: ${{ github.event.comment.body }}
2830
run: |
2931
PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
3032
HEAD_SHA=$(echo "$PR_JSON" | jq -r '.head.sha')
3133
BASE_SHA=$(echo "$PR_JSON" | jq -r '.base.sha')
34+
REVIEW_FOCUS=$(printf '%s' "${COMMENT_BODY#'/review'}" | sed 's/^[[:space:]]*//')
35+
3236
echo "pr_number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT"
3337
echo "head_sha=$HEAD_SHA" >> "$GITHUB_OUTPUT"
3438
echo "base_sha=$BASE_SHA" >> "$GITHUB_OUTPUT"
39+
{
40+
echo "review_focus<<EOF"
41+
printf '%s\n' "$REVIEW_FOCUS"
42+
echo "EOF"
43+
} >> "$GITHUB_OUTPUT"
3544
3645
code-review:
3746
needs:
3847
- resolve-pr
3948
- mark-review-pending
4049
if: >-
4150
github.event.issue.pull_request &&
42-
contains(github.event.comment.body, '/review')
51+
startsWith(github.event.comment.body, '/review')
4352
uses: ./.github/workflows/opencode-review-runner.yml
4453
secrets: inherit
4554
with:
4655
pr_number: ${{ needs.resolve-pr.outputs.pr_number }}
4756
head_sha: ${{ needs.resolve-pr.outputs.head_sha }}
4857
base_sha: ${{ needs.resolve-pr.outputs.base_sha }}
58+
review_focus: ${{ needs.resolve-pr.outputs.review_focus }}
4959

5060
mark-review-pending:
5161
needs: resolve-pr
5262
runs-on: ubuntu-latest
5363
if: >-
5464
github.event.issue.pull_request &&
55-
contains(github.event.comment.body, '/review')
65+
startsWith(github.event.comment.body, '/review')
5666
steps:
5767
- name: Mark Code Review status as pending
5868
env:

.github/workflows/opencode-review-runner.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
base_sha:
1313
required: true
1414
type: string
15+
review_focus:
16+
required: false
17+
type: string
18+
default: ''
1519

1620
permissions:
1721
pull-requests: write
@@ -66,6 +70,76 @@ jobs:
6670
run: |
6771
echo '{"permission":"allow"}' > opencode.json
6872
73+
- name: Fetch existing PR review threads
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
REPO: ${{ github.repository }}
77+
PR_NUMBER: ${{ inputs.pr_number }}
78+
run: |
79+
MAX_THREADS=30
80+
MAX_BODY_CHARS=1200
81+
82+
if gh api --paginate --slurp repos/${REPO}/pulls/${PR_NUMBER}/comments > /tmp/pr_review_comments_pages.json 2>/tmp/pr_review_comments_error.log \
83+
&& jq 'add | sort_by((.in_reply_to_id // .id), .id)' /tmp/pr_review_comments_pages.json > /tmp/pr_review_comments.json 2>>/tmp/pr_review_comments_error.log \
84+
&& jq -r '
85+
def shorten($limit):
86+
if (. // "" | length) > $limit then
87+
.[0:$limit] + "...(truncated)"
88+
else
89+
. // ""
90+
end;
91+
if length == 0 then
92+
"No existing inline review comments or replies were found for this PR."
93+
else
94+
group_by(.in_reply_to_id // .id)
95+
| sort_by(.[0].created_at // "")
96+
| reverse
97+
| .[:$max_threads]
98+
| map(
99+
. as $thread
100+
| $thread[0] as $root
101+
| "### " + ($root.path // "(unknown path)") + ":" + (($root.line // $root.original_line // "n/a") | tostring)
102+
+ "\nURL: " + ($root.html_url // "")
103+
+ "\nComments:\n"
104+
+ (
105+
$thread
106+
| map(
107+
"- " + (.user.login // "unknown")
108+
+ " at " + (.created_at // "")
109+
+ (if .in_reply_to_id then " (reply):" else " (original comment):" end)
110+
+ "\n"
111+
+ ((.body | shorten($max_body_chars)) | split("\n") | map(" " + .) | join("\n"))
112+
)
113+
| join("\n")
114+
)
115+
)
116+
| join("\n\n")
117+
end
118+
' --argjson max_threads "$MAX_THREADS" --argjson max_body_chars "$MAX_BODY_CHARS" /tmp/pr_review_comments.json > /tmp/pr_review_threads.md 2>>/tmp/pr_review_comments_error.log; then
119+
echo "Fetched existing PR review threads successfully."
120+
else
121+
printf '%s\n\n' \
122+
'Existing PR review threads could not be fetched or formatted for this run.' \
123+
'Proceed with the automated review without this auxiliary context.' \
124+
> /tmp/pr_review_threads.md
125+
if [ -s /tmp/pr_review_comments_error.log ]; then
126+
{
127+
printf '\n%s\n' 'Fetch/format error details:'
128+
sed 's/^/ /' /tmp/pr_review_comments_error.log
129+
} >> /tmp/pr_review_threads.md
130+
fi
131+
fi
132+
133+
- name: Prepare user review focus
134+
env:
135+
REVIEW_FOCUS: ${{ inputs.review_focus }}
136+
run: |
137+
if [ -n "$(printf '%s' "$REVIEW_FOCUS" | tr -d '[:space:]')" ]; then
138+
printf '%s\n' "$REVIEW_FOCUS" > /tmp/review_focus.txt
139+
else
140+
printf 'No additional user-provided review focus.\n' > /tmp/review_focus.txt
141+
fi
142+
69143
- name: Prepare review prompt
70144
run: |
71145
cat > /tmp/review_prompt.txt <<'PROMPT'
@@ -79,8 +153,16 @@ jobs:
79153
- PR number: PLACEHOLDER_PR_NUMBER
80154
- PR Head SHA: PLACEHOLDER_HEAD_SHA
81155
- PR Base SHA: PLACEHOLDER_BASE_SHA
156+
- Existing inline review threads: /tmp/pr_review_threads.md
157+
- Raw inline review comments JSON: /tmp/pr_review_comments.json
158+
- User review focus: /tmp/review_focus.txt
82159
83160
Before reviewing any code, you MUST read and follow the code review skill in this repository. During review, you must strictly follow those instructions.
161+
Before proposing any new issue, you MUST read /tmp/pr_review_threads.md and treat every existing inline comment thread and reply as already-known review context.
162+
Do NOT submit the same or substantially similar issue again if it has already been raised in the existing review threads, even if you would phrase it differently.
163+
Only raise a similar concern when the PR introduces a genuinely different instance in another location that is not already covered by the existing thread, and explain why it is distinct.
164+
You MUST also read /tmp/review_focus.txt. Perform a complete review of the whole PR as usual, and additionally pay special attention to the user-provided focus points from that file.
165+
In the final summary, include a short response to the user focus points, including when no additional issue was found for them.
84166
In addition, you can perform any desired review operations to observe suspicious code and details in order to identify issues as much as possible.
85167
86168
## Final response format

be/src/exec/operator/es_scan_operator.cpp

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)