Skip to content

Feature: query-and-write writeConcern parameter#620

Open
imforster wants to merge 6 commits into
documentdb:mainfrom
imforster:forstaia/writeConcern/query_and_write
Open

Feature: query-and-write writeConcern parameter#620
imforster wants to merge 6 commits into
documentdb:mainfrom
imforster:forstaia/writeConcern/query_and_write

Conversation

@imforster

@imforster imforster commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

#39
Test cases: 344 (+ 6 replica_set skipped on standalone)
Docs: https://www.mongodb.com/docs/v8.2/reference/write-concern/

Adds compatibility test coverage for the writeConcern cross-cutting parameter, validating its full surface area across write commands (update, delete, findAndModify) - from document type acceptance and sub-field validation (w, j, wtimeout) to full BSON type rejection matrix, value boundary cases, w:0 unacknowledged behavior, j:true override semantics, Decimal128 exponent-form coercions, case sensitivity, unknown field rejection, and findAndModify return value independence from writeConcern.

350 test cases across 5 files following project test guidelines.

Note: insert writeConcern already covered at commands/insert/test_insert_write_concern.py.

@imforster imforster requested a review from a team as a code owner June 17, 2026 18:05
@imforster imforster force-pushed the forstaia/writeConcern/query_and_write branch 2 times, most recently from 8a923cc to 971c71d Compare June 17, 2026 18:25
@imforster imforster added compatibility test Compatibility test related enhancement New feature or request labels Jun 17, 2026
Test cases: 344 (+ 6 replica_set skipped on standalone)
Docs: https://www.mongodb.com/docs/v8.2/reference/write-concern/

Adds compatibility test coverage for the writeConcern cross-cutting
parameter across write commands (update, delete, findAndModify) — from
document type acceptance and sub-field validation (w, j, wtimeout) to
full BSON type rejection matrix, value boundary cases, w:0 unacknowledged
behavior, j:true override semantics, Decimal128 exponent-form coercions,
case sensitivity, unknown field rejection, provenance sub-field acceptance,
wtimeout edge cases, w:0 writeError suppression, fractional double
coercion, and findAndModify return value independence from writeConcern.

350 test cases across 4 files following project test guidelines.
insert already covered at commands/insert/test_insert_write_concern.py.
bulkWrite excluded: admin-database command with different infrastructure.

Signed-off-by: Ian Forster <forstaia@amazon.com>
- Move PROVENANCE_ACCEPTANCE_TESTS from field_validation to acceptance file
- Remove unused assertNotError import from validation file
- Clarify bulkWrite exclusion rationale in utils comment

Signed-off-by: Ian Forster <forstaia@amazon.com>
…adConcern local availability

writeConcern field validation:
- Add INT64_MAX and INT64_MIN to w value rejection tests
- Add tagged object validation: reject empty {}, string tag values,
  and nested object tag values
- Add wtimeout extended overflow rejection for double, Decimal128,
  and +Infinity exceeding INT32_MAX

writeConcern acceptance:
- Add wtimeout boundary acceptance tests: INT32_MIN, -Infinity (double),
  and -Infinity (Decimal128) are accepted (upper-bound only constraint)

readConcern:
- Add test_read_concern_local_availability.py covering 'local' level
  availability without sessions, on aggregate/count/distinct, on empty
  collections, and equivalence to omitting readConcern

Signed-off-by: Ian Forster <forstaia@amazon.com>
test_read_concern_local_is_default_equivalent had two assertNotError calls
in one function, violating the one-assertion-per-test rule. Replaced with
a single test_read_concern_local_does_not_error that asserts only the
readConcern 'local' case.

Signed-off-by: Ian Forster <forstaia@amazon.com>
Align with PR documentdb#617 which replaced topology-coupled markers with
capability-based precondition markers.

Signed-off-by: Ian Forster <forstaia@amazon.com>
@imforster imforster force-pushed the forstaia/writeConcern/query_and_write branch from 0a07e95 to 0629d46 Compare June 23, 2026 23:55
…n=False

On a replica set, w:null, w:'Majority' (wrong case), and w:'' (empty
string custom tag) are handled as writeConcernErrors rather than rejected
upfront. Gate these cases so they only run against standalone targets.

Signed-off-by: Ian Forster <forstaia@amazon.com>
@imforster imforster force-pushed the forstaia/writeConcern/query_and_write branch from cd65b48 to e859e0a Compare June 24, 2026 00:13
@@ -0,0 +1,95 @@
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this here?

# insert excluded: already has dedicated tests at commands/insert/test_insert_write_concern.py.
# bulkWrite excluded: the MongoDB 8.0+ server-level bulkWrite command uses admin database
# with nsInfo/ops arrays, requiring fundamentally different command construction.
WRITE_COMMANDS = ["update", "delete", "findAndModify"]

@eerxuan eerxuan Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Per FOLDER_STRUCTURE.md principle 2, the acceptance test should be under each command folder. It seems they don't have the tests yet, can you move these tests?

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.

2 participants