Skip to content

spaces: the table's sorting and cell editing were unreachable code - #433

Open
nyblnet wants to merge 1 commit into
mainfrom
spaces-table-unreachable
Open

spaces: the table's sorting and cell editing were unreachable code#433
nyblnet wants to merge 1 commit into
mainfrom
spaces-table-unreachable

Conversation

@nyblnet

@nyblnet nyblnet commented Sep 9, 2026

Copy link
Copy Markdown
Owner

spaces/src/render.ts on main carries two if (layout === 'table') branches. The first returns, so the second — the one #390 wrote, with click-to-sort headers and edit-in-place cells — is unreachable.

The table still renders, which is why nobody saw it. It just quietly became read-only and unsortable.

Measured, in the built shell

Not read out of the source, because the source is what fooled everyone the first time. A view with three pages and an estimate field, in a real browser on a served build:

beb5a19 (main) this branch
header buttons 0 2
cell buttons 0 6
data-sort-col present no yes
clicking a header reorders rows 5,2,9 → 2,5,9

So the whole of #390 — one of the four features the Bases round shipped — has been dead on main since covers and the gallery landed.

Where it came from

beb5a19 (#392): one branch at its parent, two at the commit. A rebase of a stacked branch onto a squashed base duplicated the block.

The same rebase also duplicated a whole section of scripts/test-spaces-model.ts. That copy was found and removed in #409 — I removed the rig copy and missed this one.

Why it survived review twice

The rig covering #390 checks editor.ts for the click wiring. That wiring exists and is correct — the handler was fine, the markup it needed was never rendered. A source grep answering a question about the wrong file. I made the same mistake by hand at the time: grepped for dataset.sortCol, found it, and reported #390 intact.

The guard

It counts dispatch branches rather than checking any one branch's contents — every layout === '<word>' in render.ts must appear exactly once. Sabotage-verified against main's actual render.ts, which fails it and names the duplicate:

FAIL  each layout is dispatched from exactly ONE branch in render.ts — duplicated: table×2

A second assertion pins that the surviving branch still renders sortable headers, because deleting the wrong half of a duplicate pair passes a count check and loses the feature. Worth recording: that assertion was first written as /sortCol/ and stayed green when the property was renamed to sortColX — the sabotage found my assertion, not the code. It is now anchored on \bdataset\.sortCol\b and fails under that rename.

Checks

  • node scripts/test-spaces.mjs — all 8 rigs pass, model 936/936
  • tsc --noEmit clean
  • npm run build:single clean; shell 270KB (−1KB, dead code removed)
  • Two sabotages run and restored, described above

Flagged

scripts/test-spaces-model.ts is an ops-owned surface; this is a spaces branch touching it, which is the known cross-zone shape for spaces rig coverage. Claimed on the board.

This should land before the five feature branches in flight — they all touch render.ts and will rebase onto it anyway, and it is a live regression on main.

render.ts carried TWO `if (layout === 'table')` branches. The first returned,
so the second — the one #390 wrote, with sortable headers and editable cells —
could never run. The table still rendered, which is why nobody saw it: it just
quietly became read-only and unsortable.

Measured in the built shell rather than read out of the source. Before, on
beb5a19: the table draws three headers and 0 header buttons, 0 cell buttons,
and no sort attribute anywhere in the document. After: 2 header buttons, 6 cell
buttons, and clicking the Estimate header reorders the rows 5,2,9 -> 2,5,9.
So the whole of #390 has been dead on main since covers and the gallery landed.

Introduced by beb5a19 (#392): one branch at its parent, two at the commit. The
same rebase duplicated a whole section of scripts/test-spaces-model.ts, which
was found and removed in #409 — I removed the rig copy and missed this one.

WHY IT SURVIVED REVIEW TWICE. The rig covering #390 checks editor.ts for the
click wiring, and that wiring exists and is correct: the handler was fine, the
markup it needed was never rendered. A source grep answered a question about
the wrong file. I made the same mistake by hand at the time — I grepped for
dataset.sortCol, found it, and reported #390 intact.

So the guard added here counts DISPATCH BRANCHES rather than checking any one
branch's contents: every `layout === '<word>'` in render.ts must appear once.
Sabotage-verified against main's actual render.ts, which fails it and names the
duplicate.

The second assertion — that the surviving branch still renders sortable headers
— was written as /sortCol/ and stayed GREEN when the property was renamed to
sortColX, which is precisely what deleting the wrong half of a duplicate pair
looks like. The sabotage found my assertion rather than the code. It is now
anchored on \bdataset\.sortCol\b and fails under that rename.

Rig coverage lands in scripts/test-spaces-model.ts, an ops-owned surface;
flagged rather than hidden.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Build size

main (0100083) → spaces-table-unreachable (e4262d0)

app base PR change
bento/slides 677.9 KiB 677.9 KiB 0.0 KiB (0.00%)
bento/spaces 271.3 KiB 270.9 KiB -0.4 KiB (-0.13%)
bento/dash 424.1 KiB 424.1 KiB 0.0 KiB (0.00%)

Updated: 2026-09-09T01:24:53Z

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