Skip to content

fix(session): use ~/ so Refresh Session keeps the /2 PathBase - #302

Open
rlorenzo wants to merge 1 commit into
mainfrom
fix/session-refresh-pathbase
Open

fix(session): use ~/ so Refresh Session keeps the /2 PathBase#302
rlorenzo wants to merge 1 commit into
mainfrom
fix/session-refresh-pathbase

Conversation

@rlorenzo

@rlorenzo rlorenzo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

On TEST and PROD, Refresh Session did nothing: extendSession fetched a bare /RefreshSession, which under the /2 PathBase lands on legacy VIPER 1 and returns HTML. It now uses @Url.Content("~/RefreshSession"), matching login in the same file.

Also in the same dialog:

  • Non-OK responses reject instead of rendering "extended to Invalid Date".
  • A failed extend shows an error banner in the dialog and leaves it open so the user can retry or log in.
  • The poll's try/catch could not catch an async rejection, and a failed poll scheduled no follow-up, so checking stopped for the life of the page. It now reschedules.

Not verifiable locally (no PathBase). Confirm on TEST that the rendered markup contains /2/RefreshSession and the button extends the session.

@codecov-commenter

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@rlorenzo

rlorenzo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@codecov-commenter

codecov-commenter commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 45.04%. Comparing base (151b0ff) to head (f783416).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ws/Shared/Components/SessionTimeout/Default.cshtml 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
- Coverage   45.04%   45.04%   -0.01%     
==========================================
  Files         941      941              
  Lines       49175    49176       +1     
  Branches     6594     6594              
==========================================
  Hits        22152    22152              
- Misses      26079    26080       +1     
  Partials      944      944              
Flag Coverage Δ
backend 42.32% <0.00%> (-0.01%) ⬇️
frontend 63.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ws/Shared/Components/SessionTimeout/Default.cshtml 0.00% <0.00%> (ø)

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d4d66f68-b0d7-40f8-afd2-aa1523b0bdc7

📥 Commits

Reviewing files that changed from the base of the PR and between 151b0ff and bc04fe0.

📒 Files selected for processing (1)
  • web/Views/Shared/Components/SessionTimeout/Default.cshtml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The session timeout view rejects failed responses, reschedules polling after errors, uses ~/RefreshSession, and records renewal failures. The dialog remains visible after failed renewal and shows login and retry guidance.

Changes

Session Timeout Handling

Layer / File(s) Summary
Handle session polling and renewal failures
web/Views/Shared/Components/SessionTimeout/Default.cshtml
Session polling rejects non-OK responses and reschedules after errors. Renewal uses ~/RefreshSession, rejects non-OK responses, records failure state, and keeps the dialog visible with login and retry guidance. Hiding the dialog clears the failure state.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to bc04f

Session renewal now preserves the IIS PathBase and surfaces renewal failures without closing the timeout dialog. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary fix: using the application-relative path so Refresh Session preserves the /2 PathBase.
Description check ✅ Passed The description directly explains the PathBase issue and documents the related session renewal, error handling, and polling changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/session-refresh-pathbase

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Views/Shared/Components/SessionTimeout/Default.cshtml`:
- Around line 79-86: Replace the renewal failure `$q.notify` handling in the
session-timeout dialog with stored failure state, then conditionally render a
`q-banner` for that state using `class="bg-warning text-dark"` and
`role="alert"`, while preserving the existing failure message and retry/login
behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 387615ea-156b-410e-9d38-cac711f62305

📥 Commits

Reviewing files that changed from the base of the PR and between 553849d and cad4fb3.

📒 Files selected for processing (1)
  • web/Views/Shared/Components/SessionTimeout/Default.cshtml

Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml Outdated

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

Fixes the “Refresh Session does nothing on TEST/PROD under /2 PathBase” issue by ensuring the session-extension request targets VIPER 2 (not legacy VIPER 1 at /) and by making the polling / refresh flows handle non-OK and failed responses without silently stalling.

Changes:

  • Update extendSession to call @Url.Content("~/RefreshSession") so the generated URL includes the IIS sub-application PathBase (e.g., /2/RefreshSession).
  • Treat non-OK HTTP responses as failures (reject) rather than flowing a Response object into the “success” handler.
  • Replace the ineffective synchronous try/catch around an async fetch chain with a real .catch that reschedules session polling; add an in-dialog error banner when session extension fails.

@rlorenzo
rlorenzo force-pushed the fix/session-refresh-pathbase branch from e05b9b3 to cd69eaa Compare August 7, 2026 23:47
@rlorenzo
rlorenzo force-pushed the fix/session-refresh-pathbase branch 2 times, most recently from 8df5d47 to 0f34d9d Compare August 10, 2026 03:26
@rlorenzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@rlorenzo
rlorenzo requested a lite review from Copilot August 10, 2026 05:37
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

web/Views/Shared/Components/SessionTimeout/Default.cshtml:75

  • The try/catch around clearTimeout is unnecessary: clearTimeout does not throw for an unknown/invalid timeout id, so this swallows errors without benefit and adds noise. Removing it also aligns with the earlier fix that removed ineffective try/catch usage.
                        try {
                            clearTimeout(this.sessionTimeoutCheckEventId)
                        }
                        catch(e) { void e }

web/Views/Shared/Components/SessionTimeout/Default.cshtml:63

  • Use an explicit seconds-to-milliseconds conversion instead of the magic number 300000 so it’s immediately clear this is a 5-minute retry interval and consistent with the nextCheck * 1000 usage above.
                        this.sessionTimeoutCheckEventId = window.setTimeout(this.checkSessionTimeout, 300000)

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/Views/Shared/Components/SessionTimeout/Default.cshtml`:
- Around line 55-64: Update the catch handler for checkSessionTimeout so a
failed poll retries promptly rather than always waiting 300000 milliseconds; cap
the retry using the last known session-expiry deadline or a short bounded
backoff that preserves near-expiry warning behavior, and add a test covering a
failed poll near expiry.
- Around line 48-55: Update the secondsUntilTimeout condition in the
session-timeout polling logic to use <= 300 so the warning is shown at exactly
five minutes remaining. Add a boundary test covering secondsUntilTimeout === 300
and verify that the warning state and nextCheck behavior are set correctly.
- Around line 44-45: Update the fetch calls in checkSessionTimeout and
extendSession to use a supported timeout via AbortController or
AbortSignal.timeout, aborting requests that exceed the timeout and routing those
failures through the existing catch handlers so polling restarts and renewal
reports sessionExtendFailed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b30e247d-03e3-46c8-ac09-ccbe5dd740eb

📥 Commits

Reviewing files that changed from the base of the PR and between cad4fb3 and 0f34d9d.

📒 Files selected for processing (1)
  • web/Views/Shared/Components/SessionTimeout/Default.cshtml

Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml Outdated
Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml Outdated
Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml
@rlorenzo
rlorenzo force-pushed the fix/session-refresh-pathbase branch from 0f34d9d to ba86fee Compare August 10, 2026 05:56
@rlorenzo
rlorenzo force-pushed the fix/session-refresh-pathbase branch from ba86fee to bc04fe0 Compare September 9, 2026 03:37
@rlorenzo

rlorenzo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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.

🟡 Changes recommended

New usage of AbortSignal.timeout() can throw on browsers that don’t support it, which would break session polling/refresh unless feature-detected or safely guarded.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

web/Views/Shared/Components/SessionTimeout/Default.cshtml:73

  • Same compatibility concern here: calling AbortSignal.timeout() directly can throw on browsers that don’t implement it, which would prevent the user from refreshing the session at all. Feature-detect AbortSignal.timeout and fall back to a regular fetch() when unavailable.
                fetch('@Url.Content("~/RefreshSession")', { signal: AbortSignal.timeout(10000) })
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml
- Reject non-OK responses instead of passing the Response to the
  success handler, which rendered "extended to Invalid Date" while
  the session was never extended
- Report a failed extend in a role="alert" q-banner, and leave the
  dialog up offering both Refresh Session and Log in, so a user whose
  refresh keeps failing still has a way to re-authenticate
- Replace the poll's dead try/catch, which cannot catch an async
  rejection, with a catch that reschedules the next check

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.

🟡 Changes recommended

The updated code still formats midnight/noon as 0:xx in the session expiration time display, which is user-visible and should be corrected before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

web/Views/Shared/Components/SessionTimeout/Default.cshtml:82

  • Same 12-hour formatting issue here: at midnight/noon this will render 0:xx instead of 12:xx. Adjust the hour conversion to hours % 12 || 12.
                        this.sessionExpireTime = (d.getHours() > 12 ? d.getHours() - 12 : d.getHours()) + ":"
                            + ("0" + d.getMinutes()).slice(-2)
                            + (d.getHours() >= 12 ? " PM" : " AM")
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread web/Views/Shared/Components/SessionTimeout/Default.cshtml
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