Skip to content

echo-wesley-gen is a 2000-line monolith with mixed concerns #406

Description

@flyingrobots

Migrated from Method backlog

This issue was created from a legacy filesystem backlog card. GitHub Issues are now the live work tracker; repository docs remain Method evidence.

Source backlog: docs/method/backlog/bad-code/PLATFORM_echo-wesley-gen-monolith.md
Original lane: bad-code
Original legend: PLATFORM

Original backlog card

echo-wesley-gen is a 2000-line monolith with mixed concerns

Status: bad code.

Where

crates/echo-wesley-gen/src/main.rs — single 2000+ line file.

Smell

One file emits:

  • GraphQL → Rust type definitions (struct/enum)
  • LE binary Encode/Decode impls
  • Op id constants + OP_*_ARGS tables
  • Footprint certificates + observer plan identities
  • RegistryProvider implementation + static REGISTRY
  • __echo_wesley_generated helper module with Vars structs
  • EINT intent packers (pack_*_intent, pack_*_intent_raw_vars)
  • Optic dispatch/observe request builders
  • Contract-host helpers (*_contract_rule, *_contract_vars,
    *_query_observer) gated by --contract-host

Every consumer pays the cost of every concern. Tests are slow (full
cargo run + smoke crate compile per case). Adding a new emit feature
means threading a new flag through eight code paths.

Why it matters

This file is also where the cross-language stable_op_id algorithm
lived until 2026-05-28. The fact that algorithm-as-source-of-truth
got buried in a code-emitter monolith is precisely the kind of smell
that delayed Wesley adoption.

Suggested split

  • echo-wesley-gen-types — struct/enum + Encode/Decode emit
  • echo-wesley-gen-ops — op_id table + arg descriptors + RegistryProvider
  • echo-wesley-gen-intent — EINT packers + optic helpers
  • echo-wesley-gen-contract-host — gated host-side helpers
  • A thin top-level binary that composes them

Each compose-able piece can be tested in isolation. Algorithms shared
across targets (e.g., stable_op_id) migrate to wesley-core rather
than a vendored copy.

Surface when

Touching anything in this file. The next agent who has to add an emit
target will feel the pain; that's a good moment to extract.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions