Skip to content

Accept nested AbstractDict values in BSON - #156

Merged
quinnj merged 2 commits into
masterfrom
maintenance/bson-abstract-dictionaries
Oct 4, 2026
Merged

quinnj merged 2 commits into
masterfrom
maintenance/bson-abstract-dictionaries

Conversation

@quinnj

@quinnj quinnj commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Nested OrderedDict and other AbstractDict values raise MethodError during BSON construction, even though the standalone dictionary constructor accepts them. Broaden the shared nested-value setter to use that existing constructor. Encoded fields retain dictionary iteration order, and the more specific BSON subdocument method preserves native value types and snapshots.

Add 22 permanent public checks for direct assignment, pair and outer-dictionary constructors, arrays, recursive nesting, empty dictionaries, substring keys, field order, snapshots, and native BSON timestamps. The tests use the standard library; this change adds no dependency or export. Existing session tests now release their native handles explicitly and verify safe repeated cleanup, so teardown coverage does not depend on garbage collection timing.

Validation:

  • On Linux Julia 1.6.7 and 1.13.0, the permanent regression gives 14 passes and eight errors on unchanged source, then 22 passes with the fix.
  • A separate probe of the reported OrderedCollections.OrderedDict case, ImmutableDict, and Dict gives 16 passes and ten errors before the fix, then 36 passes on each runtime. OrderedCollections 1.6.3 and 1.8.2 were used only in external test environments.
  • Both complete suites pass all 393 checks against an isolated MongoDB 5.0.33 server, with two threads and bounds checking. The owned server has been removed.
  • Strict Documenter 0.27 builds pass on both runtimes, and the rendered API includes the input-order contract. Local deployment is intentionally skipped; hosted documentation checks are followed separately.
  • An independent private review of the full three-file change found no blocker. This does not provide GitHub approval.

Final head 8566d5a passes all 22 checks. Both ten-job workflows pass; all 18 coverage uploads were explicitly accepted for this repository and head, and all 18 reports are processed at 84.56% coverage. The existing coverage gates are unchanged. Merged as d77ad72b303cf9aac714162cffddbebfb0d95e40, with a tree identical to the tested head. All ten main-branch validation jobs pass; all nine expected reports are accepted and processed at 84.20%. The published API returns HTTP 200, documents dictionary iteration order, and has all 60 source links pointing to the merge commit.

Fixes #111.

Co-authored by Codex

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

Reuse the existing dictionary constructor for nested AbstractDict values.
Preserve dictionary iteration order and the specific BSON subdocument path.

Add public regressions for assignment, constructors, arrays, recursive and
empty values, snapshots, and native BSONTimestamp preservation. Both full
minimum/current suites pass all 388 checks against MongoDB 5.0.33.

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.56%. Comparing base (34374da) to head (8566d5a).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
+ Coverage   84.20%   84.56%   +0.36%     
==========================================
  Files          11       11              
  Lines        1652     1652              
==========================================
+ Hits         1391     1397       +6     
+ Misses        261      255       -6     

☔ 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.

Release session and session-options handles in the existing test fixtures and verify cleared handles and repeated cleanup. This exercises teardown independently of garbage collection timing.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
@quinnj
quinnj merged commit d77ad72 into master Oct 4, 2026
22 checks passed
@quinnj
quinnj deleted the maintenance/bson-abstract-dictionaries branch October 4, 2026 18:29
@quinnj

quinnj commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Merged as d77ad72b303cf9aac714162cffddbebfb0d95e40; the merge tree matches the tested tree. All ten main-branch validation jobs pass. All nine expected coverage uploads were explicitly accepted for this repository and commit, and all nine reports are processed (84.20%).

The published API manual returns HTTP 200, includes the dictionary iteration-order contract, and has all 60 source links pointing to the merge commit.

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.

OrderedDict gives error in Mongoc.BSON()

1 participant