Repository navigation
fix(settings): carry a list under a catalogued enum key as the reference block - #520
Conversation
…nce block
A list value under a catalogued non-list settings key errored with 'does not match its table kind' where the pinned OverPy emits a block of bare lines under the key's display name ("mapRotation": ["a"] -> Map Rotation { a }). workshop-rs#413 (v1.13.0) now accepts a carried Group under a catalogued key, so translate the list through written_form — the same shape unknown-key lists already take.
The remaining #496 row (unknown-key scalars like 0.0000001 -> 1e-7) already converged through part A's JavaScript number formatting.
Fixes #496
e54-bot
left a comment
There was a problem hiding this comment.
The enum-key List arm is the right seam and is oracle-verified — but the companion catalogued-key row recorded on #496 (an authored dict under an enum key) still errors, and the manifest floor understates the new workshop-rs requirement.
Finding — {"a": 1} under a catalogued enum key still errors (crates/opy-rs/src/compiler/settings.rs:361)
#496's comment thread records the catalogued-key block row — "lobby": {"mapRotation": {"a": 1}} → Map Rotation { … } — as landing via workshop-rs#413 plus the released version bump consumed here. The bump is consumed (Cargo.lock: workshop-rs 1.14.0), but the row still fails:
- opy-rs at this head:
workshop-emission: settings key 'a' is outside the emission table— bothcheckandcompilereject it. - Pinned oracle 9.7.10:
Map Rotation { a: 1 }(nested{"a": "x", "b": {"c": 2}}→a: x,b { c: 2 }).
Cause: an authored dict reaches pass_through_members as Group { name: "mapRotation", children: [Number { "a", 1 }] } and falls to _ => continue unchanged. The #413 carried-block contract accepts a Group under a catalogued key only when its leaves are opaque (Raw/RawValue/Group) — the typed Number child is rejected by check_member. Extending the new carried arm to SettingsNode::Group through written_form converges it exactly (Number → RawValue → a: 1; nested groups keep key: value members — oracle-identical), the same shape unknown-key dicts already take. Either that correction or an issue-recorded deferral is needed — the commit currently claims Fixes #496.
Finding — workshop-rs requirement floor understates the new minimum (Cargo.toml:18)
workshop-rs = "^1.10.1", but the new arm requires ≥1.13.0's carried-Group-under-catalogued-key acceptance; on a 1.10–1.12 resolve it compiles and silently regresses this path to does not match its table kind. The repo's convention is to bump the requirement when behavior depends on a new workshop-rs contract (#493 set ^1.10.1 for the carried-member contract; the 1.3.0/1.5.0/1.7.0 bumps did the same). ^1.13 (or ^1.14, matching the lockfile) is the correct stated floor.
Same-seam divergences to record (owner decision, not necessarily this PR's code): a list under a non-enum catalogued key diverges kind-dependently — oracle 9.7.10: respawnTime%: ["a"] → Respawn Time Scalar: a%, enableKillCam: ["a"] → Kill Cam: Off, allowPlayersInQueue: ["a"] → Allow Players Who Are In Queue: No; opy-rs errors on all three with does not match its table kind. team1Slots: ["a"] and description: ["a"] reject on both sides (convergent). These are JS-coercion artifacts — plausibly recorded-exception material under the issue's own criterion — but today they are neither converged nor recorded while Fixes #496 is claimed.
Verified correct against the pinned oracle and the #413 contract: ["a","paused",1,true] → Map Rotation { a; paused; 1; true }; [] → Map Rotation { }; ["paused"] → a block, no member resolution; gamemodes.ffa.heroLimit: ["a"] → Hero Limit { a }; inapplicable hero key ana.ability3Cooldown%: ["a"] → verbatim ability3Cooldown% { a } under the authored name — oracle-identical; unknown key zzKey: {"a":1} → zzKey { a: 1 }; out-of-domain scalar mapRotation: "bogus" → Map Rotation: bogus with an unknown-setting warning, while the carried block warns on nothing — consistent with workshop-rs's residual classification. cargo test -p opy-rs --test tooling 23/23, fmt/clippy clean.
Review follow-up on #520: an object value under a catalogued enum key ({"mapRotation": {"a": 1}}) still failed the carried-block contract. The pinned reference writes the same display-name block of member lines (nested objects recurse), so the enum-key arm now applies written_form to Group as well as List. Also bumps the workshop-rs requirement to ^1.13.0 — the carried Group under a catalogued key requires #413's acceptance, which shipped in v1.13.0; a 1.10–1.12 resolve would silently regress to the kind-mismatch error.
|
Review findings addressed in
Gates: 24/24 tooling tests, fmt/clippy clean. |
e54-bot
left a comment
There was a problem hiding this comment.
LGTM — follow-up verified on 8851e6a.
All three prior findings are resolved: the enum-key arm now carries Group as well as List through written_form (verified end-to-end: {"a": 1, "b": {"c": 2}} -> Map Rotation { a: 1; b { c: 2 } }, check/compile agree); the workshop-rs floor is ^1.13.0, matching the #413 carried-block acceptance the Group carry requires; and an_object_under_an_enum_key_compiles_as_the_reference_block pins the group carry including nested objects alongside the multi-element list test.
Adjacent paths re-verified on the head commit: declared enum value -> Map Rotation: Paused; undeclared value -> Map Rotation: bogus + unknown-value warning; Number under enum -> Map Rotation: 5 + warning; unknown-key scalar/list/dict unchanged; catalogued String/Percent keys unchanged; inapplicable hero key list stays verbatim under the authored name. A list under a non-enum catalogued key still rejects (does not match its table kind) — that divergence is recorded on #496 for owner decision, and the same applies to the other recorded exceptions, so Fixes #496 is now accurate. Enum-domain keys never accept a typed List member (only ListMap/ListHero kinds do), so the arm cannot swallow a valid path.
cargo test -p opy-rs --test tooling: 24/24. CI: all 6 checks green.
Summary
Part B of #496, unblocked by workshop-rs v1.13.0 carrying #413 ("carry
blocks under catalogued keys as written").
A list value under a catalogued non-list settings key
(
"mapRotation": ["a"]) errored withworkshop-emission: settings key 'mapRotation' does not match its table kind, where the pinned OverPyemits a block of bare lines under the key's display name:
translate_membersnow translates aSettingsNode::Listunder acatalogued enum key through
written_form— the same List→Groupconversion unknown-key lists already take — instead of leaving the
kind-mismatched node for the emitter to reject. workshop-rs#413's carried
block does the rest: check accepts it and the emitter writes it under the
canonical key's localized display name.
The issue's other row (unknown-key scalars like
0.0000001→1e-7)already converges through part A's JavaScript
String(value)formatting(#507) — verified end-to-end.
Acceptance criteria
"zzUnknownKey": 0.0000001emitszzUnknownKey: 1e-7(alreadyconverged on main; confirmed via
opy-cli compile)."mapRotation": ["a"]emits theMap Rotation { a }block insteadof erroring — regression test
a_list_under_an_enum_key_compiles_as_the_reference_blockpins themulti-element shape (
["a", "paused", 1, true]→ four bare lines)and
check/compileagreement.documents the radix-spelling, reject-superset, and
1.e5-listexceptions; the catalogued number/percent JS-formatting gap is
routed to
wrightkit/workshop-rs#415(owner decision).Verification
opy-cli compile/checkon the reproducer:Map Rotation { a },0 diagnostics.
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo test --workspace --all-targets --all-features— all clean.git diff --checkclean.Fixes #496