Skip to content

Retain bulk write replies when execution throws - #157

Merged
quinnj merged 1 commit into
masterfrom
maintenance/bulk-reply
Oct 4, 2026
Merged

quinnj merged 1 commit into
masterfrom
maintenance/bulk-reply

Conversation

@quinnj

@quinnj quinnj commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

An unordered bulk insert can save valid documents and still throw BSONError for a duplicate key. The current API discards the driver reply, so callers cannot inspect the saved count or identify the failed input. Add an optional reply=Ref{Mongoc.BSON}() output to execute! and both collection forms of insert_many. Populate it before propagating the existing error, and keep the reply alive after the bulk handle is released.

The existing success result and thrown error types stay the same. The reference is unchanged when execution is rejected before calling the driver. Document partial success, zero-based write-error indices, empty failure replies, and reply ownership. No dependencies, exports, versions, or workflow changes are included.

Validation:

  • Reproduced the loss with actual MongoDB 5.0.33 and libmongoc 1.30.8 on Linux Julia 1.6.7 and 1.13.0: the native failure reply reports two successful inserts and error index zero, while the public call throws without exposing that reply.
  • All 63 new checks pass on both runtimes. They cover ordered and unordered errors through the direct bulk and collection APIs, the unchanged duplicate-key error, collection contents, retained replies after garbage collection, rejected repeated execution, success aliasing, empty-bulk failure, and session forwarding.
  • Both complete suites pass 456 checks with bounds checking and two threads against the isolated native database.
  • Both strict Documenter builds pass. The rendered API includes both documented methods and their ownership and failure behavior. Local deployment was skipped; hosted publication is a separate check.
  • Complete private review found no blocking issues. The four reviewed source, test, and documentation files match the tested candidate, and git diff --check passes. All 20 hosted CI jobs pass across the push and PR workflows, including 18 actual native suites and all nightly lanes. Each exact repository/SHA upload was accepted, and all 18 distinct coverage reports are fully processed at 84.71%. Both Codecov checks pass.
  • Merged as 1125734a1d65a7cf482d75bcbc3dba0d97be3050, with the identical reviewed source tree. All 10 merged-master CI jobs pass, including nine native lanes and every nightly lane. All nine correct-commit coverage reports are accepted and fully processed at 84.71%. The hosted API page returns HTTP 200, documents both reply methods, and every Julia source link points to this merge. No package release was made.

Fixes #118.

Co-authored by Codex

AI disclosure: This work was prepared with assistance from OpenAI Codex.

Expose an optional owned BSON output before propagating the driver error, including through collection sessions.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.71%. Comparing base (d77ad72) to head (afc9c3e).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #157      +/-   ##
==========================================
+ Coverage   84.20%   84.71%   +0.51%     
==========================================
  Files          11       11              
  Lines        1652     1655       +3     
==========================================
+ Hits         1391     1402      +11     
+ Misses        261      253       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@quinnj
quinnj merged commit 1125734 into master Oct 4, 2026
22 checks passed
@quinnj
quinnj deleted the maintenance/bulk-reply branch October 4, 2026 20:52
@quinnj

quinnj commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Merged as 1125734. The merge has exactly the reviewed and tested source tree.

All 20 PR/push CI jobs and all 10 merged-master jobs passed. This includes every actual nightly suite and the Windows initialization checks. All 18 head and nine main coverage uploads were accepted for the correct repository and commit; every distinct report finished processing, with 84.71% aggregate coverage at both commits.

The hosted API documentation now describes the optional reply reference, partial success, zero-based write-error indices, and reply lifetime. The page returns HTTP 200, and every Julia source link points to the merged commit. The real MongoDB minimum/current regressions and complete suites passed before publication. No package release was made.

AI disclosure: This work was prepared with assistance from OpenAI Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

insert_many(..., bulk_options={ordered : false}) throws exception

1 participant