Skip to content

Per-App Mock and Debug Runtime Modes for styfi, veyfi, and yeth (backward-compatible) #37

@0xPickles

Description

@0xPickles

Description
Today, mock behavior is mostly controlled globally via NEXT_PUBLIC_USE_MOCKS and NEXT_PUBLIC_E2E, while yeth is separately hardcoded to mock. This works for current preprod usage, but it does not support granular per-app runtime control (styfi on-chain, veyfi on-chain, yeth mock/debug) in a first-class way.

Implement per-app runtime mode resolution with minimal complexity and full backward compatibility.

  • Add new envs:

  • NEXT_PUBLIC_MOCK_APPS as CSV with allowed values styfi,veyfi,yeth, plus all and none.

  • NEXT_PUBLIC_DEBUG_APPS as CSV with same allowed values; default to NEXT_PUBLIC_MOCK_APPS when unset.

  • Keep NEXT_PUBLIC_E2E global in this phase.

  • Add a single runtime resolver module that returns:

  • mockByApp: { styfi: boolean, veyfi: boolean, yeth: boolean }

  • debugByApp: { styfi: boolean, veyfi: boolean, yeth: boolean }

  • Legacy fallback behavior when NEXT_PUBLIC_MOCK_APPS is unset:

  • NEXT_PUBLIC_USE_MOCKS=true -> all apps mock.

  • NEXT_PUBLIC_USE_MOCKS=false -> yeth mock, styfi/veyfi on-chain (current behavior).

  • Update protocol wiring and consumers to use app-specific mode flags instead of one shared usesMockBackend boolean for all apps.

  • Update debug controls rendering to use per-app debug flags.

  • Keep production safety checks strict:

  • In production runtime, styfi/veyfi mock mode must be forbidden.

  • yeth production gating should remain aligned with existing NEXT_PUBLIC_ENABLE_YETH behavior.

  • Update tests and docs to cover the new mode matrix and backward compatibility.

  • Remove obvious redundancy while touching this area (for example, unused protocol flags), but avoid unrelated refactors.

Acceptance Criteria

  • Can run styfi and veyfi on-chain while yeth remains mock in the same deployment.
  • Can independently enable/disable app debug controls without changing app backend mode.
  • Existing setups that only use NEXT_PUBLIC_USE_MOCKS continue to behave exactly as today.
  • Production invariant checks fail when styfi or veyfi mock mode is enabled in production runtime.
  • Unit tests cover env parsing and resolved app mode combinations.
  • Existing e2e flows continue passing under current CI env defaults.

Out of Scope

  • Per-app E2E connector behavior.
  • Any yETH on-chain client integration work.
  • Broad architectural cleanup outside runtime mode wiring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions