Skip to content

fix(inspector): walk full ArrayNode tree for usedEncodings - #315

Merged
dfa1 merged 1 commit into
mainfrom
fix/298-inspector-nested-encodings
Jul 26, 2026
Merged

fix(inspector): walk full ArrayNode tree for usedEncodings#315
dfa1 merged 1 commit into
mainfrom
fix/298-inspector-nested-encodings

Conversation

@dfa1

@dfa1 dfa1 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • InspectorTree's usedEncodings (surfaced by the CLI inspect command) only ever inspected a Flat segment's root ArrayNode, so encodings nested inside another node — e.g. vortex.fsst under a vortex.masked root, which CascadingCompressor genuinely produces for high-cardinality Utf8 columns — never showed up, even though the file's values really are FSST-compressed.
  • collectEncodings now walks the full ArrayNode tree (root + all descendants). Since this newly makes the inspector traverse wire-supplied children it previously never touched, the walk is hardened to match the untrusted-input contract the reader module's analogous tree walks already follow:
    • bounds-checks the wire-supplied encoding index before resolving it against the footer's array spec table (mirrors PostscriptParser.convertLayout's guard) instead of letting a crafted out-of-range index surface a raw IndexOutOfBoundsException
    • caps total visited nodes, not just depth — two children vector slots can alias the same absolute table position, so a crafted segment with aliased fan-out could otherwise drive an exponential number of visits while depth stays within the existing MAX_ENCODING_TREE_DEPTH guard
  • Fixes a stale test comment/assertion in DictValuesPoolCompressionIntegrationTest that claimed the nested FSST values-pool encoding "is not visible in usedEncodings" — it now is, so the test asserts it directly.

Closes #298.

Test plan

  • ./mvnw verify -DskipTests (full reactor compile)
  • ./mvnw -pl inspector,cli -am test (unit tests, including new nested-encoding + depth/node-count/bounds-check coverage)
  • ./mvnw -pl integration -am verify -Dit.test="DictValuesPoolCompressionIntegrationTest,AlpRdCascadeSelectionIntegrationTest,NullSparseRunEndInteropIntegrationTest" -Dvortex.it.excludedGroups= (real-file InspectorTree consumers)

🤖 Generated with Claude Code

InspectorTree's peekFlatRoot only ever resolved a Flat segment's root
ArrayNode, so encodings living purely inside another node's tree (e.g.
vortex.fsst nested under a vortex.masked root, as CascadingCompressor
genuinely produces for high-cardinality Utf8 columns) never showed up
in usedEncodings, making `vortex inspect` and anything built on it
unreliable for auditing which encoding a file actually uses.

collectEncodings now walks the full ArrayNode tree (root + all
descendants). Since this newly makes the inspector traverse
wire-supplied children it previously never touched, harden the walk
to match the untrusted-input contract the reader module's analogous
tree walks already follow:
- bounds-check the wire-supplied encoding index before resolving it
  against the footer's array spec table (mirrors
  PostscriptParser.convertLayout's guard), instead of letting a
  crafted out-of-range index surface a raw IndexOutOfBoundsException
- cap total visited nodes, not just depth: two children vector slots
  can alias the same absolute table position, so a crafted segment
  with aliased fan-out could otherwise drive an exponential number of
  visits while depth stays within the existing MAX_ENCODING_TREE_DEPTH
  guard

Also fixes a stale test comment/assertion in
DictValuesPoolCompressionIntegrationTest that claimed the nested FSST
values-pool encoding "is not visible in usedEncodings" - it now is,
so assert it directly instead of only asserting the vortex.dict
wrapper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 merged commit 4881dc6 into main Jul 26, 2026
6 checks passed
@dfa1
dfa1 deleted the fix/298-inspector-nested-encodings branch July 26, 2026 11:57
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.

InspectorTree "Used encodings" misses encodings nested inside a Flat segment (e.g. vortex.fsst)

1 participant