Uh oh!
There was an error while loading. Please reload this page.
feat(grid): inline select editor only offers valid state-machine transitions - #2110
Merged
Merged
Conversation
…sitions The inline editor would happily offer a status change the server then rejects (e.g. done → in_review), leaving the author to discover the failure on save. Now, when a field is governed by a `state_machine` validation, the dropdown is filtered to the values reachable from the current state — the current value plus its declared transitions — so the invalid choice isn't offered at all. - `stateMachineNextValues(objectSchema, field, value)` reads the object's `validations` (the same metadata the server enforces, already served on the schema and passed through by the adapter's getObjectSchema) and returns the reachable set, or null = "don't constrain" when there's no state machine or the current state is undeclared (mirrors the validation engine's lenient allow). - ObjectGrid.renderCellEditor filters the field's `options` by that set before handing the field to FieldEditWidget; non-select / non-state-machine fields are untouched. - 8 unit tests incl. the live bug case (from `done` → only [done, in_progress]). Complements #2106 (surface save failures): prevent the invalid edit at the source, and still report it if one slips through. Verified end-to-end that the data path is live — the backend serves the transitions and getObjectSchema passes them through unmodified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
os-zhuang added a commit
that referenced
this pull request
Jun 30, 2026
…h (inert-metadata guard) (#2117) The inline select editor filters its options by the object's `state_machine` validation (#2110); that only works because `getObjectSchema` passes the served `validations` through untouched. Today that's verified only by hand (curl the endpoint + grep the adapter). Codify it: a fetch-mocked test asserts the state-machine transitions survive the adapter intact, so a future change that strips or reshapes top-level metadata trips a red test instead of silently turning the feature inert (valid-but-inert, the failure mode behind several prior "shipped but runtime-dead" bugs). Test-only; no changeset (no version-affecting change). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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 freeto 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.
What
When a field is governed by a
state_machinevalidation, the inline cell editor now filters its dropdown to the values reachable from the current state (the current value + its declared transitions) — so you can't even stage an edit the server is bound to reject.Why
Follow-up to #2106. While verifying the inline-edit work I changed a task's status
Done → In Reviewand the server (correctly) rejected it with a state-machine validation. #2106 made that failure visible; this PR prevents the invalid choice from being offered in the first place — the Airtable-grade behavior.How
stateMachineNextValues(objectSchema, field, value)reads the object'svalidations— the same metadata the server enforces — and returns the reachable set, ornull= "don't constrain" when there's no state machine for the field or its current state is undeclared (mirrors the client validation engine's lenient allow).ObjectGrid.renderCellEditorfilters the field'soptionsby that set before handing the field toFieldEditWidget. Non-select / non-state-machine fields are untouched.Not inert — data path verified
Verified the full chain on the live showcase: backend serves the transitions on
GET /api/v1/meta/object/showcase_task(done: ["in_progress"], …); the adapter'sgetObjectSchemahits that endpoint and returns it unmodified; soObjectGrid.objectSchema.validationsis populated and the filter activates.Tests
inline-edit-options.test.ts— 8 cases incl. the live bug (done→ only[done, in_progress], neverin_review), terminal states, undeclared-state leniency, no-state-machine pass-through, numeric coercion. Full plugin-grid suite: 103/103 green. ESLint clean.🤖 Generated with Claude Code