Repository navigation
fix: accept NULL line, font and foreground attribute references; add try_from_iop - #48
Merged
Conversation
ISO 11783-6 allows the Line Attributes reference of the output shape objects, the Font Attributes reference of the string and number objects and the Foreground Colour reference of Input Boolean to be the NULL object ID, and real pools use it: a John Deere StarFire pool nulls line attributes on 213 shapes and foreground colour on all 38 of its Input Booleans. Reading them with try_into() failed with UnexpectedNullObjectId, and because from_iop stops at the first error the rest of the pool was silently dropped -- including the Working Set, which John Deere sends last. Make the nine fields NullableObjectId. The writer already accepts it, so NULL round-trips as 0xFFFF. Add ObjectPool::try_from_iop / try_extend_with_iop, strict counterparts that return the first ParseError; from_iop keeps its lenient behaviour. The existing read_working_set_test did not compile on this branch (Colour where u8 is expected); one-token fix so the test target builds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 11, 2026
Member
|
Thanks for your contribution! I'll merge despite the CI failures because they look like rust toolchain / dependency drift bitrot that you shouldn't be responsible for fixing. |
Notgnoshi
merged commit Sep 11, 2026
1f49651
into
Open-Agriculture:daan/terminal-designer-changes
1 of 3 checks passed
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.
Fixes #47.
What
Object::readreturnedParseError::UnexpectedNullObjectIdfor any Output Line / Rectangle / Ellipse / Polygon whose Line Attributes reference is NULL (0xFFFF), any Input/Output String/Number whose Font Attributes reference is NULL, and any Input Boolean whose Foreground Colour reference is NULL. ISO 11783-6 allows NULL for all of these (the Output Polygon table gives the range as0-65534, 65535outright), AgIsoStack++ accepts it in every one of the correspondingget_is_validchecks, and real terminals ship such pools — a John Deere StarFire pool captured off the bus nulls line attributes on 213 shapes and foreground colour on all 38 of its Input Booleans, and the John Deere VT accepted it with error bitmask0x00.Because
ObjectPool::from_ioploops withwhile let Ok(o) = Object::read(..), the first such object silently ended the parse: that StarFire pool came back as 1 638 of 9 619 objects, and with no Working Set, because John Deere sends the Working Set last.Changes
NullableObjectId, are read with.into(), and are collected withpush_nullable_idinObject::referenced_objects.write_u16already takesNullableObjectId, so the writer is untouched and NULL round-trips as0xFFFF(asserted in the new test).ObjectPool::try_from_iop/try_extend_with_iop: strict counterparts that return the firstParseError.from_iop/extend_with_iopkeep their lenient behaviour and now delegate to the strict path. End-of-data between objects is the normal end of a pool; end-of-data inside an object is reported asDataEmpty.try_from_iopon a truncated object.read_working_set_test(Colour::new_by_id(0xF0).into()): on this branchWorkingSet::background_colourisu8, so the test target did not compile before this PR.This is a type change on public struct fields, so AgIsoTerminalDesigner needs a small companion change (it already treats
fill_attributesthe same way): Open-Agriculture/AgIsoTerminalDesigner#36.Verification
cargo fmt --checkclean;cargo clippyproduces the identical 34 pre-existing lib lints as the base branch and no new ones;cargo test --lib21/21 (including the previously non-compiling one). The two doctests (Object::referenced_objects,ObjectPool::from_iop) fail on the base commit5274565as well — one references an undefined variable, the other opens a hard-codedC:/project/...path — and are untouched here.Based on
daan/terminal-designer-changesbecause that is what the Designer builds from and where theNullableObjectIdplumbing from #40 already lives; happy to retarget tomainonce #40 lands.🤖 Generated with Claude Code