Skip to content

Fix single-select write validation rejecting every option (v1.6.2) - #6

Merged
christophdb merged 1 commit into
mainfrom
fix/single-select-option-validation
Sep 4, 2026
Merged

christophdb merged 1 commit into
mainfrom
fix/single-select-option-validation

Conversation

@christophdb

Copy link
Copy Markdown
Member

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.

Column "Statut": unknown option "En cours". Valid options:

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 did opts.map(o => o.name)[undefined, undefined, undefined]

That yields Set{undefined} — size 1, so the valid.size > 0 guard 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.ts use the object form that no longer reaches production code.

get_schema looks correct because it only prints the mapping and never goes through getSelectOptions.

Changes

  • getSelectOptions accepts both shapes.
  • Three regression tests in tests/validate.spec.ts run against the schema shape mapMetadataToGeneric actually produces — the gap that let this through. Confirmed red before the fix, with the third reproducing the reported message verbatim.
  • add_select_options no 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. New tests/addSelectOptions.spec.ts covers skipping, the no-op case, in-request duplicates and case sensitivity.
  • Version bumped to 1.6.2, README note on the tool.

322 tests pass, typecheck and lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q94wosDRhUCAx7HDAk4HU9

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
@christophdb
christophdb merged commit 4f6dd1b into main Sep 4, 2026
4 checks passed
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