Claude/fix mongodb duplicates x v56n#18
Merged
mtrunkat merged 2 commits intoMay 19, 2026
Merged
Conversation
Re-runs of the workflow on the same PR were re-posting the same inline review comments and summary, cluttering PRs with 3-5 near-identical reviews per commit. The prompt now fetches existing github-actions[bot] review comments before posting and skips findings whose (path, line) already has a non-outdated comment with the same severity marker, and skips the whole submission when a summary already exists for the head SHA. https://claude.ai/code/session_01M5uzeS2vPDxt8nHJ5AxvRq
- Drop the same-HEAD_SHA early-exit. With the workflow-side concurrency group + 'edited' trigger removed, same-SHA re-runs are rare. The per-comment dedup already covers the common bad case, and the dropped branch matched on a summary-body prefix step 4 never actually guaranteed. - Reference the comment template from step 4 instead of restating all four severity-emoji prefixes. Less drift if the template ever changes. - Collapse the two skip-submission cases and inline the severity write instead of forwarding to 'step 5'. Steps now read self-contained. - Trim hedge wording and forward references throughout. https://claude.ai/code/session_01M5uzeS2vPDxt8nHJ5AxvRq
7479cd4
into
claude/mongodb-query-index-check-sharding-patterns
3 checks passed
There was a problem hiding this comment.
Pull request overview
Updates the MongoDB query/index review prompt to avoid reposting identical findings across workflow reruns by introducing a deduplication step before submitting review comments.
Changes:
- Add a new “Deduplicate against previous runs” step that queries existing PR review comments and filters out duplicates by
(path, line). - Renumber workflow steps and adjust submission gating to “only when at least one new finding remains”.
- Clarify that
$RESULT_PATHseverity must reflect all findings (including deduped ones) to avoid “greening” a previously failing check.
Comments suppressed due to low confidence (1)
mongodb-query-index-check/prompts/review.md:113
- The dedup filter only considers comments whose
authorisgithub-actions, but GitHub Actions comments commonly come fromgithub-actions[bot](see repo docs). If the login includes[bot], this check will miss prior findings and dedup won’t work; consider matchinggithub-actions[bot](or both variants).
2. Collect comments whose `author` is `github-actions`, whose containing thread is not `is_outdated`, and whose `body` starts with the template prefix defined in step 4 (any of the four severity emojis followed by ` **MongoDB index check`).
3. Drop any finding whose `(path, line)` matches a collected comment. Outdated threads don't count — line numbers shift across commits, so a fresh finding on a shifted line is a new finding.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| A previous run on this PR may have already posted some of these findings. Filter duplicates before posting: | ||
|
|
||
| 1. Call `mcp__github__pull_request_read` with `method: get_review_comments` and `pullNumber: $PR_NUMBER`. The response is a list of review threads; each has `is_outdated` and a `comments` array (every comment has `author`, `body`, `path`, `line`). |
mtrunkat
added a commit
that referenced
this pull request
May 19, 2026
## What changed Extensions to `prompts/review.md` for `mongodb-query-index-check`, sourced from apify-core post-mortems and team feedback during review: - **Sharded patterns.** Pattern #3 now bakes in the real `ShardAwareCollection` constructor signature (`new ShardAwareCollection<TSchema, TShardKeys>(collection, shardKeys[], openTelemetry?)`) and tells Claude to grep the workspace for `new ShardAwareCollection<` to find shard keys per collection. Mechanism-first treatment of `readConcern: 'available'` so Claude can reason about novel cases. `ShardAwareCollection` exposes `approximateCountDocuments` (wrapped) — *not* `countDocuments`, so plain `.countDocuments()` on a sharded raw collection IS flag-worthy. - **Heavy-index hint** (🟡 medium). Flag queries on 40+-index collections lacking `hint:`. - **Missing projection** (🟡 medium). Closes apify-core#19762. Flags reads without `projection` (wastes IO + BSON parse on multi-KB docs). - **Prefer reusing existing indexes.** Rewritten "Suggested action": (1) adjust the query, (2) extend an existing index, (3) only as last resort propose a new one. Per the [Slack thread](https://apify.slack.com/archives/C01VBUV81UZ/p1779168107624789?thread_ts=1779107433.941669) — busy collections already have too many indexes and the goal is to shrink that surface, not grow it. - **Cross-run dedup** (already merged via #18) — Claude drops findings at the same `(path, line)` as prior bot comments before posting. ## Tests `pnpm run lint` / `type-check` / `test` — clean, 35/35. envsubst allowlist unchanged. --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.