DO NOT MERGE: Hue instrumented capture - #3212
Open
varzac wants to merge 4 commits into
Open
Conversation
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>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add capture_logger.lua: Structured JSON logging for all network & IPC - Add capture_device_wrapper.lua: Automatic device event capture - Instrument REST client (lunchbox/rest.lua) with request/response logging - Instrument SSE client (eventsource.lua) with event/connection logging - Instrument command handlers with IPC logging - Instrument lifecycle handlers with event logging - Add CAPTURE_TEST_PLAN.md: 16 comprehensive test scenarios - Add INSTRUMENTATION_README.md: Documentation and usage guide This instrumented driver captures: - All REST API requests/responses with timing - All SSE events and connection lifecycle - All commands from hub - All capability events to hub - All device lifecycle events (added, init, removed) - All state changes (fields, datastore) - Correlation IDs for request->response tracking Purpose: Capture real-world behavior for refactoring baseline
|
Invitation URL: |
|
philips-hue_coverage.xml
Minimum allowed coverage is Generated by 🐒 cobertura-action against e28e54b |
Test Results 73 files ± 0 552 suites +11 0s ⏱️ ±0s For more details on these errors, see this check. Results for commit e28e54b. ± Comparison against base commit f46b647. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.