Workbench var-strip rebuild signature ignores enum option identities (only counts them)

Open Beginner friendly
#605 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
frontend

Research direction

Start in src/ui/workbench/variable-strip.ts at renderVarStrip and its sigNew rebuild-signature computation, comparing it with the moved code from src/ui/app.ts. Reproduce two passes where inferred enum options have the same length but different identities, then add coverage showing the dropdown updates from the old set to the new set. Done means option identity changes trigger a rebuild without relying only on enumOptions.length.

Written by the indexing model from the issue text.

Description

inbox

renderVarStrip's rebuild-signature computation (src/ui/workbench/variable-strip.ts, the sigNew build — moved verbatim from src/ui/app.ts, present unchanged on origin/main before the #588 phase-4 refactor) folds in each variable's control kind and enumOptions.length, but not the option identities:

return v.name + ':' + v.type + (v.optional ? '?' : '') + (v.conflict ? '!' : '')
  + ':' + c.kind + (c.enumOptions ? c.enumOptions.length : '');

Repro: a variable's inferred enum options change from ['a', 'b'] to ['c', 'd'] (same cardinality) between two renderVarStrip passes — e.g. a background schema/column reload landing between keystrokes. The signature is unchanged, so the strip does not rebuild, and the dropdown keeps offering the stale ['a', 'b'] set even though deps.params.inferredEnumOptions(...) now returns different values.

Surfaced during phase 4 of the #593 refactor umbrella's PR review (#604) — pre-existing, not introduced by that PR, and deliberately left unfixed there (a pure structural extraction is not the place for a behavior change). A comment at the signature site documents this; no regression test was added for the same reason.

Suggested fix direction: fold a stable digest of the option identities themselves into the signature (e.g. join the resolved enumOptions array), not just its length.

Dominant language
TypeScript
Stars
8
Forks
2
Avg merge
1h 34m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Altinity/altinity-sql-browser

All issues in Altinity/altinity-sql-browser

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.