Skip to content

WIP: Hue lan integration tests - #3177

Open
varzac wants to merge 3 commits into
mainfrom
hue-lan-integration-tests
Open

WIP: Hue lan integration tests#3177
varzac wants to merge 3 commits into
mainfrom
hue-lan-integration-tests

Conversation

@varzac

@varzac varzac commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Check all that apply

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Summary of Completed Tests

@varzac
varzac requested a review from NoahCornell August 13, 2026 17:08
@github-actions

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

philips-hue_coverage.xml

File Coverage
All files NaN%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against c3893ff

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Test Results

   73 files    552 suites   0s ⏱️
3 269 tests 3 258 ✅ 0 💤 0 ❌ 11 🔥
5 258 runs  5 247 ✅ 0 💤 0 ❌ 11 🔥

For more details on these errors, see this check.

Results for commit c3893ff.

♻️ This comment has been updated with latest results.

)
return
end
cosock.socket.sleep(backoff())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure I agree with this change. I'll have to investigate further

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The max attempts could potentially be problematic because we only queue scans on connect or device adds so we might end up with no group information. I think the backoff is fine and might actually prevent a hot loop if the api calls don't end up yielding for some reason.

)
)
else
cosock.socket.sleep(backoff())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same feeling here, the backoff is probably good but not getting the connectivity of the devices could leave some offline until the we reconnect sse or until the device connectivity changes and results in new sse event. This happens in a spawned cosock task so probably no harm in continuing to keep trying.

-- without needing to mock rooms/zones REST responses or race the scan's own 45-second debounce
-- timing against whatever else a test is asserting on the same connection. Defaults to true;
-- production code never touches this.
grouped_utils.scanning_enabled = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think its fine but I think ideally the mock bridge server would be able to be configured to default respond to these requests with an empty valid response.

dkjson.decode returns (value, next_position, error_message), but
process_rest_response propagated all of pcall's captured return values
after decoding, not just the decoded value its own doc comment
promises. That means the parse position (e.g. 74 for a 73-byte body)
gets returned in the position every caller treats as `err`, so every
successful REST call with a JSON body logs a spurious
"Error performing <action>: <parse position>". Found via the first
integration test to exercise a real, successful JSON-decoded REST
response through this path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

philips-hue: fix onmessage misreading json.decode's position as an error

table.pack(pcall(json.decode, msg.data)) followed by table.remove(...,1) to
strip the pcall success flag left `events, err = table.unpack(...)`
capturing dkjson's second return value (the position it stopped scanning
at, a non-nil number even on success) into `err` instead of its real third
return value. Every SSE message was therefore logged as a JSON parse
error and dropped without ever reaching the update/add/delete handling
below -- there was no prior test coverage of this path to catch it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@varzac
varzac force-pushed the hue-lan-integration-tests branch from 1cf2f31 to 38ce6b0 Compare August 20, 2026 17:21
varzac and others added 2 commits August 21, 2026 10:09
@varzac
varzac force-pushed the hue-lan-integration-tests branch from 38ce6b0 to c3893ff Compare August 21, 2026 15:09
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