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.
Description
Today, mock behavior is mostly controlled globally via
NEXT_PUBLIC_USE_MOCKSandNEXT_PUBLIC_E2E, whileyethis separately hardcoded to mock. This works for current preprod usage, but it does not support granular per-app runtime control (styfion-chain,veyfion-chain,yethmock/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_APPSas CSV with allowed valuesstyfi,veyfi,yeth, plusallandnone.NEXT_PUBLIC_DEBUG_APPSas CSV with same allowed values; default toNEXT_PUBLIC_MOCK_APPSwhen unset.Keep
NEXT_PUBLIC_E2Eglobal 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_APPSis unset:NEXT_PUBLIC_USE_MOCKS=true-> all apps mock.NEXT_PUBLIC_USE_MOCKS=false->yethmock,styfi/veyfion-chain (current behavior).Update protocol wiring and consumers to use app-specific mode flags instead of one shared
usesMockBackendboolean for all apps.Update debug controls rendering to use per-app debug flags.
Keep production safety checks strict:
In production runtime,
styfi/veyfimock mode must be forbidden.yethproduction gating should remain aligned with existingNEXT_PUBLIC_ENABLE_YETHbehavior.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
styfiandveyfion-chain whileyethremains mock in the same deployment.NEXT_PUBLIC_USE_MOCKScontinue to behave exactly as today.styfiorveyfimock mode is enabled in production runtime.Out of Scope