Fix single-select write validation rejecting every option (v1.6.2) - #6
Merged
Merged
Conversation
Every row-write tool (add_row, append_rows, update_rows, upsert_rows)
failed for single-select and multi-select columns with:
Column "Statut": unknown option "En cours". Valid options:
mapMetadataToGeneric flattens select options to a string array
({ options: ["En cours"] }), but getSelectOptions still expected the raw
SeaTable object form and did opts.map(o => o.name), producing
Set{undefined}. That set is non-empty, so validation ran and rejected
every value, and [undefined].join(', ') rendered an empty option list.
Broken since v1.3.0 (312daac), which changed the mapping without
updating the validator. The unit tests missed it because their fixtures
use the object form that no longer reaches production.
getSelectOptions now accepts both shapes.
Also stop add_select_options from creating duplicates: it now reads the
column's current options and skips the ones that already exist, which is
what users hit while working around the bug above.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q94wosDRhUCAx7HDAk4HU9
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.
Reported via support: every row-write tool (
add_row,append_rows,update_rows,upsert_rows) fails as soon as a single-select column is set.The list after
Valid options:is empty, option ids fail the same way, and it affects every select column in every table. Read tools are fine.Cause
Two places disagree on the shape of select options:
src/schema/map.ts:47(cleanColumnData) flattens them to a string array:{ options: ["En cours", "Reconnu"] }src/schema/validate.ts:134(getSelectOptions) expected the raw SeaTable object form and didopts.map(o => o.name)→[undefined, undefined, undefined]That yields
Set{undefined}— size 1, so thevalid.size > 0guard passes and validation runs, but nothing ever matches. And[undefined].join(', ')is"", which is why the error lists no options.Broken since v1.3.0 (312daac, 2026-03-14). Select validation landed eleven days earlier in 9b6b0cc with the object form; v1.3.0 changed the mapping and did not update the validator. The unit tests missed it because the fixtures in
tests/validate.spec.tsuse the object form that no longer reaches production code.get_schemalooks correct because it only prints the mapping and never goes throughgetSelectOptions.Changes
getSelectOptionsaccepts both shapes.tests/validate.spec.tsrun against the schema shapemapMetadataToGenericactually produces — the gap that let this through. Confirmed red before the fix, with the third reproducing the reported message verbatim.add_select_optionsno longer creates duplicates: it reads the column's current options and skips the ones that already exist. The reporter hit this while working around the bug above — the error said "unknown option", so they added an option that was already there. Newtests/addSelectOptions.spec.tscovers skipping, the no-op case, in-request duplicates and case sensitivity.322 tests pass, typecheck and lint clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q94wosDRhUCAx7HDAk4HU9