Repository navigation
E2E test: API call trigger + hardware reliability (ESP32 reset, address fallback) - #39
Merged
Merged
Conversation
1. git_version.py improvements: - Reliably produces e2e-<short-sha>[-dirty] even from detached HEAD - Uses PROJECT_DIR with __file__ fallback (handles SCons exec context) - Checks for git availability before attempting commands - Only falls back to 'unknown' if git truly unavailable - Ensures version <=32 ASCII chars 2. E2E test completes with real API call: - Firmware now FAILs if no API call received (was incorrectly passing) - run-e2e.ts actively triggers API call when device signals WAITING_FOR_API - Calls https://scriptproxy.percolate.one/api/<address>/e2eTest - Proxy forwards opcode 0x04 to device, device responds with 0x08 - Test reaches E2E:DONE PASS after successful API round-trip 3. Documentation updated: - README now documents the complete sequence including API trigger - Added WAITING_FOR_API and API_CALLS_RECEIVED to message table - Notes that test fails without API call (tests full e2e flow) Expected serial sequence: START → FW_VERSION → KEYID → WIFI → LOGIN(0x09) → DIAG(0x0A) → KEEPALIVE×3 → WAITING_FOR_API → API_CALL → DONE PASS Runner command: npx tsx run-e2e.ts <serial-port> Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
…it version 1. ESP32 automatic reset on port open: - Pulses DTR=false, RTS=true for 200ms, then RTS=false - Standard esptool EN-pin reset for ESP32 DevKit boards - Ensures runner captures all serial output from boot - Fixes 'Cannot trigger API call - device address not yet captured' 2. Device address fallback mechanisms: - Added --address flag: npx tsx run-e2e.ts COM15 --address 0x123... - Falls back to telemetry API if address missed from serial - Parses addresses case-insensitively (0x or without prefix) - Prevents test failure when serial buffer starts mid-boot 3. Git version dirty detection fix: - Uses 'git diff --quiet HEAD' instead of 'git status --porcelain' - Ignores untracked files (.pio/, node_modules/, build artifacts) - Fixes false 'dirty' flag after clean build - Now produces clean e2e-<sha> instead of e2e-<sha>-dirty 4. Verified proxy API route: - Confirmed route is /api/:Address/:method (status 201 on success) - Matches SmartLayerProxy implementation in routes.ts - handleApiCall forwards opcode 0x04 to TCP device Usage: npx tsx run-e2e.ts COM15 180000 npx tsx run-e2e.ts COM3 --address 0xABCD... --timeout 180000 Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
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.
Overview
This PR completes the E2E hardware test to verify the full TCP bridge protocol including API call forwarding through the public proxy. Adds critical hardware reliability improvements for real-world testing.
Changes
1. E2E Test Now Requires Real API Call ✅
Problem: Previous test passed without exercising API call forwarding through proxy
Solution:
run-e2e.tsactively triggers API call when device signalsWAITING_FOR_APIGET https://scriptproxy.percolate.one/api/<device_address>/e2eTestE2E:DONE PASSonly after successful round-tripVerified: Route
/api/:Address/:methodreturns HTTP 201 per SmartLayerProxy routes.ts2. ESP32 Automatic Reset on Port Open ✅
Problem: Runner often missed boot serial output, couldn't capture device address → test failed
Solution:
DTR=false, RTS=truefor 200ms, thenRTS=false3. Device Address Fallback Mechanisms ✅
Problem: If runner starts after device boot, device address missed from serial → test fails
Solutions:
--address <0xABCD...>to pre-configure addressTELEMETRY_API_KEYset0xprefix or without, normalizes to lowercaseUsage:
4. Git Version Dirty Detection Fix ✅
Problem: Version built as
e2e-<sha>-dirtyimmediately after cleangit reset --hardRoot Cause: Build creates untracked files (
.pio/,node_modules/),git status --porcelainreported them as changesSolution:
git diff --quiet HEADinstead ofgit status --porcelaine2e-<sha>after buildVerified:
e2e-094bb44(clean) after full rebuildExpected Test Sequence
Build Status
e2e-094bb44(clean, no false dirty flag)Testing
Hardware Requirements
Run Test
Proxy Requirements
Uses public proxy at
https://scriptproxy.percolate.one:/api/<address>/<method>?param=valueDocumentation
--addressflag, and usage examples