Skip to content

Make find_rows and row ID tools report what really happened (v1.9.5) - #27

Merged
christophdb merged 7 commits into
mainfrom
fix-find-rows-string-where
Nov 6, 2026
Merged

christophdb merged 7 commits into
mainfrom
fix-find-rows-string-where

Conversation

@christophdb

Copy link
Copy Markdown
Member

Summary

Several tools answered as if all was well when a request couldn't be applied. "0 rows" or "success" reads like a fact, so a model passed it on or went searching elsewhere. In the case that started this, a model passed where as a JSON string, got 0 rows, and then read other tables: 8 tool calls for one question.

The rule now: what the server can read clearly, it repairs. What would be a guess, it reports.

find_rows filters

  • Repaired: a JSON string, {Name: {eq: "x"}}, {Betrag: {gt: 1, lt: 9}}, {eq: {column: "Name", value: "x"}}, {eq: {Name: "x"}}, {eq: ["Name", "x"]}, aliases such as =, EQ, not_in and is_not_null, several operators next to each other, a list as a value.
  • The case of a column and SQL quotes around it are corrected if only one column fits, with a notice.
  • Reported: a typo in a column (with the list of columns), an unknown operator, a missing field or value, an object as a value.

find_rows comparisons (all gave wrong results before, not just missing ones)

  • Betrag > "10" compared as text and also returned 9.49. Plain numbers in text now compare as numbers, and ne no longer matches every row.
  • Betrag < 10 also returned rows without a value. Empty cells now match no ordering, like SQL.
  • The API returns dates with a time, so = "2026-08-05" found nothing and <= and > were off by a day. A plain date now compares with the day of the cell.
  • >= "01.08.2026" returned every row with a date. On date columns this is now an error naming YYYY-MM-DD, as the meaning depends on the locale.

Row IDs

  • delete_rows reported the number of IDs it was given, also if nothing was deleted. It now reports SeaTable's deleted_rows, and no success if an ID matched nothing.
  • unlink_rows no longer reports success if no link was removed.
  • get_row_activities answered the same for a wrong ID and for a row past the retention period. It now looks up the row on an empty result: a wrong ID is an error, an existing row gets a notice that names no period, as the retention period varies.
  • All tools that take a row ID say it is the internal _id and how to find it, and the server adds this to SeaTable's errors for an unknown row.

Behaviour changes

  • find_rows returns errors for filters that used to return 0 rows, and different rows for the comparisons above.
  • delete_rows and unlink_rows can return success: false.
  • Tool descriptions grow by about 40 tokens per tool that takes a row ID, and get_row_activities makes one more call on an empty result.
  • No changes to configuration or docker-compose.yml.

Test plan

  • Unit tests (563 passing), tests/rowLookup.spec.ts written first and seen failing
  • Typecheck, ESLint and build
  • Against a test base on SeaTable Cloud, tools called directly: filters, comparisons, wrong IDs on read and write tools, real and repeated deletes, link and unlink. Row counts and links unchanged afterwards
  • Date comparisons on three date columns and number comparisons return the same as query_sql
  • docs/testing-with-models.md with a real model: not run yet. It needs a deployed image, for example from a testing-v1.9.5 tag. Whether the number of tool calls really drops is not shown yet
  • Self-hosted SeaTable: not tested. Error wordings may differ there, then the row ID note is missing from the error. Without deleted_rows, delete_rows reports the number of IDs as before
  • Multi-base mode: not tested separately

Known limitations

  • upload_file was called once with a wrong ID on the test base. It returned an error, but whether a file stayed behind in the asset storage wasn't checked.
  • A filter value with a time, such as 2026-08-05T23:00, still compares as text, so a different time zone offset can shift it.
  • search_rows, upsert_rows and add_row were not changed.
  • Wrong argument types in other tools, such as text instead of a list for row_ids, still end in a format error. They aren't silent, and repairing them centrally would be a separate PR.

🤖 Generated with Claude Code

christophdb and others added 7 commits November 6, 2026 11:38
A model passed where as a JSON string. normalizeWhere let it through,
evalWhere then rejected every row, and the empty result read like a real
answer: the model went on to search other tables. A JSON string now counts as
the object it contains, and anything else that isn't an object is an error.

The same request started with get_row and an auto-number value as row_id.
Its description now says that row_id is the internal _id and how to find it
by a column value, and so does the error from SeaTable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A malformed condition or an unknown column also matched no row without a
word. find_rows now reports unknown operators, missing fields or values, an
empty "or" and unknown columns in where and order_by, naming the existing
columns. A column only the rows know still counts, as the metadata is cached.

All tools that take a row ID now say that it is the internal _id and how to
find it, and the server adds the same note to SeaTable's error for an unknown
row instead of get_row alone.

Checked against a real base: the note, a where passed as a string, an unknown
column and is_null on a real column behave as intended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SeaTable answers with an empty list for an ID that doesn't exist, and for a
row whose activities are past its retention period. A model could read either
as "never changed". An empty result now looks up the row: a wrong ID is an
error, and an existing row gets a notice. The notice names no period, as the
retention period varies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Models often send values as text, and find_rows compared them strictly or as
text. On a real base, Betrag > "10" returned 11 rows instead of 7, including
one of 9.49, and != matched every row. A number cell now reads a plain number
in text as a number, a text cell matches a number with the same text, and a
checkbox matches the words true and false. "55,99" stays no number, as it
could mean several things.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Betrag < 10 also returned the rows without a Betrag, as an empty cell counted
as smaller than everything. On a real base, find_rows returned four rows more
than the same query_sql. gt, gte, lt and lte now match no empty cell, like SQL.
Sorting by order_by and finding empty cells with is_null stay as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Filters of the wrong shape either cost a round or matched nothing without a
word, such as an operator object under a column. normalizeWhere now reads the
forms models send as long as the meaning is clear: operators under a column,
column or the column name instead of field, aliases, several operators next to
each other, a list as a value. The case of a column is corrected if only one
fits, with a notice. A typo, an unknown operator or a missing field stays an
error, as a repair would be a guess.

delete_rows reported the number of IDs it was given, also for IDs that matched
no row. It now reports SeaTable's count and no success if an ID matched nothing.
unlink_rows no longer reports success if no link was removed. The row ID note
also covers the other wordings SeaTable uses per endpoint.

Checked against a real base, including the write tools with wrong IDs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API returns dates with a time, such as 2026-08-05T00:00:00+02:00. As text,
that never equals 2026-08-05 and is greater than it, so = found nothing and
<= and > were off by a day. A plain date now compares with the day of the cell.

A date in another format compared as text too: >= "01.08.2026" returned every
row with a date. On date columns this is now an error naming YYYY-MM-DD, as the
meaning of such a date depends on the locale.

Checked against a real base: all comparisons on three date columns return the
same as the query in SQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@christophdb
christophdb merged commit 41d5033 into main Nov 6, 2026
5 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