Skip to content

echo-wesley-gen emits uncompilable Rust for GraphQL enums #679

Description

@flyingrobots

Classification

Generator correctness defect discovered while routing Jim checkpoint declarations through the generated GraphQL/Wesley/installed-operation corridor.

Problem

echo-wesley-gen currently emits Rust for a GraphQL enum that does not compile:

  • the enum emitter writes #[cbor(index_only)] even when minicbor generation is not enabled;
  • emitted variants do not receive the stable #[n(...)] tags required by an index-only minicbor enum;
  • the current generator test checks for annotation strings in stdout, but does not compile the emitted consumer.

Jim therefore could not lawfully change the checkpoint reason field from String! to a GraphQL enum. PR #282 retained the scalar bridge and added native closed-domain witnesses rather than hand-editing generated Rust.

Evidence

Why it matters

An authored enum is part of the contract's semantic domain. If the generator cannot produce compilable code, consumers must either weaken the schema to a string or falsify generation by patching artifacts. Both create drift at exactly the boundary Wesley is supposed to make deterministic.

Constraints

  • Generated artifacts must compile without manual edits.
  • Numeric tags must be stable and deterministic when minicbor is requested.
  • Default/contract-host output must not acquire irrelevant minicbor-only attributes.
  • Do not make downstream consumers reproduce Echo identity or codec rules.
  • Edict may eventually replace this corridor, but the existing generator must not emit invalid Rust while it remains supported.

Acceptance criteria

  • A minimal GraphQL enum fixture generates a compiling default Rust consumer.
  • A minimal GraphQL enum fixture generates a compiling --contract-host consumer.
  • Default output omits minicbor-only helper attributes.
  • --minicbor output assigns every enum variant a stable numeric tag and compiles.
  • Round-trip witnesses cover every generated variant.
  • Consumer-crate compile tests fail if generated enum syntax or attributes regress.
  • Jim can replace the checkpoint reason string bridge with a generated enum without editing the artifact.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions