Skip to content

fix(settings): carry a list under a catalogued enum key as the reference block - #520

Merged
e54-bot merged 2 commits into
mainfrom
fix/496-enum-key-lists
Oct 10, 2026
Merged

e54-bot merged 2 commits into
mainfrom
fix/496-enum-key-lists

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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 with workshop-emission: settings key 'mapRotation' does not match its table kind, where the pinned OverPy
emits a block of bare lines under the key's display name:

lobby {
    Map Rotation {
        a
    }
}

translate_members now translates a SettingsNode::List under a
catalogued enum key through written_form — the same List→Group
conversion 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.0000001 emits zzUnknownKey: 1e-7 (already
    converged on main; confirmed via opy-cli compile).
  • "mapRotation": ["a"] emits the Map Rotation { a } block instead
    of erroring — regression test
    a_list_under_an_enum_key_compiles_as_the_reference_block pins the
    multi-element shape (["a", "paused", 1, true] → four bare lines)
    and check/compile agreement.
  • Remaining differences stay recorded: the issue's divergence record
    documents the radix-spelling, reject-superset, and 1.e5-list
    exceptions; the catalogued number/percent JS-formatting gap is
    routed to wrightkit/workshop-rs#415 (owner decision).

Verification

  • opy-cli compile / check on 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 --check clean.

Fixes #496

…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 e54-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 — both check and compile reject 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.
@e54-bot

e54-bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Review findings addressed in 8851e6a:

  1. Object under a catalogued enum key — the arm now applies written_form to Group as well as List. {"mapRotation": {"a": 1, "b": {"c": 2}}} emits the oracle-identical Map Rotation { a: 1; b { c: 2 } }; new test an_object_under_an_enum_key_compiles_as_the_reference_block pins it.
  2. workshop-rs floor — bumped to ^1.13.0; a 1.10–1.12 resolve would regress to the kind-mismatch error since the carried Group requires fix(manifest): accept only upstream-accepted spellings for builtin calls #413.
  3. Non-enum-key list divergences — recorded on the issue as a residual needing an owner decision (JS-coercion semantics), not folded into this PR.

Gates: 24/24 tooling tests, fmt/clippy clean.

@e54-bot e54-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@e54-bot
e54-bot merged commit 522430f into main Oct 10, 2026
6 checks passed
@e54-bot
e54-bot deleted the fix/496-enum-key-lists branch October 10, 2026 22:35
@e54-bot e54-bot mentioned this pull request Oct 10, 2026
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.

Unknown-key settings values and enum-key lists are written differently from the pinned reference

2 participants