Skip to content

PHEE-400: add token refresh, G2P mock, dual dev modes and extensibility docs - #13

Merged
DavidH-1 merged 2 commits into
openMF:devfrom
Flashl3opard:feat/token-refresh-msw-docs-g2p-mock
Aug 13, 2026
Merged

DavidH-1 merged 2 commits into
openMF:devfrom
Flashl3opard:feat/token-refresh-msw-docs-g2p-mock

Conversation

@Flashl3opard

@Flashl3opard Flashl3opard commented Aug 10, 2026

Copy link
Copy Markdown
Member

Related

Epic: PHEE-363
Closes: PHEE-400

Summary

Adds token refresh handling, G2P Config MSW mock with dual dev
modes, and extensibility/maintainability documentation.

Changes

Token Refresh & Session Management

  • 60s polling checks JWT expiry in KeycloakProvider.tsx
  • Warning toast shown 2 minutes before session expires
  • Auto logout and redirect to /login on token expiry
  • 401 Axios interceptor clears token and redirects to /login
  • Shared ToastProvider context for app-wide notifications

G2P Config Mock (MSW)

  • MSW handlers for /g2pPaymentConfig, /governmentEntity,
    /program, /dfsp endpoints
  • G2P Config module wired to http://localhost:8084 via
    dedicated Axios client
  • Create form dropdowns dynamically load from API

Dual Development Modes

  • npm run dev → real Gazelle APIs (VITE_ENABLE_MSW=false)
  • npm run dev:g2p → G2P mock testing (VITE_ENABLE_MSW=true)
  • .env.development and .env.g2p separate env files
  • Both excluded from git via .gitignore

Documentation

  • docs/EXTENSIBILITY.md — step-by-step guide for adding new modules
  • docs/MAINTAINABILITY.md — code conventions, PR process,
    testing approach, API integration checklist

Filter Chips Fix

  • Main Batches filter chips now correctly filter real API
    uppercase status strings (COMPLETED, IN_PROGRESS, FAILED)

@Flashl3opard
Flashl3opard requested review from a team and a lite review from Copilot August 10, 2026 12:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds cross-cutting session/UX infrastructure (token-expiry handling + app-wide toasts), introduces an MSW-backed G2P Config mock mode (including a dedicated G2P API client), and documents the project’s extensibility/maintainability conventions and dev-mode workflows.

Changes:

  • Added JWT expiry polling + warning toast + 401 interceptor redirect, and centralized toast notifications via a shared ToastProvider.
  • Added MSW worker + handlers and new Vite modes/scripts to support a dedicated G2P mock development workflow.
  • Wired G2P Config UI to fetch dropdown/table data from the G2P service client (with mock fallback in the table) and added documentation/README updates.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/modules/rbac/UserManagementTab.tsx Migrates RBAC UI to shared toast context instead of local toast stack.
src/modules/g2p-config/types.ts Extends G2P types with IDs and lookup entity types used by API-driven dropdowns.
src/modules/g2p-config/G2PPaymentTab.tsx Fetches configs via React Query with skeleton loading and error→mock fallback.
src/modules/g2p-config/CreateG2PTab.tsx Replaces hardcoded dropdown options with API-driven lists via React Query.
src/mocks/handlers/g2p.handlers.ts Adds MSW handlers for G2P Config endpoints.
src/mocks/browser.ts Registers the MSW worker with G2P handlers.
src/main.tsx Adds dev-only MSW bootstrapping and wraps the app in ToastProvider.
src/lib/keycloak/KeycloakProvider.tsx Adds token-expiry polling + warning toast and auto-redirect behavior.
src/lib/api/g2pConfig.ts Introduces a dedicated Axios client for the G2P service + fetch helpers.
src/lib/api/client.ts Adds a 401 response interceptor that clears auth and redirects to /login.
src/components/shared/ToastProvider.tsx Introduces a shared toast context + UI renderer.
README.md Documents dual dev modes, env file usage, and G2P/MSW configuration.
public/mockServiceWorker.js Adds the MSW service worker asset under public/.
package.json Adds msw, plus dev:g2p/build:g2p scripts and MSW config.
package-lock.json Locks new MSW-related dependencies.
docs/MAINTAINABILITY.md Adds maintainability guide (conventions, process, testing realities).
docs/EXTENSIBILITY.md Adds extensibility guide and established API integration patterns.
.gitignore Ignores .env.development and .env.g2p.
.env.example Updates env template with G2P/MSW variables and defaults for local dev.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/lib/keycloak/KeycloakProvider.tsx
Comment thread src/main.tsx
Comment thread src/components/shared/ToastProvider.tsx
Comment thread src/modules/g2p-config/CreateG2PTab.tsx

@DavidH-1 DavidH-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DavidH-1
DavidH-1 merged commit 4afa33b into openMF:dev Aug 13, 2026
1 check 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

Development

Successfully merging this pull request may close these issues.

3 participants