From 7f39016d5f7487911febe494a762b6474c1b01c0 Mon Sep 17 00:00:00 2001 From: Randolph Tan Date: Thu, 4 Dec 2025 11:31:08 -0500 Subject: [PATCH] SERVER-114696 Update assert.soon rule in cs-robust-jstest (#44682) GitOrigin-RevId: 68de688ac132fad8b2715c682ae37d089b561aa3 --- .cursor/rules/cs-robust-jstests.mdc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cursor/rules/cs-robust-jstests.mdc b/.cursor/rules/cs-robust-jstests.mdc index f7c668100ef..8664c1f0b92 100644 --- a/.cursor/rules/cs-robust-jstests.mdc +++ b/.cursor/rules/cs-robust-jstests.mdc @@ -8,7 +8,7 @@ This rule mandates that all AI-generated code, suggestions, and documentation fo ## CONDITIONS -Targeted file path: These rules apply to any file matching the glob `jstests/**/*.js +Targeted file path: These rules apply to any file matching the glob `jstests/**/*.js` Allowed actions: 1. Generating new test code: Fully permitted, but must follow all rules below. 2. Refactoring/editing existing test code: Fully permitted, but must follow all rules below. @@ -52,7 +52,7 @@ Required practices (Violations trigger an error/warning and corrective suggestio 10. **Always ensure the test includes a clear top-level comment** describing the test's purpose. -11. **Ensure that non-assertion exceptions are handled inside the callback of `assert.soon`**. In general, prefer using runCommand method over helpers like find method that throws exceptions when getting an error response. +11. **Ensure that non-assertion exceptions are handled inside the callback of `assert.soon`**. If the mongo connection object is used in the callback and is connected directly to a shard or replica set node, prefer using assert.soonRetryOnNetworkErrors or the more generic assert.soonRetryOnAcceptableErrors (note that the mongo connection objects used in jstests can still throw network errors). Mongo shell connections to mongos are mostly exempt to this rule since we almost never kill mongos in tests or passthroughs. ## INSTRUCTIONS FOR REVIEWERS