Skip to content

bank: 10 enum class DTO fields have no glz::meta, breaking -DMORPH_BUILD_BANK_EXAMPLE=ON since morph#392's static_assert #445

Description

@Yaraslaut

What is wrong

examples/bank/include/bank/core/types.hpp declares 10 enum class types used as bare DTO fields (Currency, AccountKind, AccountStatus, TxnDirection, PaymentSchedule, PaymentStatus, CardStatus, CardKind, LoanStatus, TxnKind), none of which have a glz::meta/glz::enumerate specialization.

Per morph#392 (fixed by #444), morph::forms::schemaJson<A>() now static_asserts that every enum class member it reaches declares glz::meta/glz::enumerate — without one, glaze emitted a six-way wildcard schema type that the shipped DynamicForm rendered as a checkbox, silently reporting a form ready for a value nobody chose.

schemaJson<A>() is called unconditionally by BRIDGE_REGISTER_ACTION (morph::model::detail::buildActionDescription), independent of whether a rung renders any form through morph::forms — so bank, which uses BRIDGE_REGISTER_ACTION extensively (account_model.hpp, card_model.hpp, transaction_model.hpp, etc.) but predates the DTO-palette rule (IMPLEMENTATION.md rule 3 already notes "bank predates this rule"), fails to build with -DMORPH_BUILD_BANK_EXAMPLE=ON.

Why this isn't caught by CI today

MORPH_BUILD_BANK_EXAMPLE does not appear anywhere in .github/workflows/ci.yml — no CI job builds bank. This is a real, reproducible build break for anyone building bank locally (confirmed via -DMORPH_BUILD_BANK_EXAMPLE=ON on the windows-everything/cl-qt-release presets), but currently invisible to the CI matrix.

Why this needs its own investigation, not a copy-paste of ledger's fix

Unlike ledger's enums (which used implicit 0, 1, 2, ... values with no other reliance on the integer encoding), every one of bank's 10 enums declares explicit = 0, = 1, ... values:

enum class Currency : std::uint8_t {
    USD = 0,
    EUR = 1,
    GBP = 2,
    CHF = 3,
    JPY = 4,
};

Adding glz::meta/glz::enumerate switches the wire encoding from the raw integer to the enumerator name string. Before doing that for bank, someone needs to check whether anything — the WASM demo's JS glue, the CLI, a stored/cached payload — currently depends on the integer encoding, since this is bank's oldest, most widely-deployed rung (it has a live GitHub Pages WASM demo).

What would close this

Add glz::meta/glz::enumerate for all 10 enums (same pattern as ledger::Currency/kanban::Role), after confirming no consumer depends on the integer wire encoding — or, if one does, a considered decision on how to migrate it (a version bump, a dual-read period, etc.) rather than a silent break.

Verification status: reproduced

Confirmed via a real build: -DMORPH_BUILD_BANK_EXAMPLE=ON on windows-everything fails to compile bank's model/action-registration translation units with the same static_assert #392 added, once ledger's equivalent gap (fixed in #444) is cleared.

Found while verifying #444 (which fixed morph#392); bank's build was not exercised by that PR's CI, so this was found locally, not by a red check.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions