Fix: Flex field with object value threw an error#119
Conversation
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 1538075 in 19 seconds. Click for details.
- Reviewed
44lines of code in1files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_LUsSkldzNAHqw7OD
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/stateMachine/mutation/surql/build.ts">
<violation number="1" location="src/stateMachine/mutation/surql/build.ts:332">
P2: Non-variable FLEX values are inserted into the SurQL array without serialization, so object values will stringify to "[object Object]" (and plain strings become unquoted identifiers). Use the FLEX serializer (e.g., parseFlexValSurrealDB) for non-$ elements before joining so object values are preserved.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| } | ||
| return el; | ||
| }); | ||
| return `${rf} = [${processedElements.join(', ')}]`; |
There was a problem hiding this comment.
P2: Non-variable FLEX values are inserted into the SurQL array without serialization, so object values will stringify to "[object Object]" (and plain strings become unquoted identifiers). Use the FLEX serializer (e.g., parseFlexValSurrealDB) for non-$ elements before joining so object values are preserved.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/stateMachine/mutation/surql/build.ts, line 332:
<comment>Non-variable FLEX values are inserted into the SurQL array without serialization, so object values will stringify to "[object Object]" (and plain strings become unquoted identifiers). Use the FLEX serializer (e.g., parseFlexValSurrealDB) for non-$ elements before joining so object values are preserved.</comment>
<file context>
@@ -317,7 +317,19 @@ export const buildSURQLMutation = async (flat: FlatBqlMutation, schema: Enriched
+ }
+ return el;
+ });
+ return `${rf} = [${processedElements.join(', ')}]`;
}
</file context>
There was a problem hiding this comment.
block[rf] is either a string or a string array. Example of block:
{
'$thingType': 'relation',
'$op': 'replace',
'$bzId': 'R_5WUuSigSeWgZOENaOlbnV',
'$thing': 'FlexRefRel',
flexReferences: [ '{"msg":"Hello, world!"}' ],
[Symbol(stepPrint)]: Set(1) { 'clean' }
}There was a problem hiding this comment.
Thanks for the feedback! I've saved this as a new learning to improve future reviews.
…9.15.4 Co-authored-by: Cursor <cursoragent@cursor.com>
We should be able to set object value for a FLEX field. But currently it throws an error.
In the monorepo it threw this error:
In the new BORM test it throws this error:
Summary by cubic
Fixes errors when storing plain objects and nested arrays in FLEX ref fields. FlexRefRel.flexReferences now accepts objects and arrays-of-objects, and values round-trip correctly.
Bug Fixes
Dependencies
Written for commit 1289b86. Summary will update on new commits.
Important
Adds a test in
refFields.tsto verify FLEX fields can accept object values without errors.fl8:[flex, object]inrefFields.tsto verify thatflexReferencescan accept objects.flexReferencesdo not trigger errors related to$thingorrefFields.flexReferencescan store objects like{ msg: 'Hello, world!' }without errors.This description was created by
for 1538075. You can customize this summary. It will automatically update as commits are pushed.