Repository navigation
fix(grid): treat a record key of 0 as a valid row id in selection models (#21133) - #21134
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
At least one reviewer session failed, leaving the review evidence incomplete.
No open issues 🎉
What changed in this PR
Fixes grid selection for records keyed 0 when useInternalId: false, supporting correct row painting, record lookup, and keyboard navigation.
Changes:
- Replaces six truthiness checks with null-aware checks while preserving handling of
nullandundefined. - Adds three regression tests covering selection painting across bodies, record lookup, and navigation with key
0away from the first row.
| File | Description |
|---|---|
test/playwright/unit/grid/ViewOwnedSelectionModel.spec.mjs |
Adds regression coverage for records keyed 0. |
src/selection/grid/RowModel.mjs |
Allows row navigation from and onto key 0. |
src/selection/grid/CellRowModel.mjs |
Applies the same navigation fix to cell-row selection. |
src/selection/grid/BaseModel.mjs |
Allows key 0 in row repainting and record lookup. |
Review effort: Balanced
neo-gpt-emmy
left a comment
There was a problem hiding this comment.
PR Micro-Review
Opening: Thank you, @alhinawi, for putting key zero on the second row in the regression. That placement catches a fallback to the first row that an apparently passing navigation test could otherwise hide. Grid selection · Neo introduction · Run the Engine · Help-wanted issues
Class: contained — six existing checks distinguish an absent row key from the numeric primary key zero. The existing selection and painting paths own the change.
Verdict: Approved
Glance: At 73fb728be5ae13e8d61fa7c783d552b5fe5d2b9a I traced the scalar key through updateRows, the store lookup, and both keyboard models. The assertions cover all three body regions, leaving zero and landing on it again, plus the null and undefined controls. The diff is confined to the six sites in #21133 and their regression. The author records all three failures with the fix removed. Hosted CI is green. #21132 is still open, so the ticket’s conditional selectedRecords check does not apply to this revision.
Findings: None.
- Origin Session ID: 289da399-da26-4b13-ad71-dae9311704bf
- PR body attribution checked.
🪡 Emmy · GPT-6 Astra · Codex
|
@alhinawi, #21132 has now merged. The production files merge cleanly. GitHub reports one conflict because both PRs appended independent I integrated Emmy · @neo-gpt-emmy |
|
@alhinawi, the tested merge commit is now available from the Engine repository. It has your current head as its first parent and keeps both complete test blocks. All 27 tests in that file passed, and I checked that the result also merges cleanly with today’s From your git fetch https://github.com/neomjs/neo.git refs/heads/codex/21133-integrate-test-append
git merge --ff-only FETCH_HEAD
git push origin fix/grid-selection-zero-keyThe last command assumes — Emmy |
…els (neomjs#21133) Six truthiness checks in src/selection/grid read a row id of 0 as 'no id': BaseModel#updateRows and #getRowRecord, and onNavKeyRow in RowModel and CellRowModel. Under useInternalId: false with a record keyed 0, the row never painted as selected, getRowRecord(0) returned null, and arrow navigation could neither leave nor land on the row. Read a row id as missing only when it is null or undefined, matching the codebase's == null idiom. Adds three specs covering the ticket's acceptance criteria; each fails on dev before this change.
73fb728 to
d7fce80
Compare
|
@alhinawi, I rebased your PR onto current The only conflict was the adjacent test suites. I verified byte-for-byte that the resolved file contains — Emmy |
neo-gpt-emmy
left a comment
There was a problem hiding this comment.
Pull Request Micro-Delta Review
Context: The prior semantic approval covered zero-key selection. This review verifies the maintainer rebase.
State Vector
- Target SHA:
d7fce809a4c5349126babb0b8d763746a5deb5fd - Origin Session ID: 289da399-da26-4b13-ad71-dae9311704bf
- Current reviewDecision: APPROVED
- Semantic Status: APPROVED
- CI Status: GREEN. All seven required checks passed, including the aggregate for eleven browser shards.
- Remaining Blocker Class: mechanical-hygiene
- Measured Discussion Cost: 7,459 bytes across the PR body, comments and reviews before this review.
Micro-Delta Focus
Only defects classified as mechanical-hygiene or metadata-drift are reviewed here.
The contributor's commit now has 537cfaf768 as its sole parent and retains its original author and message. The entire rebased tree matches the independently composed tree. The resolved file contains the base's complete 28,974-byte test file followed by the contributor's complete 2,565-byte test addition. All 27 affected tests and 22 neighboring grid-selection cases passed locally. The zero-key tests still cover record lookup and navigation in both directions.
Verdict
- APPROVED
- COMMENTED CLOSURE
- MAINTAINER POLISH FAST PATH APPLIED — rebase and adjacent test additions resolved. Approved on this head.
🪡 Emmy · @neo-gpt-emmy
|
Merged. Thank you: this is your first merged pull request in Neo.mjs. Standing: Contributor (1 merged). 4 more reach Returning Contributor. Your badge, if you would like to show it, is written by a scheduled run that has not counted this merge yet. From then on it is at https://neomjs.com/badges/alhinawi-68702059/ in three forms to choose from, and the card's line shows it: Next, if you want one: #19145 and #20696 are open and unclaimed; a comment on either claims it. The full list has more if both are taken by then. See it run: the engine you changed runs live in the browser: https://neomjs.com/examples A star helps others find the project. |
Resolves #21133
Under
useInternalId: false, a record keyed0is now treated as a real row id across the grid selection models: the row paints as selected in every body,getRowRecord(0)resolves the record, andArrowUp/ArrowDowncan leave and land on the row. Six truthiness checks (!id,!recordIds,selectedRows[0] || fallback,if (recordId)) insrc/selection/gridbecame== null/??/!= null, matching the codebase idiom; behavior fornullandundefinedids is unchanged.Evidence: the ticket's probe showed
getRowRecord(0) → nulland no painted selection for key0→ the fix flips exactly the six guards the ticket names. Residual: the ticket's last AC (aview.selectedRecordsspec once #21132 merges) is unverifiable until that PR lands; #21132 is still open at this writing. Residual-Owner: #21132.AC Evidence
| AC-1 (
selectRow(0)paints in every body) | CI-covered:test/playwright/unit/grid/ViewOwnedSelectionModel.spec.mjs› "selectRow(0) paints the row keyed 0 in every body, and getRowRecord resolves only real ids" || AC-2 (
getRowRecord(0)resolves;null/undefinedstill null) | CI-covered: same spec,getRowRecordassertions || AC-3 (
ArrowDown/ArrowUpoff and onto key0,0not first, RowModel + CellRowModel) | CI-covered: specs "RowModel: ArrowDown moves off the row keyed 0…" and "CellRowModel: ArrowDown moves off the row keyed 0…" (key map puts0on the second row) || AC-4 (new specs fail on
devbefore the fix) | outside-CI: ran the three new specs with thesrc/selection/gridchanges stashed → 3 failed; with the fix → 24/24 pass. Command:npx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/grid/ViewOwnedSelectionModel.spec.mjs|| AC-5 (
selectedRecordsspec if #21132 merged) | Not applicable yet: #21132 is open; noted as residual above |Deltas from ticket
None substantive. The ticket's table-family out-of-scope note stands; no
src/selection/table/changes.Test Evidence
Outside-CI run receipts (Node 24.11.1, Linux):
2404340):3 failed— the three new specs, confirming each fails before the fix.ViewOwnedSelectionModel.spec.mjs→24 passed (5.8s)(21 pre-existing + 3 new), so no regression in the View-owned selection suite.agent-preflight: not hosted here; change class: bug fix, bounded to the ticket.
Post-Merge Validation
view.selectedRecordsspec for the record keyed0(residual AC-5).Authored by @alhinawi (LLM-assisted; model and version withheld per operator policy, reasoning: default, Instinct agent).