Skip to content

Frontend (consume at startup with a typed schema) - #1775

Merged
Junirezz merged 1 commit into
Junirezz:mainfrom
victorEdeh:feat/1722-1725
Nov 22, 2026
Merged

Junirezz merged 1 commit into
Junirezz:mainfrom
victorEdeh:feat/1722-1725

Conversation

@victorEdeh

Copy link
Copy Markdown
Contributor

closes #1723
closes #1724
closes #1725
closes #1722

Summary of what's in place:

Backend (public, non-secret discovery endpoint)

  • Shared contract — publicConfig.ts :PublicConfigSchema (strict) +PUBLIC_FEATURE_FLAG_KEYS allow-list (deposit-v2 ,strategy-selection ,analytics-page ), exported from index.ts .
  • Flag snapshot — featureFlags.ts :getPublicFlags() returns only allow-listed keys, only booleans, and never the per-walletallowlist . A sharedevaluate() keeps the anonymous view from diverging fromisEnabled() .
  • Assembler — publicConfig.ts :buildPublicConfig() reads live state (env.NODE_ENV , live flags,getMaintenanceModeState().enabled ) and validates against the shared schema, so it can't drift.
  • Route — index.ts : publicGET /config .
  • Governance — openapi.json appended as the last path (matchesmergeDiscoveredRoutes append-order);CRITICAL_ENDPOINTS /snapshots intentionally untouched sosnapshots:check stays green.
  • Tests — publicConfig.test.ts (schema validity, live values, unconfigured-flag omission, allow-listed top-level keys, no secret substrings) and extended featureFlags.test.ts .

Frontend (consume at startup with a typed schema)

  • Typed client — publicConfig.ts :fetchPublicConfig() doesapiClient.get("/config") thenvalidate(PublicConfigSchema, …) (re-exported through schemas.ts / index.ts ).
  • Startup wiring — FeatureFlagContext.tsx : on mount it fetches/config , mapsANALYTICS_PAGE → analytics-page , and overrides flags; the build-timeVITE_FF_* value is now a fail-closed fallback used only before the response or if the request fails.useFeatureFlag 's API is unchanged.
  • Tests — rewrote feature-flags.test.tsx (runtime enable/disable overriding env, failure keeps fallback, gate rendering) and added publicConfig.test.ts (valid payload, schema violation, extra top-level key rejection, unknown flag key rejection).

Verification note

backend/node_modules andfrontend/node_modules are absent (only the root pnpm store is partially installed;zod ,react , etc. are not resolvable), so Jest/Vitest could not be executed here. Verification was static: I confirmedgetMaintenanceModeState().enabled matches the real export/interface in maintenanceMode.ts , that@yieldvault/api-schemas is already a load-bearing runtime import ( validate.ts ), and that/config 's OpenAPI block matches the generator's per-operation serialization byte-for-byte. Runpnpm install ,pnpm build:schemas , thenpnpm test to confirm.

One optional follow-up (not required by the issue): FEATURE_FLAGS.md still describesVITE_FF_* as the sole mechanism; it now acts as a fallback.

@drips-wave

drips-wave Bot commented Nov 21, 2026

Copy link
Copy Markdown

@victorEdeh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Junirezz
Junirezz merged commit 7305b5b into Junirezz:main Nov 22, 2026
15 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants