Skip to content

refactor: tighten the review prompt without losing information#19

Closed
mtrunkat wants to merge 1 commit into
claude/mongodb-query-index-check-sharding-patternsfrom
claude/mongodb-query-index-check-tighten-prompt
Closed

refactor: tighten the review prompt without losing information#19
mtrunkat wants to merge 1 commit into
claude/mongodb-query-index-check-sharding-patternsfrom
claude/mongodb-query-index-check-tighten-prompt

Conversation

@mtrunkat
Copy link
Copy Markdown
Member

Stacks on top of #17. Compresses the prose throughout prompts/review.md without dropping any information — same 10 patterns, 7 examples, 4-tier rubric, 5-step workflow, 9 hard constraints, full 3-tier "Suggested action" template.

Numbers

  • Word count: 2870 → 1994 (-30%)
  • Line count: 183 → 153 (-16%)

Where the savings come from

  • Pattern feat: add mongodb-query-index-check action #3 (sharded shard-key): drops the "in filter / $match / aggregate's first $match" recitation already covered by the call list at the top.
  • Pattern feat: make the review prompt directive instead of descriptive #8 (sharded readConcern): folds the "reason from the principle for novel cases" postscript into the lead sentence so it reads as a single rule rather than a rule + appendix.
  • Suggested-action template: same 3-tier preference, as a compact numbered list instead of one ~120-word sentence.
  • Severity rubric: each tier collapses from a 4–6-bullet sub-list to a single comma-joined line that re-uses the pattern names (the criteria are still all there, just without re-describing each pattern).
  • Workflow steps 3–5: throat-clearing removed ("A previous run may have already posted some of these findings. Before posting:" → just "Before posting:"). Step 5 merges two sentences.
  • Bash sandbox and Hard constraints: filler phrases stripped.

Tests

  • pnpm run lint / type-check / test — clean, 35/35.
  • envsubst placeholder allowlist unchanged.
  • Manually diffed section-by-section: all 10 patterns present, all 7 examples present, all 4 rubric tiers present with criteria preserved, all 5 workflow steps present, all 9 hard constraints present, suggested-action 3-tier preference preserved verbatim.

Generated by Claude Code

Compress prose throughout the prompt — same patterns, examples, rubric,
workflow, and constraints, fewer words. Word count drops ~30%
(2870 → ~2000), line count ~16% (183 → 153).

Main collapses:
* Pattern #3 (sharded shard-key) drops the redundant "in filter / $match"
  recitation already covered by the call list.
* Pattern #8 (sharded readConcern) folds the "reason from the principle"
  postscript into the lead sentence.
* Suggested-action template gets the same 3-tier preference but as a
  compact list instead of a sprawling sentence.
* Severity rubric collapses each tier from a bulleted sub-list to a
  single comma-joined line that re-uses pattern names.
* Steps 3-5 of the workflow lose throat-clearing.
* Bash sandbox notes and Hard constraints strip filler words.

No content removed. All 10 patterns, 7 examples, 5 workflow steps,
9 hard constraints, and the full suggested-action template preserved.
Copilot AI review requested due to automatic review settings May 19, 2026 09:29
@mtrunkat mtrunkat closed this May 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors mongodb-query-index-check/prompts/review.md to be significantly more concise while preserving the same operational guidance for the MongoDB index-review bot (patterns, examples, rubric, workflow, constraints).

Changes:

  • Condenses “Input data”, “What to look for”, and the “Common change patterns” sections into shorter, denser wording.
  • Collapses the severity rubric and suggested-action guidance into more compact bullet/numbered formats.
  • Tightens workflow and sandbox/constraints prose while keeping the same steps and requirements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.
4. If no new findings remain, compute the max severity from the original (un-filtered) findings list, write it to `$RESULT_PATH`, and exit silently. Do not submit an empty review.
1. Call `mcp__github__pull_request_read` with `method: get_review_comments` and `pullNumber: $PR_NUMBER` (review threads have `is_outdated`; each comment has `author`, `body`, `path`, `line`).
Comment on lines 112 to +115

- `mcp__github__pull_request_review_write` with `action: create_pending` (or `mcp__github__create_pending_pull_request_review`) to open a pending review on `$PR_NUMBER`. If you get "can only have one pending review per pull request", continue to the next step.
- `mcp__github__add_comment_to_pending_review` to add one inline comment per finding.
- `mcp__github__pull_request_review_write` with `action: submit_pending` (or `mcp__github__submit_pending_pull_request_review`) to submit the review.
1. `mcp__github__pull_request_review_write` with `action: create_pending` (or `mcp__github__create_pending_pull_request_review`) on `$PR_NUMBER`. If "can only have one pending review per pull request" — continue.
2. `mcp__github__add_comment_to_pending_review` one inline per finding; `path` and `line` at the **after-state RIGHT line** of the diff.
3. `mcp__github__pull_request_review_write` with `action: submit_pending` (or `mcp__github__submit_pending_pull_request_review`). Event = `REQUEST_CHANGES` if `$REQUEST_CHANGES_MODE` is `true`, else `COMMENT`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants