Skip to content

Commit 0685f7c

Browse files
docs(errors): full-doc save race-clobber pattern (post-mortem ref) (#3606)
* docs(errors): full-doc save race-clobber pattern (post-mortem ref) Repository.update(doc) implemented as new Model(doc).save() silently clobbers concurrent patchOne writes. Surfaced in trawl_node via the regression-detection feature (PRs #1115 #1116 #1118). Upstream fix tracked in Devkit-Node#3605. * docs(errors): fix review threads — atomic updates, Mongoose patterns, qualified refs
1 parent 514fbae commit 0685f7c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ERRORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ Use this file as a compact memory of recurring AI mistakes.
2626
- [2026-03-14] middleware: assuming config section exists in all environments (e.g. `config.rateLimit`) -> always handle missing config gracefully (passthrough/no-op); dev config often omits sections that only prod defines
2727
- [2026-03-15] cross-stack: changing a Node API without checking Vue E2E tests -> when modifying an endpoint Vue consumes, run Vue E2E tests before pushing
2828
- [2026-03-15] pr scope: batching multiple unrelated fixes in one PR -> one fix = one PR to isolate blast radius and reduce iteration loops
29+
- [2026-05-05] repository: Repository.update(doc) doing `new Model(doc).save()` rewrites the full document from in-memory state, silently clobbering any concurrent partial update that landed after the read -> always use `Model.updateOne({ _id }, { $set: ... })` or `findOneAndUpdate({ _id }, { $set: ... })` for partial updates to avoid race conditions; see comes-io/trawl_node#1115 comes-io/trawl_node#1116 comes-io/trawl_node#1118 + pierreb-devkit/Node#3605

0 commit comments

Comments
 (0)