Skip to content

Add $tsIncrement compatibility tests#654

Open
RyanGarfinkel wants to merge 5 commits into
documentdb:mainfrom
RyanGarfinkel:add-tsIncrement-compatibility-tests
Open

Add $tsIncrement compatibility tests#654
RyanGarfinkel wants to merge 5 commits into
documentdb:mainfrom
RyanGarfinkel:add-tsIncrement-compatibility-tests

Conversation

@RyanGarfinkel

@RyanGarfinkel RyanGarfinkel commented Jun 29, 2026

Copy link
Copy Markdown

What does this PR do?

This PR introduces additional compatibility tests for the $tsIncrement operator. This includes null/missing values, invalid types, boundary values, and nested field access. Wiring tests were also added to verify functionality in $match, $expr, and $group expressions. An additional error code, TS_INCREMENT_TYPE_ERROR was added specifically for MongoDB type mismatches.

Why was this PR needed?

This PR Closes #210, which required adding additional test coverage to the $tsIncrement operator. Initially, this operator only had one smoke test, which tested basic functionality, not including null/missing input and invalid types.

What are the relevant issue numbers?

Closes #210

Does this PR meet the acceptance criteria?

  • Tests added for new/changed behavior
  • All tests passing
  • Follows project style guide
  • No breaking changes introduced (new tests added)
  • Documentation updated (if applicable)

@RyanGarfinkel RyanGarfinkel requested a review from a team as a code owner June 29, 2026 04:14
@RyanGarfinkel RyanGarfinkel force-pushed the add-tsIncrement-compatibility-tests branch from 750e3be to 9e59c4e Compare June 29, 2026 04:18
Signed-off-by: RyanGarfinkel <113050972+RyanGarfinkel@users.noreply.github.com>
Signed-off-by: RyanGarfinkel <113050972+RyanGarfinkel@users.noreply.github.com>
Signed-off-by: RyanGarfinkel <113050972+RyanGarfinkel@users.noreply.github.com>
@RyanGarfinkel RyanGarfinkel force-pushed the add-tsIncrement-compatibility-tests branch from 9e59c4e to 3e5f020 Compare June 29, 2026 04:23
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jun 29, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, enhancement
Project fields suggested: Component test-coverage · Priority P2 · Effort M · Status Needs Review
Confidence: 0.30 (deterministic)

Reasoning

component from path globs (test-coverage, test-framework); effort from diff stats (267+0 LOC, 4 files); LLM failed: Invalid response body while trying to fetch https://api.anthropic.com/v1/messages: Premature close

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.

Copilot AI review requested due to automatic review settings July 3, 2026 21:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the compatibility test coverage for the $tsIncrement aggregation expression operator, ensuring it behaves correctly across null/missing inputs, boundary values, invalid types, nested field paths, and usage inside common pipeline contexts like $match/$expr and $group.

Changes:

  • Added a dedicated TS_INCREMENT_TYPE_ERROR error code constant for $tsIncrement type-mismatch failures.
  • Introduced comprehensive $tsIncrement expression tests (null/missing, boundaries, invalid BSON types, nested field access).
  • Added “wiring” tests to validate $tsIncrement works inside $match with $expr and inside $group expressions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
documentdb_tests/framework/error_codes.py Adds a new server error code constant for $tsIncrement type mismatches.
documentdb_tests/compatibility/tests/core/operator/stages/match/test_match_with_expr.py Adds a $tsIncrement usage test inside $match + $expr.
documentdb_tests/compatibility/tests/core/operator/stages/group/test_group_expr_operators.py Adds $group coverage for $tsIncrement in _id and accumulator expressions.
documentdb_tests/compatibility/tests/core/operator/expressions/timestamp/tsIncrement/test_tsIncrement.py Adds broad operator-focused test coverage for $tsIncrement behavior and error handling.

Comment on lines +9 to 12
import pytest
from bson import Int64, Timestamp

from documentdb_tests.framework.assertions import (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compatibility test for $tsIncrement (second pass)

2 participants