Skip to content

feat(pinned-rows): ?key prefix marks an optional pinned row#777

Merged
paddymul merged 3 commits into
mainfrom
feat/pinned-rows-optional-prefix
May 20, 2026
Merged

feat(pinned-rows): ?key prefix marks an optional pinned row#777
paddymul merged 3 commits into
mainfrom
feat/pinned-rows-optional-prefix

Conversation

@paddymul
Copy link
Copy Markdown
Collaborator

Summary

  • Adds ? prefix support to PinnedRowConfig.primary_key_val. A leading ? means: render the row iff the unprefixed key exists in the summary stats; otherwise omit the row entirely.
  • Unprefixed keys preserve today's behavior (kept as undefined when absent) for callers that rely on positional alignment with the config.
  • Purely additive: no existing config uses the prefix today, so this PR alone is observable-no-op. Unlocks the upcoming scoped-summary-stats backend work (raw / cleaned / filtered) where default configs ship ?cleaned_* / ?filtered_* entries.

Touches extractPinnedRows (to skip absent optional rows) and getCellRendererSelector (to match stripped keys so the cell renderer binds correctly when a ?key config entry points at a data row with the bare index).

See docs/plans/async-stats.md (forthcoming) for the broader plan this slots into.

Test plan

  • Three failing test cases added first (test(pinned-rows): failing tests … commit), all assertions strict (toStrictEqual + explicit length) to avoid Jest's toEqual silently ignoring trailing undefined items.
  • Implementation lands the helpers + lookup change; all 239 tests in packages/buckaroo-js-core pass locally.
  • CI: verify the test-first commit fails and the fix commit passes.

🤖 Generated with Claude Code

paddymul and others added 2 commits May 20, 2026 14:29
…nedRows

Three new cases covering the proposed `?`-prefix semantic on
PinnedRowConfig.primary_key_val:

- `?key` with key present in data → row included (current code returns
  undefined because it looks up the literal `?key` string).
- `?key` with key absent → row omitted entirely from the result array
  (current code returns undefined, leaving holes).
- Unprefixed key absent → preserves today's "kept as undefined" behavior
  so callers depending on positional alignment with pinned_rows config
  keep working.

Uses toStrictEqual + explicit length checks because Jest's toEqual
silently treats trailing undefined items as missing, which made an
earlier draft of these tests vacuously pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A leading `?` on PinnedRowConfig.primary_key_val now means "render the
row iff the unprefixed key exists in the summary stats data; otherwise
omit it entirely." Unprefixed keys preserve today's behavior (kept as
undefined when absent) for callers that rely on positional alignment.

Mechanism is purely additive: no existing config carries the prefix, so
this PR alone is observable-no-op. It unlocks the in-flight scoped
summary stats work (raw / cleaned / filtered scopes) where default
configs ship with entries like `?cleaned_histogram_bins` and
`?filtered_histogram_bins`, rendered only when those scopes are active.

extractPinnedRows skips optional rows whose key is missing.
getCellRendererSelector matches stripped keys so the cell renderer
selector still binds to the pinned config when the data row's bare
`index` matches a `?`-prefixed config entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7327da27ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

📦 TestPyPI package published

pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.3.dev26187656127

or with uv:

uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.3.dev26187656127

MCP server for Claude Code

claude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.14.3.dev26187656127" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table

📖 Docs preview

🎨 Storybook preview

- Two tests in gridUtils.test.ts pin the `?`-prefix strip behavior at
  renderer-resolution time (in addition to extractPinnedRows): a `?key`
  config matches a bare-key data row to the same cellRenderer that a
  bare-key config would; and a literal `?key` in data does NOT match,
  locking in the reserved-character semantics flagged by Codex.
- New `OptionalPinnedRows` storybook story exercises the feature
  interactively: a scope selector flips between raw / filter /
  filter+clean states so `?filtered_*` and `?cleaned_*` pinned rows
  appear and disappear without re-mounting the grid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@paddymul paddymul added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 2997485 May 20, 2026
27 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