Skip to content

feat: add Wake-on-LAN functionality with validation and tests - #27

Closed
vincentBesseau wants to merge 2 commits into
GladysAssistant:mainfrom
vincentBesseau:main
Closed

feat: add Wake-on-LAN functionality with validation and tests#27
vincentBesseau wants to merge 2 commits into
GladysAssistant:mainfrom
vincentBesseau:main

Conversation

@vincentBesseau

@vincentBesseau vincentBesseau commented Aug 11, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added Wake-on-LAN support for sending network wake requests.
    • Supports configurable MAC address, destination address, destination port, and source port.
    • Added TypeScript declarations for Wake-on-LAN options and successful responses.
    • Requires the appropriate network wake permission.
  • Bug Fixes

    • Added validation for MAC addresses, network addresses, and port ranges.
    • Invalid requests are prevented from being sent, with authorization errors reported clearly.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@vincentBesseau, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d73495e0-fbb7-4ab9-8768-a09780cf3dc0

📥 Commits

Reviewing files that changed from the base of the PR and between 295aa03 and 9843c21.

📒 Files selected for processing (2)
  • lib/gladys-integration.js
  • test/wake-on-lan.test.js
📝 Walkthrough

Walkthrough

The SDK adds typed Wake-on-LAN options and a GladysIntegration.wakeOnLan method. The method validates MAC addresses and ports, forwards valid requests to /network/wake, enforces authorization, and includes comprehensive tests.

Changes

Wake-on-LAN API

Layer / File(s) Summary
Public Wake-on-LAN contract
index.d.ts
Adds WakeOnLanOptions and the GladysIntegration.wakeOnLan declaration with a Promise<SuccessResponse> result.
Validated request forwarding
lib/gladys-integration.js
Validates Wake-on-LAN options and forwards valid requests to /network/wake.
Request and error validation
test/helpers/fake-gladys-server.js, test/wake-on-lan.test.js
Tests successful payloads, authorization, invalid input suppression, port boundaries, and forbidden responses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Integration as GladysIntegration
  participant Core as Gladys core
  participant Endpoint as /network/wake
  Integration->>Integration: Validate WakeOnLanOptions
  Integration->>Core: POST /network/wake
  Core->>Endpoint: Forward validated options
  Endpoint-->>Core: Success response
  Core-->>Integration: Promise<SuccessResponse>
Loading

Suggested reviewers: pierre-gilles

Poem

A rabbit packs a magic byte,
With ports aligned and fields just right.
The sleeping host begins to wake,
While tests guard every path we take.
Hop, hop—success returns in flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Wake-on-LAN functionality with validation and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

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 `@lib/gladys-integration.js`:
- Around line 1021-1026: Update the wakeOnLan validation around the existing
options.mac and options.address checks to reject syntactically invalid MAC
addresses and non-IPv4 address values, not just empty strings, before sending
the /network/wake request. Preserve acceptance of valid documented values, and
add tests confirming malformed non-empty MAC and address inputs make no request.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4cca7cb0-7b09-416e-a12a-77a106c8721b

📥 Commits

Reviewing files that changed from the base of the PR and between fd4295f and 295aa03.

📒 Files selected for processing (4)
  • index.d.ts
  • lib/gladys-integration.js
  • test/helpers/fake-gladys-server.js
  • test/wake-on-lan.test.js

Comment thread lib/gladys-integration.js
@Pierre-Gilles

Copy link
Copy Markdown
Contributor

Implemented in : #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