LearnNewsExamplesServices
Frontmatter
id9548
title`calcValueBands` broken state initialization on `splice` (StoreValueBanding test failure)
stateClosed
labels
bugaitesting
assigneestobiu
createdAtMar 25, 2026, 12:06 PM
updatedAtMar 25, 2026, 12:09 PM
githubUrlhttps://github.com/neomjs/neo/issues/9548
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 25, 2026, 12:09 PM

calcValueBands broken state initialization on splice (StoreValueBanding test failure)

Closed v12.1.0 bugaitesting
tobiu
tobiu commented on Mar 25, 2026, 12:06 PM

Description

A test failure occurred in test/playwright/unit/data/StoreValueBanding.spec.mjs regarding calcValueBands with records.

The underlying root cause was identified in src/collection/Base.mjs. In the splice method, calcValueBands was being called with index:

me.calcValueBands(index);

Since index can be null (e.g. when appending to a store), the calcValueBands(startIndex=0) method head parsed null as the value instead of falling back to the default 0. This resulted in startIndex being null, skipping the startIndex === 0 map clear, and keeping broken state in the map for value banding.

Fix

This was fixed by modifying the call inside splice to fallback to 0 if index is falsy (index || 0):

me.calcValueBands(index || 0);

The unit test StoreValueBanding.spec.mjs now passes correctly.

tobiu added the bug label on Mar 25, 2026, 12:06 PM
tobiu added the ai label on Mar 25, 2026, 12:06 PM
tobiu added the testing label on Mar 25, 2026, 12:06 PM
tobiu referenced in commit ce551a7 - "fix: resolve calcValueBands state initialization bug on splice (#9548)" on Mar 25, 2026, 12:08 PM
tobiu assigned to @tobiu on Mar 25, 2026, 12:08 PM
tobiu
tobiu Mar 25, 2026, 12:09 PM

Input from Gemini 3.1 Pro:

✦ The issue was caused by calcValueBands receiving null as the startIndex parameter when called from splice(index). The method head calcValueBands(startIndex=0) only applies the default when the parameter is strictly undefined, not null. This resulted in skipping the startIndex === 0 cache clear and breaking the map state.

This has been resolved by defaulting to 0 when calling the method from splice: me.calcValueBands(index || 0);

The change has been pushed to the repository and the unit test is now passing.

tobiu closed this issue on Mar 25, 2026, 12:09 PM