Skip to content

Simplify HQ websocket functions#469

Merged
NGTmeaty merged 1 commit intointernetarchive:mainfrom
vbanos:hq-websocket
Sep 8, 2025
Merged

Simplify HQ websocket functions#469
NGTmeaty merged 1 commit intointernetarchive:mainfrom
vbanos:hq-websocket

Conversation

@vbanos
Copy link
Copy Markdown
Collaborator

@vbanos vbanos commented Sep 8, 2025

Also add unit tests for handleConfirmedMsg.

Also add unit tests for `handleConfirmedMsg`.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.45%. Comparing base (24c2d0a) to head (352a239).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
internal/pkg/source/hq/websocket.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   55.33%   56.45%   +1.12%     
==========================================
  Files         128      130       +2     
  Lines        7939     8052     +113     
==========================================
+ Hits         4393     4546     +153     
+ Misses       3183     3145      -38     
+ Partials      363      361       -2     
Flag Coverage Δ
e2etests 40.66% <0.00%> (+1.04%) ⬆️
unittests 29.47% <50.00%> (+1.10%) ⬆️

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

☔ 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.

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

This PR simplifies the HQ websocket functions by reducing struct declaration overhead and adds unit test coverage for the handleConfirmedMsg function. The changes focus on making the code more concise while ensuring proper test coverage.

Key changes:

  • Inline struct declarations to replace named struct types in websocket message handlers
  • Add comprehensive unit tests for handleConfirmedMsg function with valid JSON, invalid JSON, and extra fields scenarios

Reviewed Changes

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

File Description
internal/pkg/source/hq/websocket.go Simplifies message handling by using inline struct declarations instead of named types
internal/pkg/source/hq/websocket_test.go Adds new unit tests for handleConfirmedMsg function with multiple test scenarios
Comments suppressed due to low confidence (1)

internal/pkg/source/hq/websocket.go:1

  • The logger variable is not defined in the listenMessages function scope. This will cause a compilation error since logger is only defined in the websocket function.
package hq

Copy link
Copy Markdown
Collaborator

@CorentinB CorentinB left a comment

Choose a reason for hiding this comment

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

LGTM!

@NGTmeaty NGTmeaty merged commit e49a279 into internetarchive:main Sep 8, 2025
2 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.

5 participants