Repository navigation
feat(graphile-meta): grid metadata, and a valid name for every enum label - #1996
Merged
Merged
Conversation
… name - A label with a space, a dash, an apostrophe or non-Latin letters (`in progress`, `done-ish`, `won't fix`) became an invalid enum value name, and the whole API of that database failed to build. Each run of other characters now becomes `_`. - A label with nothing usable left, or a name already taken, gets a short suffix hashed from the label itself, so names do not move when labels are added. - Labels that differ only in case no longer share one name; the later one keeps it. - Every name that is valid and unique today is unchanged.
…e limits - `MetaTable.kind` and `description`, `MetaField.isComputed`, `MetaField.file` (kind, list, files type), `MetaType` length, precision and scale, and populated `srid`, `dimensions` and a per-column `dotPath` for tree paths. - Relation key pairs: `refKeys` on belongs-to and `remoteKeys` on has-one/has-many. - The README states the real rule for backward relations: an index must cover the foreign key columns. - A torture seed covering every column kind the backend can create, with an integration suite that reads `_meta` and the rows back.
|
Review complete. 🟡 1 medium 💬 Inline comments (1)
🧹 Nitpicks (1) — 🟢 1 low
The change expands the
Reviewed commit: 4c15806 |
There was a problem hiding this comment.
This PR extends the _meta GraphQL schema with per-table and per-field metadata (kinds, computed flags, relation key lists, encoding details like ltree paths and file/encoding domains) and adds integration tests and a torture-seed SQL fixture to cover them.
Key findings
- 🟡
refKeys/remoteKeysname hidden columns on the other table — relation-meta-builders.ts:96
…visibility `refKeys` and `remoteKeys` repeat the columns of the foreign key constraints, which were never filtered, and they must pair with `keys` position by position. The README now says so and tells clients to check each name against the other table's fields. The `exposedColumns` comment no longer claims that every column fact goes through it.
Contributor
Author
|
Tenki nitpick on |
- `grid-meta.test.ts` already covers each new `_meta` field, and `enum-value-names.integration.test.ts` covers the enum fix end to end. - The rest of the suite checked existing behavior and exported fixtures for Blocks, which belongs outside this repository.
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.
Additive
_metafields that let a data grid build every read and write from metadata, plus a fix for enum labels that broke the whole schema build. Consumed by the Sheets table model in constructive-io/blocks (constructive-io/blocks#63)._metaadditions (graphile-meta)MetaTable.kind(tableorview) andMetaTable.description.MetaField.isComputed, andMetaField.file(kind,isMultiple,filesType) for image, upload and attachment columns.MetaType.maxLength,precisionandscale;sridanddimensionsare now populated.dotPathper tree-path column, read from how that column is really served: a plain path is served as/top/science(false), a list of paths astop.science(true).refKeyson belongs-to,remoteKeyson has-one and has-many. Like the foreign key constraints they repeat, they name every key column, even one the other table hides; the README tells clients to check each name.Enum labels with a space or a dash (
graphile-settings)Cause. Each enum label becomes a GraphQL enum value name, which must match
[_A-Za-z][_0-9A-Za-z]*. TheenumValueinflector upper-cased the default name, which keeps spaces, dashes and apostrophes, so a label such asin progress,done-ish,won't fixor進行中produced an invalid name and the whole API of that database failed to build:A second fault: labels that differ only in case (
Done,done) shared one name, and a row holding the earlier label could not be read.Fix.
enum-value-names.tsnames all labels of an enum together:todo,in_progress,caféTODO,IN_PROGRESS,CAFE(unchanged)on hold,done-ish,won't fixON_HOLD,DONE_ISH,WON_T_FIX1st review_1ST_REVIEW🙂(nothing usable)_+ a hash of the labela-baftera b(taken)A_B_+ a hash of the labelThe hash is FNV-1a of the label's UTF-8 bytes, so a name does not move when other labels are added or reordered.
Compatibility. Every name that is valid and unique today is unchanged. The only name that changes in a schema that builds today is the earlier label of a case-only pair, which could not be read before. Order-by and filter names are not affected.
The three snapshots change only by the new Meta fields, the
MetaFileFieldtype and the newdotPathdescription.After merge: run the constructive-db "Schema SDK Update" workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_017WbsG7HDw7AL26N4UZGgrM