Skip to content

Add created and updated times to mcp proxy response#1383

Merged
RakhithaRR merged 1 commit intowso2:mainfrom
RakhithaRR:mcp-times
Mar 17, 2026
Merged

Add created and updated times to mcp proxy response#1383
RakhithaRR merged 1 commit intowso2:mainfrom
RakhithaRR:mcp-times

Conversation

@RakhithaRR
Copy link
Copy Markdown
Contributor

@RakhithaRR RakhithaRR commented Mar 17, 2026

Purpose

$subject

Summary by CodeRabbit

Release Notes

  • New Features

    • Added application management capabilities, including creating, updating, and listing applications within projects.
    • Introduced API key mapping functionality to associate API keys with applications.
    • MCP Proxy now exposes creation and update timestamp fields in the API.
  • Improvements

    • Ensured timestamp consistency across the platform by standardizing to UTC.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

Walkthrough

This PR introduces new Application entity types and API endpoints, implements API key mapping for applications, standardizes UTC timestamp handling across repositories, extends MCPProxy with CreatedAt/UpdatedAt fields, and updates the OpenAPI schema to expose these timestamp fields.

Changes

Cohort / File(s) Summary
Application Entity Types & APIs
platform-api/src/api/generated.go
Adds Application struct with metadata fields, ApplicationListResponse, ApplicationType constant, request/response types (CreateApplicationRequest, UpdateApplicationRequest, ListApplicationsParams), and API key mapping types (APIKeyMappingSelector, APIKeyMappingAssociatedEntity, AddApplicationAPIKeysRequest). Introduces MappedAPIKey and MappedAPIKeyListResponse for representing mapped API keys. Adds type aliases for AppId, EntityIDQ, MappedKeyId, and Forbidden.
UTC Timestamp Standardization
platform-api/src/internal/repository/artifact.go, platform-api/src/internal/repository/mcp.go
Changes timestamp generation from local time (time.Now()) to UTC (time.Now().UTC()) in artifact creation and MCP proxy creation/update operations to ensure consistent UTC timestamp storage.
MCPProxy Service Mapping
platform-api/src/internal/service/mcp.go
Extends mapMCPProxyModelToAPI to populate CreatedAt and UpdatedAt fields on the API MCPProxy object from corresponding model timestamps.
OpenAPI Schema
platform-api/src/resources/openapi.yaml
Adds createdAt and updatedAt read-only fields (date-time format) to the MCPProxy schema definition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hop, hop! Applications sprout anew,
With timestamps in UTC so true,
API keys now map with care,
MCPProxy fields everywhere—
Time to build in perfect measure!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and fails to follow the required template structure, providing only a minimal placeholder (Purpose: $subject) without addressing required sections like Goals, Approach, User stories, Documentation, Tests, Security checks, Samples, Related PRs, or Test environment. Expand the description to include all required template sections: Goals (what problem is solved), Approach (implementation details), User stories, Documentation impact, Unit/Integration tests, Security checks, Samples, Related PRs, and Test environment details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: adding createdAt and updatedAt timestamp fields to the MCP proxy API response, which aligns with all code modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
platform-api/src/internal/service/mcp.go (1)

426-427: Consider using TimePtrIfNotZero to gracefully handle uninitialized timestamps.

The model's CreatedAt and UpdatedAt fields are non-pointer time.Time types (see model/mcp.go:31-32), meaning uninitialized values will be zero (0001-01-01T00:00:00Z). Using utils.TimePtr will wrap these zero values into pointers, causing the API to return "0001-01-01T00:00:00Z" instead of omitting the field.

While the repository layer now sets timestamps for new records, any legacy data without timestamps could produce awkward responses. Using utils.TimePtrIfNotZero would return nil for zero times, allowing omitempty to properly omit the field.

♻️ Suggested refactor
-		CreatedAt:      utils.TimePtr(m.CreatedAt),
-		UpdatedAt:      utils.TimePtr(m.UpdatedAt),
+		CreatedAt:      utils.TimePtrIfNotZero(m.CreatedAt),
+		UpdatedAt:      utils.TimePtrIfNotZero(m.UpdatedAt),

Note: The same pattern is used in mapMCPProxyModelToListItem (lines 448-449) and could be updated for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platform-api/src/internal/service/mcp.go` around lines 426 - 427, The mapping
uses utils.TimePtr to wrap non-pointer time.Time fields (CreatedAt, UpdatedAt)
which will produce pointers to zero timestamps; change these to
utils.TimePtrIfNotZero so zero values become nil and are omitted by omitempty.
Update both the mapping that sets CreatedAt/UpdatedAt (and the similar code in
mapMCPProxyModelToListItem) to call utils.TimePtrIfNotZero instead of
utils.TimePtr to avoid returning "0001-01-01T00:00:00Z" for uninitialized times.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@platform-api/src/internal/service/mcp.go`:
- Around line 426-427: The mapping uses utils.TimePtr to wrap non-pointer
time.Time fields (CreatedAt, UpdatedAt) which will produce pointers to zero
timestamps; change these to utils.TimePtrIfNotZero so zero values become nil and
are omitted by omitempty. Update both the mapping that sets CreatedAt/UpdatedAt
(and the similar code in mapMCPProxyModelToListItem) to call
utils.TimePtrIfNotZero instead of utils.TimePtr to avoid returning
"0001-01-01T00:00:00Z" for uninitialized times.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4b5da62-6874-4704-9eb4-c175218577b2

📥 Commits

Reviewing files that changed from the base of the PR and between 9eaaa3e and aee71fb.

📒 Files selected for processing (5)
  • platform-api/src/api/generated.go
  • platform-api/src/internal/repository/artifact.go
  • platform-api/src/internal/repository/mcp.go
  • platform-api/src/internal/service/mcp.go
  • platform-api/src/resources/openapi.yaml

@RakhithaRR RakhithaRR merged commit 1378fa5 into wso2:main Mar 17, 2026
3 checks passed
@RakhithaRR RakhithaRR deleted the mcp-times branch March 31, 2026 12:51
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.

2 participants