Skip to content

Commit 7bfcff5

Browse files
committed
chore(release): 0.29.0
Roll [Unreleased] into [0.29.0] and align magnus tagged-enum integration test with the per-variant factory drop.
1 parent 2e0ff7c commit 7bfcff5

2 files changed

Lines changed: 16 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.29.0] - 2026-06-26
11+
1012
### Fixed
1113

1214
- **pyo3 (Python): qualify builtin containers shadowed by a data-enum variant factory name.**

tests/backends_magnus_gen_bindings_test.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,36 +1867,29 @@ fn test_tagged_union_enum_vec_field_serde_marshalling() {
18671867
// Verify that the serde tag attribute is present
18681868
assert!(content.contains("tag = \"type\""), "Should have serde tag attribute");
18691869

1870-
// Per-variant singleton constructors: `Result.success(items)` / `Result.error(message)`. The
1871-
// field type matches the serde-shaped enum variant (Vec<Item> stays Vec<Item>; no conversion).
1870+
// Tagged data enums get NO Rust factory class: it is represented on the Ruby side as a
1871+
// `module Result` with per-variant `Data.define` classes, and a `define_class("Result")` would
1872+
// collide with that module (raising `TypeError: Result is not a module` at load). The factory
1873+
// methods, class registration, and singleton constructors are all gated on `serde_tag.is_none()`.
18721874
assert!(
1873-
content.contains("impl Result {"),
1874-
"data enum should get a constructor impl block: {content}"
1875+
!content.contains("pub fn _factory_success"),
1876+
"tagged data enum must not emit per-variant factory constructors: {content}"
18751877
);
18761878
assert!(
1877-
content.contains("pub fn _factory_success(items: Vec<Item>) -> Self"),
1878-
"success constructor signature should match the serde-shaped field type: {content}"
1879+
!content.contains("pub fn _factory_error"),
1880+
"tagged data enum must not emit per-variant factory constructors: {content}"
18791881
);
18801882
assert!(
1881-
content.contains("Self::Success { items }"),
1882-
"success constructor should build the variant directly: {content}"
1883+
!content.contains(r#"module.define_class("Result""#),
1884+
"tagged data enum must not register a Rust factory class: {content}"
18831885
);
18841886
assert!(
1885-
content.contains("pub fn _factory_error(message: String) -> Self"),
1886-
"error constructor signature: {content}"
1887+
!content.contains(r#"define_singleton_method("success""#),
1888+
"tagged data enum must not register per-variant singleton constructors: {content}"
18871889
);
1888-
// Registered under the bare snake name on a Ruby class for the enum.
18891890
assert!(
1890-
content.contains(r#"module.define_class("Result""#),
1891-
"data enum with constructors should be registered as a Ruby class: {content}"
1892-
);
1893-
assert!(
1894-
content.contains(r#"define_singleton_method("success", function!(Result::_factory_success, 1))"#),
1895-
"success constructor should be registered as a singleton method: {content}"
1896-
);
1897-
assert!(
1898-
content.contains(r#"define_singleton_method("error", function!(Result::_factory_error, 1))"#),
1899-
"error constructor should be registered as a singleton method: {content}"
1891+
!content.contains(r#"define_singleton_method("error""#),
1892+
"tagged data enum must not register per-variant singleton constructors: {content}"
19001893
);
19011894
}
19021895

0 commit comments

Comments
 (0)