Skip to content

feat: LOOKUP column qualifier — grammar + storage layer (#58)#63

Merged
DDecoene merged 6 commits into
release/v1.3.0from
feature/58-lookup-qualifier
Jul 12, 2026
Merged

feat: LOOKUP column qualifier — grammar + storage layer (#58)#63
DDecoene merged 6 commits into
release/v1.3.0from
feature/58-lookup-qualifier

Conversation

@DDecoene

Copy link
Copy Markdown
Owner

Summary

Adds the LOOKUP column qualifier to W3Script — the language grammar and storage layer only. Any column can now declare a constraint on its legal values:

SCHEDID CHAR(4) LOOKUP SCHEDULES.SCHEDID DISPLAY DESCR   -- live table lookup
STAGE   CHAR(12) LOOKUP ("Lead","Won","Lost")             -- literal list

Parsed by CREATE TABLE/ALTER TABLE ADD/ALTER TABLE ALTER, persisted per-column in ColumnMetaStore via an additive ALTER TABLE ... ADD COLUMN migration (v1.2.0 shipped, so existing users' declared types are never touched or dropped), and resolvable to concrete {value,label} options via src/interpreter/LookupResolver.ts — which degrades to free entry (never truncates) when the source table/column is missing, empty, or exceeds 1000 distinct values.

Scope boundary — this PR does not enforce or render anything. No BROWSE/REPLACE membership checking, no form/grid picker UI. Those are #59 (field-bound GET) and #60 (grid/REPLACE enforcement), each landing as their own PR into this same release branch. Docs (CHANGELOG/CLAUDE.md) are scoped accordingly — the user-facing README section is held back until the feature actually does something end-to-end.

Design: docs/superpowers/specs/2026-07-10-lookup-columns-design.md
Plan: docs/superpowers/plans/2026-07-11-lookup-columns.md (Tasks 1–5)

Closes #58.

Test plan

  • npm test — 419/419 vitest pass
  • npm run build — clean typecheck + build
  • npx playwright test — 94/94 pass (one transient failure from a stale pre-existing dev server was reproduced as unrelated and confirmed fixed by restarting the server, not by any code change)
  • Every new WS-visible/storage shape has a dedicated test: CellValidation, CreateTableParse (incl. malformed-grammar rejection + ALTER null-vs-undefined regression), ColumnMetaStore (incl. two-database scoping + v1.2.0-schema migration-without-data-loss), LookupResolver (incl. degrade-never-truncate at the 1000-value ceiling), LookupEnforcement (CREATE/ALTER round-trip via BROWSE's grid-open)

@DDecoene DDecoene merged commit 1ee54eb into release/v1.3.0 Jul 12, 2026
2 checks passed
@DDecoene DDecoene deleted the feature/58-lookup-qualifier branch July 12, 2026 07:19
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