Skip to content

fix(map): handle map values in select_replace match spec for put_newer#16

Merged
cabol merged 1 commit intomainfrom
cabol/fixes-and-enhancements
Apr 6, 2026
Merged

fix(map): handle map values in select_replace match spec for put_newer#16
cabol merged 1 commit intomainfrom
cabol/fixes-and-enhancements

Conversation

@cabol
Copy link
Copy Markdown
Contributor

@cabol cabol commented Apr 5, 2026

Maps in ETS match spec bodies were passed through as-is by ms_literal/1, causing "not a valid match specification" errors when values were or contained maps. Wrap maps with {:const, map} so ETS treats them as opaque literals.


Note

Low Risk
Low risk bug fix localized to ETS select_replace match-spec literal wrapping, with added tests covering nested map/tuple cases.

Overview
Fixes put_newer/5 and put_all_newer/3 updates when values contain maps by making ms_literal/1 wrap maps as {:const, map} so ETS treats them as opaque literals in select_replace match spec bodies.

Adds regression tests for nested map values and tuple values containing maps, updates the changelog, and bumps the package version to 0.4.1.

Reviewed by Cursor Bugbot for commit 517fc7a. Bugbot is set up for automated code reviews on this repo. Configure here.

Maps in ETS match spec bodies were passed through as-is by `ms_literal/1`,
causing "not a valid match specification" errors when values were or
contained maps. Wrap maps with `{:const, map}` so ETS treats them as
opaque literals.
@cabol cabol requested a review from andyleclair April 5, 2026 13:06
Copy link
Copy Markdown
Member

@andyleclair andyleclair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@cabol cabol merged commit 2962186 into main Apr 6, 2026
5 checks passed
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