Skip to content

Add $setWindowFields sortBy validation corner case tests - #717

Merged
eerxuan merged 1 commit into
documentdb:mainfrom
Cassie-2025:add-setWindowFields-sortby-validation-tests
Aug 11, 2026
Merged

Add $setWindowFields sortBy validation corner case tests#717
eerxuan merged 1 commit into
documentdb:mainfrom
Cassie-2025:add-setWindowFields-sortby-validation-tests

Conversation

@Cassie-2025

Copy link
Copy Markdown
Contributor

Summary

  • Add tests for sortBy-related corner cases in $setWindowFields stage validation:
    • Range window with sortBy: null (treated as omitted, rejected with error 5339902)
    • Range window with sortBy: {} (empty object, no sort fields, rejected with error 5339902)
    • Time-range window with fractional bounds (e.g., [-1.5, 1.5] — must be integers, rejected with
      FAILED_TO_PARSE_ERROR)
    • Time-range window with single fractional lower bound (confirms either bound being fractional triggers error)
    • Bounded documents window with sortBy: null (rejected with error 5339901)
  • Update TEST_COVERAGE.md to document these requirements for sortBy, window.range, and window.unit

Test plan

  • All 111 tests under setWindowFields/ pass against MongoDB 8.2.4 (port 27018)
  • Pre-commit hooks pass (black, isort, flake8, mypy)
  • New tests follow existing patterns and use framework assertions

Add tests for sortBy-related edge cases in $setWindowFields:
- Range window with sortBy: null (treated as omitted, rejected)
- Range window with sortBy: {} (no sort fields, rejected)
- Time-range window with fractional bounds (must be integers)
- Time-range window with single fractional bound
- Bounded documents window with sortBy: null (rejected)

Update TEST_COVERAGE.md to document these requirements.

Signed-off-by: Cassie-2025 <Cassie-2025@users.noreply.github.com>
@Cassie-2025
Cassie-2025 requested a review from a team as a code owner August 10, 2026 21:35
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related documentation Improvements or additions to documentation enhancement New feature or request labels Aug 10, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, documentation, enhancement
Project fields suggested: Component test-coverage · Priority P3 · Effort M · Status Needs Review
Confidence: 0.90 (mixed)

Reasoning

component from path globs (test-coverage, docs); effort from diff stats (149+3 LOC, 4 files); LLM: Adds corner-case validation tests for $setWindowFields sortBy and updates TEST_COVERAGE.md; purely additive test coverage with no functional or schema changes.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@eerxuan
eerxuan merged commit 0fb5f96 into documentdb:main Aug 11, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants