Skip to content

Fix/session refresh and powergrid simu proxy - #25

Merged
abdratsd merged 2 commits into
mainfrom
fix/session-refresh-and-powergrid-simu-proxy
Aug 27, 2026
Merged

Fix/session refresh and powergrid simu proxy#25
abdratsd merged 2 commits into
mainfrom
fix/session-refresh-and-powergrid-simu-proxy

Conversation

@abdratsd

Copy link
Copy Markdown
Collaborator

No description provided.

Two demo-stability fixes that were developed together.

Session handling
----------------
The eval-demo hack that disabled auto-logout entirely is removed. In its
place the access token is now actually renewed:

- new utils/session.ts: decodes the JWT `exp` claim, and funnels every
  "session is over" path through a single handleSessionExpired() guarded
  so a burst of 401s yields one modal and one redirect, not one popup
  per failed request.
- auth store gains refresh()/scheduleRefresh(), a shared in-flight
  refresh promise, and isTokenExpired/canRefresh. A timer renews the
  token a minute before it dies.
- http interceptor retries a 401 once after refreshing, and only ends
  the session when the refresh token is gone too.
- the router guard renews on navigation, so a reloaded tab restoring a
  persisted token does not die at the next poll.
- the card subscription bypasses axios, so it does the same dance itself.
- services store now owns the context-polling interval id, fixing a leak
  where an interval restarted from the retry modal was never cancellable.

PowerGrid "apply action" proxy
------------------------------
The apply POST goes to a same-origin /powergrid-simu/ nginx location to
avoid CORS; several environments were missing their half of that wiring:

- CI never passed the VITE_POWERGRID_SIMU build-arg, so published images
  baked an empty base, posted to / and got nginx 405.
- the k8s configmap had no /powergrid-simu/ location at all.
- the compose and image nginx configs sent an explicit Host header, which
  routes to the wrong vhost behind the passerelle; dropping it lets nginx
  default to $proxy_host, correct for ip:port and vhost upstreams alike.
- .env.example documents the per-environment upstream and no longer
  ships a real RL_AGENT_API_TOKEN value.
@abdratsd
abdratsd merged commit a68c073 into main Aug 27, 2026
3 of 4 checks 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.

1 participant