← Back to Pull requests

fix(mongoatlas): reject unsupported aggregation stages #15

Open
unknown opened this pull request with 244 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 29, 2026 05:07 UTC
Author

Atlas Data API aggregation could silently skip an unsupported stage and return HTTP 200 with incorrect documents. The route now validates each stage's shape and operator before executing the pipeline. An unsupported operator returns HTTP 400 with InvalidParameter and its zero-based pipeline index. Each stage object must contain exactly one operator.

| Installed CLI request | Before | After |
| --- | --- | --- |
| $group | 200, three raw rows | 400, $group at pipeline[0] |
| $match, $group, $count | 200, [{"total":2}] | 400, $group at pipeline[1] |
| $match, $count | 200, [{"total":2}] | 200, [{"total":2}] |
| $sort, $skip, $limit, $project | 200, [{"amount":10}] | 200, [{"amount":10}] |

Verification

  • Tested 2779bb471c49ae0e8fc5438434dac22635c6ad40. The Atlas suite passed all 33 tests. Atlas type check and lint passed.

  • Built and deployed the production CLI separately from the workspace. The synthetic sales fixture confirmed the results above, preserved empty and omitted pipelines, and confirmed a stage object with two operators returns 400.

  • Independent review caught two error-ordering cases. The installed CLI now returns 400 for an unsupported stage after a bad operand or with an unknown cluster. A valid pipeline with an unknown cluster still returns 404.

  • The workspace passed 27 build tasks and 81 type check, lint, and test tasks locally. Formatting and version checks passed. GitHub Actions reported zero runs for the branch.

  • CodeRabbit completed its review of the draft with zero actionable comments. Check run

  • Guarded native Verify stopped before admission on the Mac. The Hutch bootstrap required Linux and the local-provider guard required a configured standalone runtime. The pin and guard tests passed 11 of 11. No Verify verdict was generated. The change is limited to the TypeScript emulator used by the CLI.
  • Diff: 244 lines (+183 / -61) across 3 files Reviewer: coderabbitai[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.39) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 244 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.329
    Real PR Conversation Timeline
    1 comments
    "Review active on #15"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 38.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.1% · Safe to merge
    22.1%