fix: repair broken merges, dead SSE reconnect loop, and make suite green - #501
Merged
usmanimamu17-create merged 2 commits intoSep 2, 2026
Merged
Conversation
Several PRs were merged with failing CI, leaving spliced or double-escaped code and tests written against an API that never landed. This restores a working tree: Production fixes: - session-sse: parser split on literal "\n" text instead of newlines, so session_revoked events were never detected (forced logouts never fired); non-200 responses returned early and never reconnected despite warning "retrying" — complete the abandoned shouldRetry refactor - outages: omit optional axios signal to satisfy exactOptionalPropertyTypes - CommandPalette: drop duplicated React import Test repairs (stale tests updated to current contracts): - session-sse: rewrite against the committed parseSessionSseFrame API - redirect: complete the truncated open-redirect suite from ApexChainx#456 - export-filename: fix titles where filename*="" ended the string early - auth-flow: mock the /auth/session cookie-session bootstrap probe - settings-wallet/settings-theme: router + I18nProvider + matchMedia stub - payments-view: query the heading, not the live-region announcer copy - useOutagesTableState: presets live under apexchain_user_preferences; reset module-level preference state between tests - contract: skip (not fail) when no live API is reachable - vitest.setup: default jsdom matchMedia stub Tooling: - eslint.config.mjs: scope typed-lint rules to src/tests with projectService so lint stops crashing on its own config file - package.json: remove accidental "install" and "npm" dependencies (mistaken installs, pull ~140 unneeded packages from the lockfile) Typecheck clean; 290 tests pass, 3 contract tests skip without a backend. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
…pexChainx#300) Dry.tsx re-implemented useFilterPresets, useOutagesTableState, and useOutagesList with a divergent localStorage key — a second source of truth for presets that nothing imported. Verified: no references in src/ or tests/; typecheck and full suite pass after removal. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
usmanimamu17-create
pushed a commit
that referenced
this pull request
Sep 2, 2026
…een (#501) * fix: repair broken merges, dead SSE reconnect loop, and make suite green Several PRs were merged with failing CI, leaving spliced or double-escaped code and tests written against an API that never landed. This restores a working tree: Production fixes: - session-sse: parser split on literal "\n" text instead of newlines, so session_revoked events were never detected (forced logouts never fired); non-200 responses returned early and never reconnected despite warning "retrying" — complete the abandoned shouldRetry refactor - outages: omit optional axios signal to satisfy exactOptionalPropertyTypes - CommandPalette: drop duplicated React import Test repairs (stale tests updated to current contracts): - session-sse: rewrite against the committed parseSessionSseFrame API - redirect: complete the truncated open-redirect suite from #456 - export-filename: fix titles where filename*="" ended the string early - auth-flow: mock the /auth/session cookie-session bootstrap probe - settings-wallet/settings-theme: router + I18nProvider + matchMedia stub - payments-view: query the heading, not the live-region announcer copy - useOutagesTableState: presets live under apexchain_user_preferences; reset module-level preference state between tests - contract: skip (not fail) when no live API is reachable - vitest.setup: default jsdom matchMedia stub Tooling: - eslint.config.mjs: scope typed-lint rules to src/tests with projectService so lint stops crashing on its own config file - package.json: remove accidental "install" and "npm" dependencies (mistaken installs, pull ~140 unneeded packages from the lockfile) Typecheck clean; 290 tests pass, 3 contract tests skip without a backend. * chore(outages): remove dead Dry.tsx duplicate of table hooks (issue #300) Dry.tsx re-implemented useFilterPresets, useOutagesTableState, and useOutagesList with a divergent localStorage key — a second source of truth for presets that nothing imported. Verified: no references in src/ or tests/; typecheck and full suite pass after removal.
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.
Summary
Several previously merged PRs landed with failing CI, leaving spliced or double-escaped code and tests written against an API that never shipped. This PR repairs both production bugs and the test suite. Builds on the partial cleanup already done in #e9ae185 / 6225763 (parallel fixes for the same corruption — thank you!), which this branch is rebased on top of.
Production fixes
src/lib/session-sse.ts(two real bugs):"\n"text instead of newlines (double-escaped escapes introduced in 0f251e5), sosession_revokedevents were never detected — server-initiated forced logouts silently never fired. FixesreplaceAll("\\r\\n","\\n")/split("\\n")/join("\\n")→ correct"\r\n"/"\n".return, never scheduling the promised reconnect (the code warnedretryingthen did nothing). Completed the abandonedshouldRetryrefactor (from bf2986a) so the backoff block is the single reconnect path: 401/403 stop retrying (after emittingsession_revoked), everything else reconnects with backoff, and the null-body path no longer silently drops the stream.src/lib/outages.ts: optional axiossignalviolatesexactOptionalPropertyTypes; now uses the repo's existing spread-guard pattern (same assrc/services/outages.ts).src/components/CommandPalette.tsx: removed duplicateduseMemo, useCallbackReact import (9704b1c).package.json: removed accidental"install"and"npm"dependencies (mistaken installs from bd52b7a); lockfile regenerates ~140 packages lighter.Test repairs (stale tests updated to current contracts)
tests/session-sse.test.ts: rewritten against the committedparseSessionSseFrameAPI — the committed file imported aprocessFrame(frame, onEvent)refactor that never landed (verified via the stalevitest-session-sse.jsonCI artifact, where those tests only passed on the author's machine).tests/redirect.test.ts,tests/export-filename.test.ts: broken string literals / truncated suite from spliced merges (aligns with the same fix done upstream in e9ae185 — conflict resolution takes upstream's equivalent version to minimize diff).tests/auth-flow.test.tsx: the provider now always probes the cookie-only/auth/sessionendpoint (a missing local flag doesn't rule out valid httpOnly cookies); tests updated to mock that probe.tests/settings-wallet.test.tsx/tests/settings-theme.test.tsx: added missinguseRoutermock +I18nProviderwrapper; added a default jsdommatchMediastub invitest.setup.ts(per-test stubs still override it).tests/payments-view.test.tsx:RouteEmptyState's live-region announcer repeats the title, so text queries matched twice — query the heading role instead.tests/useOutagesTableState.test.ts: filter presets live under the syncedapexchain_user_preferencesobject now; also reset the preferences module's module-level state between tests.tests/contract.test.ts: gates on a 1.5s/healthreachability probe andskipIfunavailable, so the default unit suite doesn't fail without the Prism mock backend (:4010).Tooling
eslint.config.mjs: typed-linting rules crashed ESLint because they applied to files with no tsconfig type info (including the config itself). Scopedno-explicit-any/no-unsafe-*tosrc/**andtests/**withprojectService: true. Lint now runs end-to-end.Verification
npm run typecheck— cleannpm test— 287 passed, 3 skipped (contract tests without a live backend), 0 failuresnpm run lint— runs cleanly; remaining errors/warnings are pre-existing code-quality debt (setState-in-effect patterns,anyin a tour test) deliberately left out of this repair commitpackage-lock.jsondiff vs HEAD: only theinstall/npmsubtrees removed — no version changes🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com
Linked issues
Fixes #300