yangzhang75 opened a new pull request, #9504: URL: https://github.com/apache/texera/pull/9504
### What changes were proposed in this PR? Closes #ISSUE. 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). Adding a keyword to an existing declaration -- `, value=` typed after the type, with the closing paren the editor put there already, so the code reads `value=)` for a moment -- made the parameter's row vanish from the property panel, and the value filled in for it went with it: lezer puts its error node (`⚠`) where the value will go, `readUiParameterArgument` could not read it, and `readCall` then discarded the whole parameter rather than the unfinished argument. The sync rebuilt the rows from that parse and the panel wrote them back without the row; backing the edit out brought the row back empty. - `python-ui-udf-parameters-parser.ts`: in `readUiParameterArguments`, an argument whose value is lezer's error node is left out rather than failing the call; its keyword still counts as a named argument, so a positional after it is refused as it always was (`name=, "x", type=...` stays rejected). The complete arguments are read, the unfinished one is not, and the parameter stands while it still has a name and a type. - What the parser rejects is unchanged: a complete but wrong argument (`value=Resource.MO`, a type that is not an `AttributeType` member, a positional after a named one, a duplicate argument) still discards the parameter, as the existing tests pin. This is about syntax that is not there yet, not about a wrong one -- which also bounds the fix: while the value token itself is being typed (`value=R` ... `value=Resource.MODE`), the row still goes until the token is complete, since a half-typed token reads the same as a wrong one. A trailing comma before the closing paren is valid Python and never dropped the row; a declaration whose paren is missing altogether swallows the method below it into its argument list and is dropped before and after, out of scope here. The R parser has its own argument reader and the equivalent gap (`value=` with nothing after it drops the declaration there too); it is not touched here and goes to its own issue. #### Video **Before** <!-- before video --> **After** <!-- after video --> ### Any related issues, documentation, discussions? Closes #ISSUE. Found while building the UDF parameter pickers (#9338); independent of them and of #8846. ### How was this PR tested? - `ui-udf-parameters-parser.service.spec.ts`: a declaration with a keyword typed up to its `=`, the closing paren in place and a method following, parses to the one parameter it still names, through the real lezer parser; a positional after a keyword that has no value yet is still refused. Deletion-checked: without the skip the first assertion fails (and the sync case below); with the unfinished keyword not counted as named, the second fails. The existing tests pin the boundary (an unknown resource, a plain-string type, a positional after a named argument, a duplicated argument are still rejected). - `ui-udf-parameters-sync.service.spec.ts`: a Python case with the real parser -- a stored row with a value, the same declaration with `value=)` typed into it -- emits no change, so the row and its value stand. - Measured by running the parser on `main`: `self.UiParameter(name="threshold", type=AttributeType.DOUBLE, value=)` parses to no parameters; with this change it parses to `threshold: double`. - The full frontend suite, eslint, prettier and the production (AOT) build pass. ### Was this PR authored or co-authored using generative AI tooling? Yes. Generated-by: Claude Code (Claude Fable 5.1, Anthropic). Co-authored with Claude, reviewed line by line by the author before submission. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
