Conversation
mlitre
requested review from
SebaLukas,
a-w50,
barsnick and
chausGit
as code owners
September 15, 2026 13:29
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 27 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
mlitre
force-pushed
the
fm/cbexigen-der-wpt-pr
branch
from
September 15, 2026 13:31
88aaf26 to
1e7f3c6
Compare
Adds ISO 15118-20 Amd1 and AC-DER IEC schema support, wires up AC-DER SAE alongside it, and corrects two defects in the array grammar the generator emits for particles declared minOccurs >= 2. A particle with minOccurs >= 2 needs mandatory states offering only a START event, then an optional tail state offering both the loop and whatever may follow it. That tail state's loop transition now targets itself. It previously targeted the next sequential grammar, which is harmless when the repeated particle is last in its type but caps the array at minOccurs + 1 when other particles follow. ISO 15118-20 wireless power has three such particles (TxSpecData, RxSpecData and PulseSequenceOrder, all minOccurs=2 maxOccurs=255), so the generated WPT codec silently truncated those arrays while reporting success. Encoders now also emit the loop breakout at the schema maximum that every decoder already expected. Without it an encoder wrote a wider END event code than the decoder read, so an array at exactly its declared maximum did not round-trip. This was corpus wide rather than specific to AC-DER: a ten point DER curve differed by one bit, as did ISO 15118-20 TaxCosts. The rule deciding when a loop breaks out now lives in one place shared by both coders, since the two must agree on it to the bit. Verified by regenerating every configured schema present, twice per arm to rule out generator nondeterminism. Only encoders change, and only by gaining the breakout: 41 decoder breakouts across four schemas had no encoder counterpart before and match exactly after. Round-trip probes cover n=2..10 for the DER curve in both IEC and SAE, and a synthetic schema carrying both repeated particle shapes. Co-authored-by: Christian Andersen <public@milindur.de> Signed-off-by: Martin Litre <mnlitre@gmail.com>
mlitre
force-pushed
the
fm/cbexigen-der-wpt-pr
branch
from
September 16, 2026 14:56
1e7f3c6 to
074de64
Compare
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.
Describe your changes
Builds on #127 by @milindur, squashed into one commit and co-authored to him. Adds AC-DER SAE, which #127 does not generate, and completes the array grammar for particles declared
minOccurs >= 2:minOccurs + 1and returned success in both directions. ISO 15118-20 wireless power declares three such particles.Issue ticket number and link
No existing ticket. Continues #127.
Verification
Every configured schema whose XSD is present regenerated, twice per arm with
__pycache__cleared between runs. The earlier round covered four ISO 15118-20 schemas only, not DIN 70121 or ISO 15118-2, because those XSDs were not in that checkout. It has since been redone with the full set: appHandshake, ISO 15118-2 and all five ISO 15118-20 variants, including WPT and both AC-DER schemas, which download fromstandards.iso.orgalongside the base edition. DIN 70121 is still out of reach.On the generator's own repeatability: it has been byte reproducible since bdf082f, cold and warm, so there is no run-to-run churn left to subtract here and every diff below is attributable.
Only encoders change from the breakout fix, and only by gaining it: 41 decoder breakouts had no encoder counterpart before, all 41 match on grammar id, threshold and targets after. The WPT decoder also changes, which is the point of the first fix: grammar 75 was a one bit state whose only exit was
grammar_id = -1, soWPT_TxRxPackageSpecDataTypewas undecodable, and it is now the correct two mandatory states plus a tail offering the loop and the next particle. DER curve round-trips for n = 2..10 in both IEC and SAE.The namespace element replacement guard, and why it went unseen
The verification above used to be scoped to four ISO 15118-20 schemas, excluding DIN 70121 and ISO 15118-2. That scope is exactly why this went unseen: the regression below lands entirely in ISO 15118-2, so no amount of care inside the verified set could have found it. It showed up the first time the same check was run with every downloadable schema present. Worth checking the scope of a verification before trusting its conclusion.
The guard in
SchemaAnalyzer.__build_namespace_elementsthat skipped replacement for any type already carrying particles also caught ISO 15118-2'sBodyType, which stopped being replaced and lost itsunion, emitting all 35 message bodies side by side:sizeof(struct iso2_BodyType)sizeof(struct iso2_exiDocument)EVerest's
EvseV2Gallocates twoiso2_exiDocumentper connection and clears both on every message, so that guard cost about 82 KB of extra zeroing per message on hardware that does not have it to spare.The fix is deliberately narrow: the
content_type/particlescondition is removed and the substitution group head skip is kept. Measured with and without that one condition, over two cold runs of each arm, on this branch alone and on a merge with the element fragment grammar branch:Checklist before requesting a review