Skip to content

fix(crud): append default opts map to varargs upsert for CRUD 1.5.0 - #101

Merged
dkasimovskiy merged 1 commit into
masterfrom
fix/crud-upsert-parse-error-3.5.0
Jun 25, 2026
Merged

dkasimovskiy merged 1 commit into
masterfrom
fix/crud-upsert-parse-error-3.5.0

Conversation

@dkasimovskiy

@dkasimovskiy dkasimovskiy commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

The varargs upsert(Options, Object...) and upsertObject(Options, Object...) overloads forwarded their arguments straight to iprotoCall, producing a 3-arg wire call crud.upsert(space, tuple, operations) with no opts table.

CRUD rock 1.5.0 (bundled with Tarantool 3.5.0) interprets that 3-arg form differently: crud/compare/conditions.lua:93 rejects the operations list with ParseConditionError: Each condition should be table, got "string" (condition 1). The 4-arg form (space, tuple, operations, opts) works because that overload delegates through toTupleOperationsOptsArgs.

Fix: append DEFAULT_UPDATE_OPTIONS.getOptions() to the argument list when the caller has not already supplied an opts map (detected by checking whether the last varargs element is a Map). The instanceof Map guard preserves the existing 4-arg call from testUpsertParameters, which deliberately passes its own options map.

Fixes TarantoolCrudClientTest#testUpsert on Tarantool 3.5.0.

I haven't forgotten about:

  • Tests
  • Changelog
  • Documentation
    • JavaDoc was written
  • Commit messages comply with the guideline
  • Cleanup the code for review. See checklist

Related issues:

@dkasimovskiy
dkasimovskiy force-pushed the fix/crud-upsert-parse-error-3.5.0 branch from 56c93ab to efcf1ca Compare June 19, 2026 11:03
@dkasimovskiy
dkasimovskiy requested a review from nickkkccc June 19, 2026 11:08
The varargs \`upsert(Options, Object...)\` and \`upsertObject(Options, Object...)\`
overloads forwarded their \`arguments\` straight to \`iprotoCall\`, producing a
3-arg wire call \`crud.upsert(space, tuple, operations)\` with no opts table.

CRUD rock 1.5.0+ (bundled with Tarantool 3.5.0) rejects that 3-arg form at
\`crud/compare/conditions.lua:93\` with \`ParseConditionError: Each condition
should be table, got "string" (condition 1)\`. The 4-arg form
\`(space, tuple, operations, opts)\` works because that overload delegates
through \`toTupleOperationsOptsArgs\`.

Fix: append \`DEFAULT_UPDATE_OPTIONS.getOptions()\` to the args when the caller
has not already supplied an opts map (last varargs element not a \`Map\`). The
guard preserves the existing 4-arg call from \`testUpsertParameters\`, which
deliberately passes its own options map.

Fixes \`TarantoolCrudClientTest#testUpsert\` on Tarantool 3.5.0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dkasimovskiy
dkasimovskiy force-pushed the fix/crud-upsert-parse-error-3.5.0 branch from efcf1ca to 1183448 Compare June 25, 2026 06:49
@dkasimovskiy
dkasimovskiy requested review from Alex-pvl and ArtDu and removed request for Alex-pvl and nickkkccc June 25, 2026 08:25
@dkasimovskiy
dkasimovskiy marked this pull request as ready for review June 25, 2026 08:26
@dkasimovskiy
dkasimovskiy merged commit 276603b into master Jun 25, 2026
10 of 11 checks passed
@dkasimovskiy
dkasimovskiy deleted the fix/crud-upsert-parse-error-3.5.0 branch June 25, 2026 08:38
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.

2 participants