Skip to content

fix(tensor): harden #296 chunk API — range guard, n==0 no-op, self-alias rejection (release-review findings from #324)#341

Merged
LeoBuron merged 1 commit into
developfrom
harden-chunk-api
Jul 10, 2026
Merged

fix(tensor): harden #296 chunk API — range guard, n==0 no-op, self-alias rejection (release-review findings from #324)#341
LeoBuron merged 1 commit into
developfrom
harden-chunk-api

Conversation

@LeoBuron

Copy link
Copy Markdown
Member

Addresses the three CodeRabbit findings posted on release PR #324 against the #296 Stage-2 code. All three were triaged as REAL — latent public-API hardening (no in-tree caller can reach them; each is one future caller away from silent OOB or mid-stream grid corruption):

  1. dequantChunkToFloat: range-vs-source guard (elemOffset > n or count > n - elemOffset → fail fast) — previously only chunk-size + alignment were checked.
  2. quantizeFloatToAsym: n == 0 no-op guard in the shared static (covers FLOAT32→ASYM, which lacked the sibling guards Tasks 7/8 added elsewhere; old code read values[0] — UB).
  3. Tensor-typed accumulate wrappers (accumulateTensorIntoSym{FixedGrid,Rescale}, accumulateTensorIntoAsymRescale): explicit self-alias rejection — the rescale engines rewrite the target's grid between phases, so an aliased increment would decode old codes against the new grid. Rejection chosen over metadata snapshotting (the funnel epilogue never aliases; simplest honest contract). Header docs updated.

Strict TDD: each guard's test shown RED (no exit / silent corruption today) before the guard, GREEN after. UnitTestTensorConversion 70/70 (3 new); full ctest 72/72.

🤖 Generated with Claude Code

… quantizeFloatToAsym n==0 no-op, reject self-aliased accumulate increments (release-review PR #324)
@LeoBuron LeoBuron merged commit 27b8368 into develop Jul 10, 2026
11 checks passed
@LeoBuron LeoBuron deleted the harden-chunk-api branch July 10, 2026 13:01
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