Skip to content

Fix follow-up MCP token review feedback#1044

Merged
BenjaminMichaelis merged 3 commits intomainfrom
copilot/fix-feedback-from-pr-1043
Apr 30, 2026
Merged

Fix follow-up MCP token review feedback#1044
BenjaminMichaelis merged 3 commits intomainfrom
copilot/fix-feedback-from-pr-1043

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

  • Review PR Fix follow-up MCP token review feedback #1044 feedback and confirm whether the new comment is valid
  • Run baseline build and tests to capture current state
  • Align MCP token creation with the same captured UTC reference time used for expiry validation
  • Update MCP token tests to cover the explicit creation reference time path
  • Run targeted build/tests for the MCP token changes
  • Run final review/security validation

Copilot AI and others added 2 commits April 30, 2026 07:19
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/1309ce59-f673-4f1a-b124-e849af2f4737

Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/1309ce59-f673-4f1a-b124-e849af2f4737

Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Follow-up fixes to MCP token expiry validation and messaging to address prior review feedback, focusing on consistent UTC reference times, shared constants, and deterministic tests around date rollovers.

Changes:

  • Capture a single nowUtc/todayUtc when validating expiry bounds in the MCP token API and account-management page.
  • Derive the max-expiry validation message and UI help text from the shared lifetime constant.
  • Make the max-expiry test deterministic across UTC date rollovers.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
EssentialCSharp.Web/Services/McpApiTokenService.cs Derives max-expiry validation message from the shared lifetime constant.
EssentialCSharp.Web/Controllers/McpTokenController.cs Uses a single captured UTC reference time for ExpiresOn min/max validation.
EssentialCSharp.Web/Areas/Identity/Pages/Account/Manage/McpAccess.cshtml.cs Uses a single captured UTC reference time for page-model expiry validation and bounds.
EssentialCSharp.Web/Areas/Identity/Pages/Account/Manage/McpAccess.cshtml Updates help text to match end-of-day UTC expiry semantics and avoids hard-coded “6 months”.
EssentialCSharp.Web.Tests/McpApiTokenServiceTests.cs Stabilizes max-expiry test across UTC date rollovers and asserts on the shared validation message.

Comment on lines +48 to 52
DateTime nowUtc = DateTime.UtcNow;
DateOnly todayUtc = DateOnly.FromDateTime(nowUtc);
InitializeExpiryBounds(nowUtc);
ApplyDefaultExpiryIfMissing();
string? userId = userManager.GetUserId(User);
Comment on lines +29 to 33
DateTime nowUtc = DateTime.UtcNow;
DateOnly todayUtc = DateOnly.FromDateTime(nowUtc);
DateTime? expiresAt = null;
DateOnly maxExpiresOn = McpApiTokenService.GetDefaultExpiryDate();
DateOnly maxExpiresOn = McpApiTokenService.GetDefaultExpiryDate(nowUtc);
if (request?.ExpiresOn is DateOnly expiresOn)
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/bc3c4ad5-6f8e-47fe-a4e4-dd78459a3763

Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
@BenjaminMichaelis BenjaminMichaelis merged commit 66900fd into main Apr 30, 2026
7 checks passed
@BenjaminMichaelis BenjaminMichaelis deleted the copilot/fix-feedback-from-pr-1043 branch April 30, 2026 16:24
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