Skip to content

Conversation

@lveillard
Copy link
Member

@lveillard lveillard commented Aug 18, 2025

Important

Enhance buildSURQLMutation to handle $tempId in metadata, update Docker command to --strict mode, and add test cases for mutation outputs with $fields.

  • Mutation Building:
    • In build.ts, buildSURQLMutation now processes $tempId in metadata, converting it to '_:' format.
    • Updates OUTPUT string to include metaString with $tempId handling.
  • Testing:
    • In test.sh, Docker command updated to use --strict mode for SurrealDB.
    • Adds two skipped test cases in basic.ts to test mutation outputs with $fields.
  • Misc:
    • Minor logging additions in basic.ts for debugging purposes.

This description was created by Ellipsis for fd0e38b. You can customize this summary. It will automatically update as commits are pushed.

const metaString = Object.entries(meta)
.map(([key, value]) => (key === '$tempId' ? `'$tempId': '_:${value}'` : `'${key}': '${value}'`))
.join(',');
const OUTPUT = `(CREATE ONLY Delta SET input = ${restString}, meta = {${metaString}, "$sid": $parent.id, "$id": record::id($parent.id)}, after = $after, before = $before RETURN VALUE $parent.id )`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid SURQL Query Syntax with Empty Meta

The generated SURQL query contains invalid syntax in the meta object when no $-prefixed keys are present in the input block. This results in a leading comma, like meta = {, ...}, which causes a syntax error when the query is executed.

Fix in Cursor Fix in Web

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed everything up to fd0e38b in 3 minutes and 34 seconds. Click for details.
  • Reviewed 208 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 draft 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.
1. tests/test.sh:18
  • Draft comment:
    Typo in comment: 'argumentsppa' should be 'arguments'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. tests/unit/mutations/basic.ts:1008
  • Draft comment:
    Error message mismatch: this check verifies 'secondUser.id', so the thrown error message should reference 'secondUser.id' not 'firstUser.id'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. tests/unit/mutations/basic.ts:2507
  • Draft comment:
    Entity type mismatch in cleanup for enum1 test: A Company is created but deletion is performed with $entity: 'Hook'. Update to use 'Company'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. tests/unit/mutations/basic.ts:2580
  • Draft comment:
    Remove debug logging: Consider removing the console.log ('RES!', mutationResult) unless needed for diagnosing failures.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While removing debug logging is generally good practice, this is in a test file and the test is marked as skipped (it.skip). The console.log may be intentionally left in to help debug the test when it's unskipped. Test files often keep debug logging commented out or wrapped in conditionals for future debugging. The comment is technically correct that debug logging should be removed, but it may be too aggressive in a test context where debug logging can be valuable. The test being skipped suggests it's still under development. Given that this is a skipped test that appears to be under development, the console.log may be intentionally left in for debugging purposes when the test is ready to be enabled. The comment should be deleted since this is a skipped test under development where debug logging may be intentionally left in for future use.
5. tests/unit/mutations/basic.ts:2433
  • Draft comment:
    Remove debug logging from error catch: The console.log('log', err) inside the pf4 test may be removed or replaced with proper test error assertions.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. src/stateMachine/mutation/surql/build.ts:10
  • Draft comment:
    Consider refactoring inner functions: Functions like buildThings, buildEdges, buildArcs, and buildReferences are defined inside buildSURQLMutation. Moving them outside (and passing necessary parameters) may improve clarity and testability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
7. tests/unit/mutations/basic.ts:1160
  • Draft comment:
    Consider refactoring repetitive cleanup logic: Several tests perform similar cleanup mutations. Extracting common cleanup routines could reduce code duplication.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_LwC4tTgXaRNJYpnD

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

],
});

console.log('BFI2 MUTATION RESULT:', deepSort(mutationResult, 'id'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debug logging: Remove the console.log in the pf2 test (BFI2 MUTATION RESULT) if not needed.

Suggested change
console.log('BFI2 MUTATION RESULT:', deepSort(mutationResult, 'id'));

{
$relation: 'UserTag',
$op: 'delete',
$id: ['bfi2-test-tag', 'bfi2-test-tag-1', 'bfi2-test-tag-2'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that the deletion array includes the id 'bfi2-test-tag', but only 'bfi2-test-tag-1' and 'bfi2-test-tag-2' are created. Is 'bfi2-test-tag' a typo, and should it be removed or corrected?

Suggested change
$id: ['bfi2-test-tag', 'bfi2-test-tag-1', 'bfi2-test-tag-2'],
$id: ['bfi2-test-tag-1', 'bfi2-test-tag-2'],

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