Skip to content

chore(drivers): move the bundled pin to device-drivers main - #704

Merged
frahlg merged 1 commit into
masterfrom
move-bundled-driver-pin-to-device-drivers-main
Jul 29, 2026
Merged

chore(drivers): move the bundled pin to device-drivers main#704
frahlg merged 1 commit into
masterfrom
move-bundled-driver-pin-to-device-drivers-main

Conversation

@frahlg

@frahlg frahlg commented Jul 28, 2026

Copy link
Copy Markdown
Member

Brings the whole absent-register campaign into the recovery snapshot. Every bundled driver now gives up on a register the device does not answer instead of paying a failed read for it on every poll — 497 addresses across 49 drivers — plus the control-path fixes that landed alongside.

Pin moves 1f67078edb32ff. Generated by scripts/sync-bundled-drivers.sh; nothing edited by hand.

Verified

Check Result
check-driver-versions.sh (the gate from #709) verified across 37 bundled drivers
sync-bundled-drivers.sh --check snapshot matches the pin
go test ./... passes, uncached
full-stack e2e green, 25.6s

What unblocked it

This PR was held because TestSungrowZeroBatteryCommandForcesIdle failed: the driver refused a battery command issued before the first poll, and the test expects a zero-power command to write idle.

Settled in device-drivers#42 — zero always goes through. It is not a dispatch but the host handing the device back to itself, it arrives from the lifecycle rather than the planner so it lands before anything is confirmed, and refusing to write stop is a different risk from refusing to write charge. Non-zero setpoints still require evidence, so the hole closed in device-drivers#40 stays shut.

That work also found the Lua mock raising where this host returns nil plus a message — which is what made a fixture bug look like a driver bug.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9b721fe83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread drivers/pixii.lua Outdated
Comment on lines +115 to +116
if sf_present[addr] == nil then
sf_present[addr] = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not permanently cache transient scale-factor failures

When the gateway polls while the Pixii is offline—or any scale-factor request has a transient transport failure—this marks the register absent for the lifetime of the Lua driver. After connectivity recovers, read_sf skips that register and permanently substitutes exponent 0, so battery and site-meter values can be wrong by powers of ten while Core accepts them as fresh telemetry. Distinguish the known illegal-address response from transient errors, or retry before caching absence, in device-drivers before resyncing this snapshot.

AGENTS.md reference: AGENTS.md:L12-L15

Useful? React with 👍 / 👎.

Comment on lines +284 to +285
elseif mppt_present == nil then
mppt_present = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retry the MPPT block after an initial transient failure

If Model 103 succeeds but the first MPPT request times out or otherwise fails transiently, this permanently classifies the block as absent. Every later poll then emits zero MPPT voltage/current without retrying, even after communication recovers, until the driver is restarted. Only cache a definitive illegal-address response—or require repeated failures—in device-drivers before resyncing the snapshot.

AGENTS.md reference: AGENTS.md:L12-L15

Useful? React with 👍 / 👎.

@frahlg

frahlg commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Note for whoever reviews: core (Go) failed on the first run and passed on rerun. It was not this change.

cmd/sim-ferroamp hung and hit the 600 s Go test timeout. On rerun the same job finished in 1m19s, and locally on this branch the package runs in 3.9 s. This PR touches drivers/pixii.lua, drivers/solaredge_legacy.lua, drivers/sungrow.lua and the pin — nothing sim-ferroamp loads.

Worth a look on its own: a suite that hangs for ten minutes and then passes is going to fail somebody's unrelated PR again.

frahlg added a commit that referenced this pull request Jul 28, 2026
The gate diffs changed .lua files between two Git revisions of this
repository. That works only while the drivers are committed here, and
it was never quite the right question: what reaches a gateway is decided
by where drivers/BUNDLED_SOURCE.json points, not by what this history
shows.

check-versions gains -old-dir/-new-dir, comparing two materialised
snapshots instead of two revisions. ValidateDriverVersionChange is
untouched -- it always took bytes rather than revisions, so the rule
being enforced is identical.

scripts/check-driver-versions.sh reads the pin at a base revision and
the pin now, and stays quiet when they match: a pull request that does
not move the pin cannot have moved any driver's bytes. When it has
moved, both snapshots are fetched and every bundled driver compared.

The Git-based mode stays for now. It still works while the files are
committed, and removing it belongs with the deletion.

Tested where it counts -- the failure case. Six table-driven cases in
main_test.go: changed bytes under an unchanged version fail and name
the driver, a bump passes, untouched files pass, a newly bundled driver
has nothing to compare, a dropped one is a coverage decision rather than
a version one, and every offender is reported rather than just the
first.

Also run against the real pin move in #704 (1f67078 -> 3f62a00), where
pixii, solaredge_legacy and sungrow all changed with bumps: verified
across 37 bundled drivers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
frahlg added a commit that referenced this pull request Jul 28, 2026
The gate diffs changed .lua files between two Git revisions of this
repository. That works only while the drivers are committed here, and
it was never quite the right question: what reaches a gateway is decided
by where drivers/BUNDLED_SOURCE.json points, not by what this history
shows.

check-versions gains -old-dir/-new-dir, comparing two materialised
snapshots instead of two revisions. ValidateDriverVersionChange is
untouched -- it always took bytes rather than revisions, so the rule
being enforced is identical.

scripts/check-driver-versions.sh reads the pin at a base revision and
the pin now, and stays quiet when they match: a pull request that does
not move the pin cannot have moved any driver's bytes. When it has
moved, both snapshots are fetched and every bundled driver compared.

The Git-based mode stays for now. It still works while the files are
committed, and removing it belongs with the deletion.

Tested where it counts -- the failure case. Six table-driven cases in
main_test.go: changed bytes under an unchanged version fail and name
the driver, a bump passes, untouched files pass, a newly bundled driver
has nothing to compare, a dropped one is a coverage decision rather than
a version one, and every offender is reported rather than just the
first.

Also run against the real pin move in #704 (1f67078 -> 3f62a00), where
pixii, solaredge_legacy and sungrow all changed with bumps: verified
across 37 bundled drivers.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@frahlg
frahlg force-pushed the move-bundled-driver-pin-to-device-drivers-main branch from e9b721f to 29e821f Compare July 28, 2026 19:19
@frahlg frahlg changed the title chore(drivers): move the bundled pin to device-drivers main chore(drivers): move the bundled pin to device-drivers main [HELD] Jul 28, 2026
@frahlg frahlg changed the title chore(drivers): move the bundled pin to device-drivers main [HELD] chore(drivers): move the bundled pin to device-drivers main Jul 29, 2026
Brings the whole absent-register campaign into the recovery snapshot:
every bundled driver now gives up on a register the device does not
answer instead of paying a failed read for it on every poll. 497
addresses across 49 drivers, plus the control-path fixes that landed
alongside.

Pin moves 1f67078 -> edb32ff. Generated by
scripts/sync-bundled-drivers.sh; nothing edited by hand.

The SemVer gate added in #709 verified the move across all 37 bundled
drivers. go test ./... passes, including the Sungrow zero-power case
that held this back, and the full-stack e2e is green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@frahlg
frahlg force-pushed the move-bundled-driver-pin-to-device-drivers-main branch from c630e1e to d951951 Compare July 29, 2026 05:39
@frahlg
frahlg merged commit aeb61fd into master Jul 29, 2026
13 checks passed
@frahlg
frahlg deleted the move-bundled-driver-pin-to-device-drivers-main branch July 29, 2026 05:42
@frahlg

frahlg commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

Heads up on the pin: it still points at 12f40d1, which now predates two Sungrow changes on device-drivers main and one still in review.

The Go test change on this branch is compatible with all three — verified by dropping each driver version into drivers/sungrow.lua and running the full suite. Under #42's driver TestSungrowRefusesABatteryCommandUntilItHasEvidenceOfABattery fails, which is the intended signal; under 12f40d1, #44's 19db131 and #43's head it passes.

Suggest holding the pin move until #43 lands, then re-running scripts/sync-bundled-drivers.sh against that commit so the snapshot carries the settled behaviour rather than the version in between.

@frahlg

frahlg commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

Correction to the comment above: I said the test passes under #44's driver. It does not — I had not run that combination when I wrote it.

Measured, dropping each version into drivers/sungrow.lua and running go test ./internal/drivers/ -run TestSungrow:

device-drivers sungrow TestSungrowRefusesABatteryCommandUntilItHasEvidenceOfABattery
12f40d1 (this pin) 1.5.3 pass
edb32ff (#42) 1.5.4 fail
19db131 (#44, main) 1.5.5 fail
srcfl/device-drivers#43 head 1.5.6 pass

#44 kept #42's exemption, so 1.5.5 fails for the same reason 1.5.4 does. TestSungrowZeroBatteryCommandForcesIdle passes on all four.

The rest stands: hold the pin move until #43 lands, then re-run scripts/sync-bundled-drivers.sh against that commit.

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.

1 participant