Skip to content

Failing specs for embedded doc position updating - #87

Closed
johnnyshields wants to merge 1 commit into
masterfrom
fails-specs-for-embedded-doc-position
Closed

johnnyshields wants to merge 1 commit into
masterfrom
fails-specs-for-embedded-doc-position

Conversation

@johnnyshields

@johnnyshields johnnyshields commented Nov 7, 2023 •

Copy link
Copy Markdown
Member

This PR currently demonstrates divergent behavior where the following are not equivalent on embedded docs:

# this correctly preserves order
embedded_doc.move_to(2)
embedded_doc.save!

# this does NOT preserve order and just literally sets the position field
embedded_doc.position = 2
embedded_doc.save!

This behavior does work correctly on non-embedded docs.

(TBD: perhaps we need an option to preserve legacy direct position setting behavior, but i doubt it...)

dblock added a commit to dblock/mongoid_orderable that referenced this pull request Oct 17, 2026
Preserve existing movement helpers, derive embedded current positions from dirty tracking, and exclude the pending position when determining list bounds. Incorporate and extend the regression tests from mongoid#87.

Co-authored-by: johnnyshields <27655+johnnyshields@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock

dblock commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thank you for these reproductions, @johnnyshields. They exposed the embedded-position bug and are incorporated into #92, with co-author credit, alongside the fix and additional regression cases. #92 passes the current Ruby/Mongoid/MongoDB matrix. Closing this test-only PR in favor of that complete fix.

Posted by an AI on behalf of @dblock.

@dblock dblock closed this Oct 17, 2026
dblock added a commit to dblock/mongoid_orderable that referenced this pull request Oct 17, 2026
Preserve existing movement helpers, derive embedded current positions from dirty tracking, and exclude the pending position when determining list bounds. Incorporate and extend the regression tests from mongoid#87.

Co-authored-by: johnnyshields <27655+johnnyshields@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock added a commit that referenced this pull request Oct 17, 2026
Preserve existing movement helpers, derive embedded current positions from dirty tracking, and exclude the pending position when determining list bounds. Incorporate and extend the regression tests from #87.

Co-authored-by: johnnyshields <27655+johnnyshields@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants