Failing test: exponent notation is split into a value plus a phantom E extrusion (#368) - #369
Open
remcoder wants to merge 1 commit into
Open
Failing test: exponent notation is split into a value plus a phantom E extrusion (#368)#369remcoder wants to merge 1 commit into
remcoder wants to merge 1 commit into
Conversation
This test fails on purpose. It documents the bug as executable spec rather
than prose: `G1 X12e5 Y5` parses to {x: 12, e: 5, y: 5} because the tokenizer
splits a word at every letter, so the `e` of the exponent becomes an E param.
That fabricated `e` is the damaging part. Interpreter derives the path type
from it (`e ? Extrusion : Travel`), so a travel move renders as extruded
filament, inflates extrusionDistance, and stretches the bounding box.
CI will be red on this branch until the parser is fixed. Do not merge as is.
|
Visit the preview URL for this PR (updated for commit 7ec2e7f): https://gcode-preview--pr369-failing-test-exponen-57rcjimx.web.app (expires Mon, 21 Sep 2026 16:40:03 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 59bd114ae4847b32c2bba0b68620b9069a3e3531 |
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.
Adds a failing test for #368. CI will be red on this branch by design — do not merge as is.
The point is to pin the bug down as executable spec rather than prose, so whoever fixes the tokenizer has a target that goes green.
The failure
G1 X12e5 Y5— the tokenizer splits a word at every letter, so theeof the exponent is read as a separateEparameter.Why the fabricated
eis the damaging partThis isn't just a lossy coordinate.
Interpreterderives the path type frome:So the line is interpreted as a move to X12 that extrudes 5mm of filament:
extrusionDistanceis inflated by 5All silent — no parse error, no warning.
About the expectation
The test asserts option 3 from #368 (recognize exponent notation in the tokenizer), i.e.
x: 1200000and noe. If the team prefers option 2 (reject a word whose value is followed by a valueless letter), change the expectation toxbeing absent. Either resolution has to remove the fabricatede, which is what the test really guards.Option 1 in #368 is "leave it, document it" — if that wins, close this PR and land a characterization test asserting the current
{x: 12, e: 5, y: 5}instead.Likelihood
Low: G-code has no exponent notation, and no slicer emits it. The realistic route is a generator doing naive float-to-string on an extreme coordinate, since
String()reaches exponent form by itself —String(1e21)is'1e+21',String(1e-7)is'1e-7'.Relationship to #367
Independent and pre-existing; this branch is off
develop, not the #367 stack. #367 does not change this behavior. The characterization test for it was deliberately kept out of #367 so the current behavior isn't locked in before this is decided.