Skip to content

test: cover new decode/validity branches; fix S3034 dict bit-set masking (Sonar gate)#228

Merged
dfa1 merged 1 commit into
mainfrom
test/sonar-gate-and-coverage
Jul 7, 2026
Merged

test: cover new decode/validity branches; fix S3034 dict bit-set masking (Sonar gate)#228
dfa1 merged 1 commit into
mainfrom
test/sonar-gate-and-coverage

Conversation

@dfa1

@dfa1 dfa1 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Turns the SonarCloud quality gate green and covers the highest-risk uncovered branches from this session's fixes (identified by a SonarCloud analysis run).

Gate fix — the gate was red solely on new_reliability_rating = C, from two java:S3034 findings (a byte sign-extends to int before an OR in the dict validity bit-setter). Functionally no-ops — the result is immediately re-cast to (byte) — but they gate-block. Masked with & 0xff at both sites (DictEncodingDecoder.setBit, DictLayoutDecoder validity gather). No behavior change, no CHANGELOG entry.

Coverage (+21 tests, all reader green at 1179) — the untested silent-corruption branches this session touched:

  • RLE F32/F64 decode (new RleEncodingDecoderTest, 7): decode across a run boundary, empty→constant, and the readDoubles/readFloats broadcast helpers; plus LazyRleFloatArray constant/empty-chunk parity with its double sibling.
  • Dict validity broadcast slow path (+2): the codesCap < rowCount i % cap validity loop (the S3034 fix site) with U16/U32 code widths and combined codes+pool nulls.
  • Byte/short dict layout variants (+5): DictByteArray/DictShortArray pools and the gatherRowValidity codes-type arms.
  • ScanIterator merged-grid + struct-slice (+2): the misaligned-grid out-of-range VortexException guard, and a hand-assembled nested-struct file driving the StructArray slice arm.
  • ZonedStatsSchema defensive branches (+5): the boolean/size stat arms, fixed-width field skip, and the malformed-metadata bail-outs (varint overflow, oversized/unknown tag).

Two default-throw arms in the dict decoders are left untested by design — they're pre-empted upstream (DictArrays.validateCodes / the expand switch reject non-U8/U16/U32 codes first), so they're defensive dead code; per simplify-first, no unkillable test.

🤖 Generated with Claude Code

…ing (Sonar gate)

Fix the two java:S3034 findings (byte promoted to int before OR without
masking) that gate-block new_reliability_rating; both are behavior-preserving
(result is immediately re-cast to byte):
- reader/decode/DictEncodingDecoder.java setBit (~L207)
- reader/layout/DictLayoutDecoder.java validity-mask gather (~L200)

Add coverage for the previously untested decode/validity branches these paths
introduced:
- B1: RleEncodingDecoder F32/F64 decode (run boundary, empty->constant array)
  and the readDoubles/readFloats broadcast helpers (new RleEncodingDecoderTest;
  helpers made package-private, unreachable via decode() as constant children
  fully materialize).
- B6: LazyRleFloatArray.materialize constant-run + empty-chunk fast path
  (mirrors the double sibling).
- B2: DictEncodingDecoder validity broadcast slow path (codesCap < rowCount,
  the setBit fix site) plus U16/U32 readCode widths with combined codes/pool
  nulls.
- B3: DictLayoutDecoder byte/short dict pools (DictByteArray/DictShortArray)
  and the gatherRowValidity Short/Int/Long codes-type arms.
- B4: ScanIterator merged-grid out-of-range guard (mismatched column totals)
  and the sliceArray StructArray branch via a hand-assembled nested-struct file
  (also drives collectFlats' struct arm).
- B5: ZonedStatsSchema boolean/size stat arms, fixed-width (I64/I32) field skip,
  the >63-bit varint overflow, and inner-spec overflow-tag / unknown-wire-type
  bail-outs.

Not reached (reported, not forced): the readCode/gatherRowValidity `default`
throws are pre-empted upstream (the expand switch and DictArrays.validateCodes
reject non-U8/U16/U32 codes before those arms run) — defensive dead code, left
as-is rather than backed by an unkillable test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 merged commit abf892b into main Jul 7, 2026
6 checks passed
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.

1 participant