🤖 AI generated content
The spec ends most chapters with an "Invariants" section. rootfilespec checks roughly one of them (the end position, at indent == 0 only — src/rootfilespec/bootstrap/streamedobject.py:261). The reviewers picked out the cheap ones that would turn silent desyncs into immediate, located errors. None of these is a known failure on a real file; this is hardening.
Framing — Buffer framing §9, at StreamHeader.read (streamedobject.py:51-99):
Values:
Streamer info / elements — Streamer information §13, Element types §11, Collections §14, Streamer-driven reading §10, in src/rootfilespec/bootstrap/TStreamerInfo.py:
Design note: Buffer §9 says invariant 9 (consumed bytes == byte count) legitimately fails in the wild, so these checks should report through the same warning channel as #98 rather than all being hard errors; the framing ones (1, 4, 8) are safe to raise on.
Severity / size: low / S each.
Related: #81 (container-layer counterpart), #98, #107, #92.
Assisted-by: claude-code:claude-fable-5-1
The spec ends most chapters with an "Invariants" section. rootfilespec checks roughly one of them (the end position, at
indent == 0only —src/rootfilespec/bootstrap/streamedobject.py:261). The reviewers picked out the cheap ones that would turn silent desyncs into immediate, located errors. None of these is a known failure on a real file; this is hardening.Framing — Buffer framing §9, at
StreamHeader.read(streamedobject.py:51-99):< kMaxMapCount(0x3FFFFFFE)[0, kMaxVersion](0x3FFF)Values:
fN >= 0— today a negative count reachesnp.frombuffer(count=n)(src/rootfilespec/container.py:48)TObjectbase (only checked indirectly today)Streamer info / elements — Streamer information §13, Element types §11, Collections §14, Streamer-driven reading §10, in
src/rootfilespec/bootstrap/TStreamerInfo.py:fArrayDim ∈ [0,5]; when non-zero the firstfArrayDimentries offMaxIndexare positive and their product isfArrayLength(needs TStreamerElement.fMaxIndex is read in native byte order #92 first; the spec notes it legitimately fails for an STL element written before ROOT 6.24/02)TStreamerBasehasfTypeName == "BASE"andfType ∈ {0, 66, 67, -1}TStreamerSTL/TStreamerSTLstringhasfType == 500(ROOT ≥ 5); aTStreamerSTLstringhasfSTLtype == fCtype == 365fCountNamenames an integer element earlier in the same list or in a base — the commented-out check atTStreamerInfo.py:397-402is this one. It must acceptkInt(3) andkUInt(13) as well askCounter(6) (Element types §2.1:TArrayD.fArraynames anfType3fNon ROOT 4 files;TBits.fAllBitsnames anfType13fNbytes)0 <= fClassVersion <= 65000(Schema evolution §9 inv. 1)Design note: Buffer §9 says invariant 9 (consumed bytes == byte count) legitimately fails in the wild, so these checks should report through the same warning channel as #98 rather than all being hard errors; the framing ones (1, 4, 8) are safe to raise on.
Severity / size: low / S each.
Related: #81 (container-layer counterpart), #98, #107, #92.
Assisted-by: claude-code:claude-fable-5-1