Unify bets playback, market parity, and keeper recovery#130
Open
rndrntwrk wants to merge 174 commits into
Open
Unify bets playback, market parity, and keeper recovery#130rndrntwrk wants to merge 174 commits into
rndrntwrk wants to merge 174 commits into
Conversation
fix: split shared rpc reads from submit paths
Add per-chain keeper URL variables to the CI matrix so each package build resolves VITE_GAME_API_URL from its own GitHub variable (HYPERBET_SOLANA_KEEPER_URL, HYPERBET_BSC_KEEPER_URL, etc.) with public-facing domains preserved as last-resort fallbacks. Restore public domains in client config.ts defaults replacing Railway infrastructure URLs that were previously hardcoded.
fix: route CI builds through chain-specific keeper variables
…ment docs: align release tracking with active scope
(cherry picked from commit 8d47fd8)
(cherry picked from commit bc68f8c)
(cherry picked from commit ea88b42)
…pers # Conflicts: # bun.lock # packages/hyperbet-bsc/app/src/App.tsx # packages/hyperbet-evm/app/src/App.tsx # packages/hyperbet-solana/app/src/App.tsx # packages/hyperbet-ui/tests/predictionMarkets.test.ts
Three CI fixes for the unified-bets-parity-keepers branch: 1. `ci(prediction-market-gates)`: switch the Playwright browser install from `bunx playwright install` to the app package's `./node_modules/.bin/playwright`. `bunx` pulls the latest Playwright CLI from npm, which now ships chromium v1217, but `@playwright/test@1.58.2` expects v1208. The mismatch caused `browserType.launch: Executable doesn't exist at chromium_headless_shell-1208` on every Unified Bets E2E run after the Apr 23 CLI republish. 2. `fix(ui/streamSession)`: import `normalizePredictionMarketDuelKeyHex` directly from `@hyperbet/chain-registry` rather than from `./predictionMarkets`. The previous indirection created the cycle `predictionMarkets → config → streamSession → predictionMarkets` and caused `ReferenceError: Cannot access 'GAME_API_URL' before initialization` on page load, because `predictionMarkets`'s module-level URL consts were evaluated before `config` had assigned `GAME_API_URL`. `predictionMarkets` re-exports the function as-is, so routing callers through the registry breaks the cycle without changing behaviour. 3. `fix(keeper/betSync.test)`: annotate the three new `publicStreamStateChanged` test fixtures as `StreamState`. The partial mock objects were tripping `TS2345` because `BetSyncCanonicalAuthority` has thirteen non-optional fields and the fixtures only populate the subset the tests care about; the function only inspects via JSON.stringify so the cast is safe.
My earlier `as StreamState` cast tripped TS2352 ("types may be a mistake
because neither type sufficiently overlaps") — the fixture shape is a
narrow subset of `StreamState` (especially
`BetSyncCanonicalAuthority`'s 13 required fields), and TS refuses a
direct cast between insufficiently-overlapping types. Route through
`as unknown as StreamState` as the error message literally
recommends. No runtime change; the three fixtures still flow into
`publicStreamStateChanged` as before and its JSON.stringify
comparison works on whatever properties are actually present.
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.
Table of Contents
Summary
This PR aligns bettor-visible market state with the actual duel stream, hardens playback and market-parity behavior in the unified apps, and improves keeper recovery, auth, and result lookup behavior across the active rails.
Scope
This PR covers five linked areas:
Critical Fixes Since Review
Reviewers from earlier cycles flagged regressions that have been addressed on this branch. Each item below maps to a specific commit with test coverage. This PR exceeds GitHub's standard diff rendering limit, so this section is the reviewer-facing index for the fixes landed after review.
fix(ui): gate canonical preload on lifecycle identity(e498a6e4).packages/hyperbet-ui/src/lib/streamSession.tsnow applies the canonical-session / lifecycle match gate to both active playback and preload selection, so a mismatched canonical rail cannot still mount throughactiveStreamUrl || preloadStreamUrl.duelIdorduelKey, a canonical session with neither identifier is rejected instead of being treated as a match for any duel.fix(keeper): republish same-duel authority changes(15a3a561). Poll-mode publication now compares the public stream-state surface, not onlycycleId,phase, andwinnerId, so readiness, authority, source-runtime, and delivery-health changes can propagate within the same duel.fix(keeper): ignore volatile stream telemetry churn(657a59b3).publicStreamStateChangednow compares stable public fields instead of hashing raw cycle / timeline objects with timestamp-only churn.packages/hyperbet-ui/tests/streamSession.test.tsandpackages/hyperbet-{evm,bsc}/keeper/src/betSync.test.ts.Rollout
The viewer-alignment path is gated by
VITE_ENABLE_VIEWER_ALIGNED_BET_STATEand defaults off unless explicitly enabled. With the flag off, the adapter path remains inert and bettor panels continue to read the canonical state path.Key Changes
1. Canonical session and source-time propagation
2. Viewer-aligned bettor state
3. Playback, parity, and trade-gate behavior
4. Keeper recovery, auth, and result lookup
5. Supporting registry / IDL / tooling updates
Validation
Validation for this PR has included targeted coverage across the touched surfaces, including:
Review Guidance
Suggested review order: