Repository navigation
M8 Local Powerwall, part B: merge classes, gateway healing, read-only check - #40
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves export and doc conflicts between the sibling milestones, and updates the log test to trigger_homelink's Python argument order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eRouter (ENG-73 / PW-10) Replaces the stand-in for document 02's Routed types with the real router in a test/*.types.ts file, so tsconfig.test.json checks it in CI. One case per local method, through a mapped type: dropping a case fails the compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document 02 section 4. Neither owns a timer: the caller calls poll() on its own schedule. test_energysite_merge_contract.py's cases are the pure helpers, already ported to test/energysite-router.test.ts. SiteInfoMerge also exposes last_error, as the issue asks and document 02's sketch omits. A discarded read still updates healthy, because that says whether the gateway answered, not whether the snapshot was used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… / PW-13) Document 07 sections 14 and 15. Failover tests put a real PowerwallEnergySite on the fake gateway behind EnergySiteRouter, one row per error in document 02 section 3. The router needed no per-method list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/powerwall-readonly-check.ts covers R1 to R12 of document 09 section 4.1, and prints only key names, types and pass or fail. R13 is a Python comparison, and R14 needs cloud credentials the script does not take. Its tests prove it cannot write on the source, at run time and on the wire, from allowlists, so a new client method counts as a write. tsx joins the dev dependencies to run it: the script imports src/, whose .js specifiers Node's own type stripping cannot resolve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 51 minutes. View limit details
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bre77
changed the base branch from
milestone/integration
to
milestone/m8a-powerwall
November 2, 2026 04:28
… / PW-8) A BUSY fault, HTTP 500 or common.error_response while revoking a compromised key returned success with the key still paired. Tolerate only an empty reply, plus code 5 on a cancel. This overrides document 07 section 8 and differs from Python. Changes the tests that pinned the swallowing in client-commands.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…G-67 / PW-9)
Cloud set_island_mode checked only error_response, so REJECTED_LOW_ENERGY came
back as a normal reply while LAN raised. Both now share island_mode_rejection.
The signed path reads the envelope, and Teslemetry's keyless route answers the
decoded leaf, { response: { result } }, per its source and tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-67 / PW-9) Modes 0, 3, 5, 99 and -1 were signed and sent, a missing mode sent 1 and closed the contactor, and "6" sent 6 with force false. EnergyIslandMode names only ON_GRID and OFF_GRID, and they are all Python's go_off_grid and reconnect_grid use, so nothing else passes. The check also sits in EnergyDeviceSigner.envelope, which covers a raw _signed_command. client-island's mode_override 7 test changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… / PW-9) An undecodable reply returned success. Document 07 section 8 says it is a PowerwallProtocolError, which is not failover-safe, so nothing replays. Covers trigger_islanding too, which shares the path; both client-island tests that pinned Python's tolerance change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-61 / PW-7) A second curtail saved the curtailed values, so restore left backup at the curtailed reserve. Save only when not already curtailed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PW-7) Infinity passed the limit checks and JSON.stringify wrote it as null. Limits now require a finite number, and write_config rejects one at any depth, since it takes arbitrary values. Reserve, curtail, backup, delay and dispatch inputs already refused it: the new cases pin that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-13) connect_gateway logged in at any IPv4 the cloud reported, with certificate checks off, even after a rejected login. Now only private and link-local addresses get a request, and a client with a known DIN refuses any other gateway, failing over rather than talking to it. Existing healing tests use allow_address, because the fake gateway can only be on loopback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ENG-81 / PW-14) routable_message is replayable for 30 s, so it joins the log redaction keys. write_config runs one at a time per client, so two writes cannot interleave a read-modify-write. AGENTS.md records the rules that differ from Python on purpose, and that set_island_mode(6) forces on LAN and omits force on cloud. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Second half of M8. Stacked on
milestone/integration../powerwallstays out oftsdown.config.tsandpackage.jsonexports, so nothing here reaches npm consumers, and this PR has no changeset, like the earlier PW issues.Issues
ENG-73 (PW-10): finished.
test/powerwall-router.types.tsputs the realPowerwallEnergySitein the realEnergySiteRouterin front of the realTeslemetryEnergySite, replacing the stand-in.tsconfig.test.jsonchecks it in CI. Removing a case fails the check, as does removing a local method or changing a signature: each was tried and failedtsc.ENG-79 (PW-12): done.
test_energysite_merge_contract.py(pure helpers, already intest/energysite-router.test.ts)owned_keyswithoutisland_statusleaves that key at the cloud valuehealthyis null, then true or falseENG-80 (PW-13): done.
EnergySiteRouterconnect_gatewayoutcomes, and a cloud lookup failure counts asnullmovedpersists nothingverify_local_gatewaytells a wrong password from a rejected keyENG-81 (PW-14): done, with R13 and R14 outside the script.
Proof the script cannot write
test/powerwall/readonly-check.test.tschecks three ways, all from allowlists, so a new client method counts as a write until someone says otherwise:PowerwallClientandPowerwallEnergySiteis replaced by a trap for a full run.config.jsonis byte-identical afterwards.The script's client and site are also
Picktypes of read methods, and CI compilesscripts/*.ts. Adding a real write call to the script (three variants, one obfuscated) failed all three layers.The script has run only against the fake gateway, including once as a real process with real waits.
For review
tsxis a new dev dependency, forpnpm powerwall:check. The script importssrc/, whose.jsspecifiers Node's type stripping cannot resolve.pnpm-workspace.yamlsetsallowBuilds: esbuild: false; the script ran fine that way.SiteInfoMergehaslast_error. ENG-79 asks for it and document 02's sketch omits it.SiteInfoMergeread still updateshealthy. Document 02 doesn't cover this case.healthysays whether the gateway answered, so I kept that separate from whether the snapshot was used.POWERWALL_SOAK_TICKSis an addition: an optional variable to shorten R12, default 120 ticks (10 minutes).site,battery,loadandsolarmeters, notgenerator. Document 07 listsgenerator, butlive_statusalready treats a missing meter asnull, so a site without one should not stop the run.connect_gatewayrejects a bad PEM instead of returning an outcome, because it cannot build a client and no address repairs that.verify_local_gatewayraisesPowerwallKeyRejectedErroronly forPowerwallAuthenticationErroron the signed read, as document 07 says. Other faults pass through unchanged.No hardware was used.
🤖 Generated with Claude Code