Skip to content

fix(auth,api,outages): resolve #293, #294, #295, #300 — preferences auth pipeline, memory-only tokens, refresh rotation, dead-code removal - #502

Merged
usmanimamu17-create merged 3 commits into
ApexChainx:mainfrom
Adiz4415:fix/assigned-issues-293-294-295-300
Sep 2, 2026
Merged

fix(auth,api,outages): resolve #293, #294, #295, #300 — preferences auth pipeline, memory-only tokens, refresh rotation, dead-code removal#502
usmanimamu17-create merged 3 commits into
ApexChainx:mainfrom
Adiz4415:fix/assigned-issues-293-294-295-300

Conversation

@Adiz4415

@Adiz4415 Adiz4415 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Single PR resolving all four open issues assigned to @Adiz4415, plus repo health repairs so every quality gate passes:

Issue Fix
#293 — preferences sync bypasses the axios auth pipeline Preferences flow through the shared api instance (CSRF header, bearer auth, single-flight 401 refresh, timeout) + a retry queue for transient failures; the redundant fetch-based apiClient/buildApiUrl are deleted
#294 — refresh token persisted in JS-readable cookies Tokens are memory-only; nothing is written to document.cookie; clearTokens sweeps legacy noc_*_token cookies; hard-refresh recovery stays on the httpOnly /auth/session bootstrap
#295doRefresh drops the rotated refresh token Rotated refresh_token and the renewed access token are persisted under the single-flight refresh, so consecutive refreshes present valid tokens
#300Dry.tsx dead code with divergent localStorage key Deleted (verified zero references); presets use the single apexchain_user_preferences store

Repo health repairs (also in this PR)

  • npm run lint works againeslint.config.mjs now provides parserOptions.projectService for TS files, fixing the typed-linting crash that prevented ESLint from ever running. Result: 0 errors (46 warnings). The two newly-enforceable React Compiler rules (set-state-in-effect, refs) are downgraded to warnings with justification — they flag pre-existing architectural patterns needing deliberate refactors.
  • npm run typecheck — 0 errors (was 4): fixed the pre-existing exactOptionalPropertyTypes build blocker in src/lib/outages.ts, the stale processFrame import in session-sse tests, and null-safety in settings-theme/OnboardingTour tests.
  • npm test — 296 passing, 0 failing (was 28 failures on main):
    • Real source bugs fixed: src/lib/session-sse.ts had double-escaped \n literals so every SSE frame failed to parse, and it silently gave up on transient 5xx/429 instead of reconnecting — both fixed, with tests.
    • Stale tests updated: session-sse rewritten for the current parseSessionSseFrame API; auth-flow updated for the cookie-probe bootstrap; drawer/settings/payments tests get the mocks they were missing (useToast, I18nProvider, useRouter, useStellarHealth, useUsdRates); contract tests skip when no live backend is reachable (environment condition, not a regression).

Issue fixes in detail

Verification

  • npm run build — passes
  • npm run typecheck0 errors
  • npm run lint0 errors (46 warnings)
  • npm test296 passed / 0 failed (3 contract tests skip without a live backend; runnable via API_BASE_URL=... npm test -- contract)
  • npm run test:e2e16/16 passed — the full Playwright suite from this repo's E2E CI workflow was executed locally against the dev server (chromium, webServer auto-start), covering login/registration, outage creation + resolution + SLA + payments, bulk import (success + rejection), retry queue, offline outages, session restore via /auth/session, and the axe accessibility scans.

CI note

The two PR workflows (API Codegen Drift Check, E2E Tests) show action_required because GitHub gates workflow runs on fork PRs behind maintainer approval. Both were replicated locally:

  • API Codegen Drift Check — this PR does not touch src/types/api.generated.ts (diff vs upstream/main is empty), so the drift check will pass.
  • E2E Tests — the exact npm run test:e2e command the workflow runs passes 16/16 (see above; system deps installed as the workflow's playwright install --with-deps would).

Acceptance criteria coverage

Closes #293
Closes #294
Closes #295
Closes #300

…ainx#295, ApexChainx#300

Closes ApexChainx#293
Closes ApexChainx#294
Closes ApexChainx#295
Closes ApexChainx#300

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@Adiz4415 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

Adiz4415 and others added 2 commits September 2, 2026 18:11
…ng failures

- eslint.config.mjs: provide parserOptions.projectService for TS files so
  typed rules stop crashing ESLint at startup; scope the typed rules to
  files covered by tsconfig; downgrade the two React Compiler rules
  (set-state-in-effect, refs) to warnings with justification — they only
  became enforceable once linting ran at all.
- session-sse: fix double-escaped \n literals that made every SSE frame
  unparseable; reconnect with backoff on transient 5xx/429 instead of
  returning silently; drop the dead shouldRetry flag.
- tests: rewrite session-sse tests for the current parseSessionSseFrame
  API; mock useToast/I18nProvider/useRouter/useStellarHealth/useUsdRates
  where components gained dependencies; assert via getAllByText where
  titles render twice (heading + Announcer); update auth-flow to the
  cookie-probe bootstrap behavior; skip contract tests when no live
  backend is reachable; fix OnboardingTour test typing.

Verification: typecheck 0 errors, lint 0 errors, 296 tests passing
(3 contract tests skip without a live backend), build passes.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Refactor the six components flagged by the React Compiler rules so
react-hooks/set-state-in-effect and react-hooks/refs can be enforced as
errors:

- CommandPalette: reset the selected index in the open-event handler and
  focus via the mount-only effect instead of syncing on every query change.
- sla-dashboard-view: derive compareModeActive from compareMode && hasDateRange
  at render time instead of force-exiting comparison mode in an effect.
- data-table keyboard navigation: clamp the focused index when read (derived
  effectiveFocusedIndex) instead of writing it back in an effect.
- SLADisputesPanel: reset the page inside the filter click handler.
- ConfirmDialog: mount the dialog surface only while open so the typed value
  resets by remounting rather than via an effect.
- useUnsavedChangesGuard: sync the dirty ref from an effect, not during render.
- useUsdRates: move the shared rates cache into a module-level external store
  consumed via useSyncExternalStore, replacing the forceRender hack.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

Adiz4415 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

👋 Maintainer action needed to close the assigned issues.

This PR resolves all four open issues assigned to @Adiz4415 — GitHub links them via closing keywords (#293, #294, #295, #300), so merging closes them automatically.

All gates were verified locally (fork CI runs await maintainer approval):

Check Result
npm run build ✅ passes
npm run typecheck ✅ 0 errors
npm run lint ✅ 0 errors (typed linting enabled, React Compiler rules enforced)
npm test ✅ 296 passed / 0 failed
npm run test:e2e ✅ 16/16 passed
API codegen drift ✅ PR does not touch src/types/api.generated.ts

Could a maintainer please approve the workflow runs (or just merge)? Happy to address any review feedback.

@usmanimamu17-create
usmanimamu17-create merged commit 916a05c into ApexChainx:main Sep 2, 2026
2 checks passed
usmanimamu17-create pushed a commit that referenced this pull request Sep 2, 2026
…uth pipeline, memory-only tokens, refresh rotation, dead-code removal (#502)

* fix(auth,api,outages): resolve #293, #294, #295, #300

Closes #293
Closes #294
Closes #295
Closes #300




* fix(lint,tests): repair typed-linting config and clear all pre-existing failures

- eslint.config.mjs: provide parserOptions.projectService for TS files so
  typed rules stop crashing ESLint at startup; scope the typed rules to
  files covered by tsconfig; downgrade the two React Compiler rules
  (set-state-in-effect, refs) to warnings with justification — they only
  became enforceable once linting ran at all.
- session-sse: fix double-escaped \n literals that made every SSE frame
  unparseable; reconnect with backoff on transient 5xx/429 instead of
  returning silently; drop the dead shouldRetry flag.
- tests: rewrite session-sse tests for the current parseSessionSseFrame
  API; mock useToast/I18nProvider/useRouter/useStellarHealth/useUsdRates
  where components gained dependencies; assert via getAllByText where
  titles render twice (heading + Announcer); update auth-flow to the
  cookie-probe bootstrap behavior; skip contract tests when no live
  backend is reachable; fix OnboardingTour test typing.

Verification: typecheck 0 errors, lint 0 errors, 296 tests passing
(3 contract tests skip without a live backend), build passes.




* refactor(react): clear set-state-in-effect and refs lint warnings

Refactor the six components flagged by the React Compiler rules so
react-hooks/set-state-in-effect and react-hooks/refs can be enforced as
errors:

- CommandPalette: reset the selected index in the open-event handler and
  focus via the mount-only effect instead of syncing on every query change.
- sla-dashboard-view: derive compareModeActive from compareMode && hasDateRange
  at render time instead of force-exiting comparison mode in an effect.
- data-table keyboard navigation: clamp the focused index when read (derived
  effectiveFocusedIndex) instead of writing it back in an effect.
- SLADisputesPanel: reset the page inside the filter click handler.
- ConfirmDialog: mount the dialog surface only while open so the typed value
  resets by remounting rather than via an effect.
- useUnsavedChangesGuard: sync the dirty ref from an effect, not during render.
- useUsdRates: move the shared rates cache into a module-level external store
  consumed via useSyncExternalStore, replacing the forceRender hack.




---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment