-
Notifications
You must be signed in to change notification settings - Fork 9
feat: split tql mutation machine #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β Changes requested. Reviewed everything up to b7b7194 in 28 seconds
More details
- Looked at
359lines of code in4files - Skipped
0files when reviewing. - Skipped posting
0drafted comments based on config settings.
Workflow ID: wflow_3FKcWeFCV19yohj6
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
| } | ||
|
|
||
| throw new Error(`Unsupported DB "${a.db}"`); | ||
| throw new Error(`Unsupported DB "${JSON.stringify(a, null, 2)}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message on line 137 could potentially expose sensitive information by converting the adapter object to a string. Consider revising the error message to be more generic or to only include necessary details.
| throw new Error(`Unsupported DB "${JSON.stringify(a, null, 2)}"`); | |
| throw new Error(`Unsupported DB type: ${a.db}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Looks good to me! Incremental review on 4e106d6 in 46 seconds
More details
- Looked at
611lines of code in11files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. src/stateMachine/mutation/surql/run.ts:12
- Draft comment:
Consider removing or securing the logging of sensitive data in production environments to prevent potential data exposure. - Reason this comment was not posted:
Confidence of 0% on close inspection, compared to threshold of 50%.
Workflow ID: wflow_NtZN2sXWNI2ViOHN
You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β Changes requested. Incremental review on 160fdf8 in 1 minute and 27 seconds
More details
- Looked at
1428lines of code in19files - Skipped
0files when reviewing. - Skipped posting
0drafted comments based on config settings.
Workflow ID: wflow_VDfMMvPtQoR050pY
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
| const fields = [...dataFields, ...linkFields, ...roleFields]; | ||
| const fieldsString = fields.length ? `SET ${fields.join(', ')}` : ''; | ||
|
|
||
| return `{ LET ${$var} = ${op} ONLY ${tableName}:β¨${idValue}β© ${fieldsString} RETURN {${restString}} as input, $before as before, $after as after, {${metaString},'$id': meta::id(id),'id': meta::id(id)} as meta, id as sid; CREATE ONLY Delta SET bzId = β¨${block.$bzId}β©, result = ${$var}; ${level !== 0 ? `RETURN ${$var}.sid` : ''}; }` as string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RETURN statement should be outside of the LET block to ensure it is part of the main query flow. This is crucial for the correct execution of the SurrealDB query.
| return `{ LET ${$var} = ${op} ONLY ${tableName}:β¨${idValue}β© ${fieldsString} RETURN {${restString}} as input, $before as before, $after as after, {${metaString},'$id': meta::id(id),'id': meta::id(id)} as meta, id as sid; CREATE ONLY Delta SET bzId = β¨${block.$bzId}β©, result = ${$var}; ${level !== 0 ? `RETURN ${$var}.sid` : ''}; }` as string; | |
| return `{ LET ${$var} = ${op} ONLY ${tableName}:β¨${idValue}β© ${fieldsString} RETURN {${restString}} as input, $before as before, $after as after, {${metaString},'$id': meta::id(id),'id': meta::id(id)} as meta, id as sid; CREATE ONLY Delta SET bzId = β¨${block.$bzId}β©, result = ${$var}; } RETURN ${$var}.sid;` as string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Looks good to me! Incremental review on bb784bd in 1 minute and 13 seconds
More details
- Looked at
1418lines of code in9files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. src/adapters/surrealDB/filters/filters.ts:6
- Draft comment:
TheparseFilterfunction is well-implemented with comprehensive handling of various filter types and recursive transformation for nested filters. It correctly adapts filters to the syntax and capabilities of SurrealDB, ensuring accurate query operations. - Reason this comment was not posted:
Confidence changes required:0%
TheparseFilterfunction infilters.tsis designed to transform filters from one format to another, specifically for use with SurrealDB. It handles various logical operators and ensures that filters are correctly formatted for SurrealDB's query language. The function recursively handles nested filters and applies transformations such as renaming$notto$!and handling$idspecifically to use SurrealDB'smeta::id(id)syntax. The function also handles different field types, including data fields, link fields, and role fields, ensuring that the correct filter format is used based on the field type and schema information.
The function is complex due to its recursive nature and the variety of filter transformations it supports. It is crucial for ensuring that filters are correctly applied in queries to SurrealDB, which can affect the accuracy and security of data retrieval in applications using this database.
Workflow ID: wflow_MHDVn0dnBOylIoVx
You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Looks good to me! Incremental review on 1b66aef in 49 seconds
More details
- Looked at
4152lines of code in34files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. tests/unit/queries/query.ts:1592
- Draft comment:
The test case 'i2[inherited, attributes]' is marked as TODO{TS}, but it seems to be implemented and working. Consider removing the TODO marker. - Reason this comment was not posted:
Confidence changes required:50%
The test case 'i2[inherited, attributes]' is marked as TODO{TS}, indicating it is not yet implemented or is expected to fail. However, the test case is already implemented and seems to be checking for inherited attributes correctly. The TODO marker should be removed to reflect the current state of the test.
Workflow ID: wflow_djJHbhRHDghsO555
You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Looks good to me! Incremental review on c996e81 in 49 seconds
More details
- Looked at
381lines of code in10files - Skipped
0files when reviewing. - Skipped posting
4drafted comments based on config settings.
1. src/helpers.ts:366
- Draft comment:
Usingconsole.warninstead ofthrow new Errorfor schema issues might lead to silent failures or unnoticed issues in production. Consider handling these cases explicitly. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment is relevant to a change made in the diff, specifically the replacement ofthrow new Errorwithconsole.warn. This change could indeed lead to issues being less noticeable, which is a valid concern. The comment is actionable as it suggests reconsidering the use ofconsole.warn.
The comment could be seen as speculative since it assumes that the change will lead to silent failures without knowing the context of how warnings are handled in the application.
The concern about silent failures is valid, especially in production environments where warnings might not be logged or monitored as closely as errors.
Keep the comment as it addresses a potential issue introduced by the code change and is actionable.
2. src/helpers.ts:406
- Draft comment:
Usingconsole.warninstead ofthrow new Errorfor schema issues might lead to silent failures or unnoticed issues in production. Consider handling these cases explicitly. - Reason this comment was not posted:
Marked as duplicate.
3. src/stateMachine/mutation/bql/stringify.ts:80
- Draft comment:
Usingconsole.warninstead ofthrow new Errorfor schema issues might lead to silent failures or unnoticed issues in production. Consider handling these cases explicitly. - Reason this comment was not posted:
Marked as duplicate.
4. src/stateMachine/mutation/bql/parse.ts:462
- Draft comment:
Usingconsole.warninstead ofthrow new Errorfor schema issues might lead to silent failures or unnoticed issues in production. Consider handling these cases explicitly. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_VnTh5N2FhyjlZFW0
You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Looks good to me! Incremental review on 6f7bfa9 in 14 seconds
More details
- Looked at
137lines of code in3files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. changelog.md:5
- Draft comment:
The changelog entry for version 0.11.0 is vague. Consider providing more details about the changes, such as the refactoring of the mutation machine and the introduction of the SurrealDB mutation machine. - Reason this comment was not posted:
Confidence changes required:50%
The changelog entry for version 0.11.0 is missing a detailed description of the changes made in this PR. It only mentions 'Working queries and basic mutations for surrealDB', which is vague.
Workflow ID: wflow_keA3LeimRlyi3xws
You can customize Ellipsis with π / π feedback, review rules, user-specific overrides, quiet mode, and more.
Summary:
Refactored mutation machine to separate TQL and SurrealDB logic, enhancing maintainability and error handling.
Key points:
src/stateMachine/mutation/tql/machine.ts.src/stateMachine/mutation/surql/machine.ts.MachineContextinsrc/stateMachine/mutation/mutationMachine.tsto remove TQL-specific fields.runTypeDbMutationMachineandrunSurrealDbMutationMachineinsrc/stateMachine/mutation/mutationMachine.ts.buildTQLMutationinsrc/stateMachine/mutation/tql/build.tsfor validation and error handling.buildSURQLMutationinsrc/stateMachine/mutation/surql/build.tsfor validation and error handling.src/stateMachine/query/queryMachine.tsto handle new mutation machines.package.jsonfor SurrealDB mutations.tests/unit/mutations/basic.tsto include tests for new mutation structure.Generated with β€οΈ by ellipsis.dev