feat: LOOKUP column qualifier — grammar + storage layer (#58)#63
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
LOOKUPcolumn qualifier to W3Script — the language grammar and storage layer only. Any column can now declare a constraint on its legal values:Parsed by
CREATE TABLE/ALTER TABLE ADD/ALTER TABLE ALTER, persisted per-column inColumnMetaStorevia an additiveALTER TABLE ... ADD COLUMNmigration (v1.2.0 shipped, so existing users' declared types are never touched or dropped), and resolvable to concrete{value,label}options viasrc/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/REPLACEmembership checking, no form/grid picker UI. Those are #59 (field-boundGET) 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.mdPlan:
docs/superpowers/plans/2026-07-11-lookup-columns.md(Tasks 1–5)Closes #58.
Test plan
npm test— 419/419 vitest passnpm run build— clean typecheck + buildnpx 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)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'sgrid-open)