Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 14, 2025

  • Analyze review comments from @tipsy
  • Remove unnecessary getter method from WsConfig.java (lines 77-82) - made field public instead
  • Fix comment in WsConfig.java to say "after" instead of "before"
  • Update 404 case to use empty string for matchedPath instead of requestUri (use default args)
  • Use default arguments in JavalinWsServletContext constructor to simplify usage
  • Extract timing calculation to a reusable function (calculateExecutionTimeMs)
  • Test the changes with build and tests - all WebSocket tests passing
  • Reply to review comments

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] WebSocket RequestLogger onUpgrade Add onUpgrade method to WebSocket RequestLogger Sep 14, 2025
Copilot AI requested a review from tipsy September 14, 2025 16:51
@tipsy tipsy marked this pull request as ready for review September 14, 2025 16:55
Comment on lines 77 to 82
/**
* Get the WebSocket upgrade logger, if configured
*/
public WsUpgradeLogger getWsUpgradeLogger() {
return wsUpgradeLogger;
}
Copy link
Member

Choose a reason for hiding this comment

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

Don't think we need this.

/**
* Add a WsUpgradeLogger to the WsHandler.
* The handler is called when an HTTP request attempts to upgrade to WebSocket.
* This is invoked before the upgrade process begins, whether the upgrade succeeds or fails.
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it after? 🤔

@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.39%. Comparing base (e359798) to head (55b0504).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2450      +/-   ##
============================================
+ Coverage     86.26%   86.39%   +0.13%     
- Complexity     1318     1435     +117     
============================================
  Files           148      148              
  Lines          4506     4587      +81     
  Branches        514      490      -24     
============================================
+ Hits           3887     3963      +76     
- Misses          400      407       +7     
+ Partials        219      217       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

cfg = servletContextConfig,
req = req,
res = res,
matchedPath = requestUri,
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be null, since it didn't match a path.

req = req,
res = res,
matchedPath = requestUri,
pathParamMap = emptyMap(),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe these empty maps could be default args, so the whole statement could be val upgradeContext = JavalinWsServletContext(servletContextConfig, req, res)

pathParamMap = emptyMap(),
routeRoles = emptySet(),
)
val executionTimeMs = (System.nanoTime() - requestStartTime) / 1_000_000.0f
Copy link
Member

Choose a reason for hiding this comment

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

Could we pull this out to a function? We are using it somewhere else too.

@tipsy
Copy link
Member

tipsy commented Sep 15, 2025

@copilot please update your PR based on the review comments.

Copy link
Contributor Author

Copilot AI commented Sep 15, 2025

@copilot please update your PR based on the review comments.

I've addressed all the review feedback:

  1. Removed getter method - Made wsUpgradeLogger field public instead for cross-package access
  2. Fixed timing comment - Changed "before" to "after" the upgrade process
  3. Fixed 404 matchedPath - Now uses empty string (default arg) instead of requestUri
  4. Simplified constructor calls - Added default arguments to JavalinWsServletContext
  5. Extracted timing calculation - Created reusable calculateExecutionTimeMs() function

All changes tested and WebSocket tests passing. Commit: 55b0504

@tipsy tipsy merged commit e338af9 into master Sep 21, 2025
29 checks passed
@tipsy tipsy deleted the copilot/fix-2220 branch September 21, 2025 11:28
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