Skip to content

feat(frontend): add UDF parameters from the panel - #7551

Open
carloea2 wants to merge 8 commits into
apache:mainfrom
carloea2:feat/frontend-udf-param-insert
Open

feat(frontend): add UDF parameters from the panel#7551
carloea2 wants to merge 8 commits into
apache:mainfrom
carloea2:feat/frontend-udf-param-insert

Conversation

@carloea2

@carloea2 carloea2 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
image image

What changes were proposed in this PR?

This PR lets users add Python UDF parameters directly from the properties panel.

The parameter list now includes a dashed Add parameter button. Clicking it opens an inline draft row where the user can enter a name, select a supported type, and confirm with the check button or Enter, or cancel with the close button or Escape.

Confirming the draft inserts a self.UiParameter(...) declaration into the operator's shared Python code. The code remains the single source of truth: the parameter row appears through the existing parse-and-sync flow instead of being written directly into the form model.

The insertion logic:

  • groups new declarations with existing UiParameter declarations;
  • inserts into an existing open() method when available;
  • creates open() when it is absent;
  • handles docstrings, decorators, pass, comments, and empty class bodies;
  • converts display names into safe Python assignment targets while preserving the exact parameter name;
  • rejects missing names, duplicate declarations, unsupported types, and unsupported UDF code shapes.

Any related issues, documentation, discussions?

Closes #7552

How was this PR tested?

Manual verification by the author covered the add, confirm/cancel, declaration insertion, and properties-panel synchronization flows.

Frontend CI formatting and lint:

cd frontend
yarn format:ci

The command passes.

The updated specifications cover component actions and error states, shared-code insertion and synchronization, declaration placement, identifier sanitization, duplicate names, unsupported types, unsupported classes, and malformed class bodies.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code Fable 5 Ultra, OpenAI Codex 5.6 Ultra, and Me

…anel

Adding a parameter in the Python UDF properties panel now writes the
self.UiParameter(...) declaration into the code, creating open() when
the UDF class does not define one. The code stays the single source of
truth: the add action only edits the shared Y.Text code buffer and the
row appears through the existing parse/merge sync loop.
…r declarations

A template whose statements are still commented out parses as a class
body holding only comments and a lezer error node. The error node was
treated as an anchor statement, so the synthesized open() landed at
module level at the end of the file. Filter error nodes out and, when a
class or open() body has no real statements yet, insert right after the
header line with one extra indent level.
…t rule

All placement cases (docstrings, decorators, pass-only, commented-out,
and empty bodies) collapse into a single rule shared by class and
open(): insert before the first real statement, or right after the
header line when the body has none yet. parse() and the insertion share
the class discovery and call traversal, and the add form becomes a
single always-visible row with the name validation living only in the
parser.
…d tables

Each placement case is now a single annotated file where '>' marks the
inserted lines, so input and expected output are derived from one copy;
every case re-parses its result, absorbing the separate round-trip
tests. The redundant undecorated-open case and duplicated fixtures are
gone.
The standalone name/type/Add strip read as another parameter row. It is
now a dashed 'Add parameter' button under the list that opens a draft
row in the same three-column grid, confirmed with a check button or
Enter and dismissed with close or Escape.
@carloea2
carloea2 marked this pull request as ready for review August 11, 2026 08:12
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@github-actions github-actions Bot added feature frontend Changes related to the frontend GUI labels Aug 11, 2026
@codecov-commenter

codecov-commenter commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.58824% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.83%. Comparing base (cb6e5c6) to head (cf13cb3).

Files with missing lines Patch % Lines
...ui-udf-parameters/ui-udf-parameters.component.html 0.00% 28 Missing ⚠️
...ce/code-editor/ui-udf-parameters-parser.service.ts 92.42% 0 Missing and 5 partials ⚠️
...t/ui-udf-parameters/ui-udf-parameters.component.ts 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7551      +/-   ##
============================================
- Coverage     87.87%   87.83%   -0.05%     
  Complexity     4275     4275              
============================================
  Files          1176     1176              
  Lines         46890    46981      +91     
  Branches       5228     5247      +19     
============================================
+ Hits          41205    41265      +60     
- Misses         3961     3987      +26     
- Partials       1724     1729       +5     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 686aedb
agent-service 98.62% <ø> (ø) Carriedforward from 686aedb
amber 82.87% <ø> (ø) Carriedforward from 686aedb
computing-unit-managing-service 60.38% <ø> (ø) Carriedforward from 686aedb
config-service 65.97% <ø> (ø) Carriedforward from 686aedb
file-service 69.05% <ø> (ø) Carriedforward from 686aedb
frontend 89.83% <70.58%> (-0.12%) ⬇️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 686aedb
pyamber 97.52% <ø> (+0.04%) ⬆️ Carriedforward from 686aedb
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 686aedb

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@carloea2

Copy link
Copy Markdown
Contributor Author

@aicam can you review it?

@carloea2

Copy link
Copy Markdown
Contributor Author

/request-review @aicam

@github-actions
github-actions Bot requested a review from aicam August 11, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UDF parameters from the properties panel

2 participants