feat(page-money): mock/live harness toggle + scenario controls + loud banner - #9
Merged
Merged
Conversation
… banner Layer-1 local-dev DX for the page-money template: make the mock host the obvious, safe-by-default mode; expose the new createMockHost scenario controls; and wire (but don't fake) an opt-in live mode. - Mock is the default + LOUD. dev:harness stays mock; a fixed "🧪 MOCK HOST · no real Buzz spent · no real compute" banner is always on screen. - Opt-in live mode (dev:live / VITE_HARNESS_MODE=live), loudly warned. Live needs a real block token (VITE_LIVE_BLOCK_TOKEN) + target origin. A true live proxy-host is Layer 2 (needs a server dev-token endpoint) — NOT built — so live FAILS SAFE: resolveLiveConfig() returns ready:false (clear reason) unless both a token AND VITE_LIVE_PROXY_READY=true are present, and main.tsx renders a "⚠️ LIVE — not yet available" notice instead of silently spending/breaking. The env + mode switch are wired so it lights up when Layer 2 lands. - Scenario controls exposed two ways: an on-screen dev-only panel (force insufficient Buzz / fail-next / failRate / balance / latency) AND URL params (?balance/?fail/?latency/?costPerGen/?failNext/?failRate) mapping to the new generation/buzz SDK options. - Bump deps: @civitai/blocks-react ^0.8.0 -> ^0.10.0, @civitai/app-sdk ^0.12.0 -> ^0.13.0. - README: "Mock vs live" + scenario tables + the publish-sequencing note. SEQUENCING: ci.yml's rot-guard installs @civitai/blocks-react@^0.10.0 from npm, so this PR's CI is GREEN only AFTER the app-starters Part A PR publishes 0.10.0. Merge this AFTER that publish. Verified locally by installing the Part A build tarballs into the scaffolded template: tsc/vitest(14)/vite build all green. Go tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ZacxDev
force-pushed
the
zach/template-mock-live-toggle
branch
from
June 22, 2026 21:32
7a68aa0 to
007a7d3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Layer 1 of the App Blocks local-dev DX, template half. Makes the page-money template's mock host the obvious, safe-by-default mode, exposes the new
createMockHostscenario controls in the harness, and wires (but does not fake) an opt-in live mode. Companion to the SDK PR that adds the scenarios: civitai/civitai-app-starters#54.Changes
dev:harnessstays mock; a fixed🧪 MOCK HOST · no real Buzz spent · no real computebanner is always on screen.livemode (npm run dev:live/VITE_HARNESS_MODE=live), loudly warned (⚠️ LIVE — spends REAL Buzz / real compute). Live reads a real block token (VITE_LIVE_BLOCK_TOKEN) + target origin (VITE_LIVE_HOST_ORIGIN).resolveLiveConfig()returnsready:false(with a clear reason) unless BOTH a token ANDVITE_LIVE_PROXY_READY=trueare set, andmain.tsxrenders a clear "not yet available" notice instead of silently spending or breaking. The env reads + mode switch are wired so it lights up the moment Layer 2 lands. It does not fake "live" as mock.?balance/?fail/?latency(2000or500-2000) /?costPerGen/?failNext/?failRate— mapping to the newgeneration/buzzSDK options.@civitai/blocks-react^0.8.0→^0.10.0,@civitai/app-sdk^0.12.0→^0.13.0.ci.yml's rot-guard scaffolds the template and runsnpm installagainst the published@civitai/blocks-react. This PR pins^0.10.0, which doesn't exist on npm until civitai-app-starters#54 is merged + its Version Packages PR publishes0.10.0. So Part B's CI is green only after Part A publishes — merge this PR after that publish (the pinned^0.10.0is exact-targeted to the minor bump from #54).Verification
The new SDK version isn't on npm yet, so I verified locally by
npm pack-ing the Part A build and installing the tarballs into a freshly-scaffolded project:civitai app init … --template page-money— scaffolds clean (Go templating valid; all inline styles moved to namedCSSPropertiesconsts to avoid the{{ }}collision).tsc -p tsconfig.json --noEmit— green.vitest run— 14 passed (incl. the e2e estimate→consent→submit→poll money-path proof) against the new SDK.vite build— green.go test ./...— all packages pass (scaffold + cmd).Real vs stub: mock mode + scenarios are fully real and exercised.
livemode is a wired stub that fail-safes pending Layer 2 (the server dev-token endpoint / live proxy-host).🤖 Generated with Claude Code