yangzhang75 opened a new issue, #9500: URL: https://github.com/apache/texera/issues/9500
### What happened? A Python UDF declares its UI parameters in code (`self.UiParameter(name="threshold", type=AttributeType.DOUBLE)`); the frontend parses the code and keeps the operator's `uiParameters` rows in step with it, carrying each row's value over by name and resource kind (`UiUdfParametersSyncService.syncStructureFromCode`, 200 ms after each edit). While an existing declaration is being edited and its argument list is momentarily unclosed -- a trailing comma typed after `type=AttributeType.DOUBLE`, the moment before the next argument, or a keyword typed up to its `=` -- the row for that parameter disappears from the property panel, and the value the user had filled in for it is gone with it. Backing the edit out (deleting the comma) brings the row back, with an empty value. Cause: lezer recovers from the incomplete call by leaving an error node (`⚠`) inside the call's argument list. `readArguments` (`python-ui-udf-parameters-parser.ts`) filters only `(`, `)` and `,` out of the list, so the error node is read as an argument: a positional one after the named ones (`readUiParameterArguments` returns `undefined` for that) or the value of the keyword being typed (`readUiParameterArgument` returns `undefined`). Either way `readCall` returns `undefined` and the whole parameter is discarded -- not the unfinished argument, the parameter. The sync then rebuilds the rows from that parse, so the row is absent and its value is not carried over; with the property panel open on the operator, the panel writes the rebuilt rows back to `uiParameters` (`operator-property-edit-frame.component.ts`), and the value is lost. Measured with the parser on main: a body of `self.UiParameter(name="threshold", type=AttributeType.DOUBLE, ` parses to no parameters at all; so does `... DOUBLE, value=`. Starting a second declaration on the next line keeps the first one, so this is about editing an existing declaration. **Expected:** a declaration being edited keeps its row, and the row keeps its value, for as long as the readable part of the declaration still names the parameter: the complete arguments are read, the unfinished one is not, and the row stands while it still has a name and a type. ### How to reproduce? 1. Add a Python UDF with `self.UiParameter(name="threshold", type=AttributeType.DOUBLE)` in `__init__`, open the operator's property panel (keep it open), and type a value (say `0.5`) into the parameter's Value cell. 2. In the code editor, put the cursor after `AttributeType.DOUBLE` and type `, ` (a comma and a space), as if about to add another argument. 3. Watch the parameter table in the panel: after ~200 ms the `threshold` row is gone. 4. Delete the comma again: the row comes back with an empty value. ### Version/Branch 1.4.0-incubating-SNAPSHOT (main) ### Commit Hash (Optional) _No response_ ### What browsers are you seeing the problem on? _No response_ ### Relevant log output ```shell ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
