Repository navigation
#160 - Full control over the launch form fields (type, options, constraints, default) through the new form UI option - #161
Closed
clever-age-gtonon wants to merge 1 commit into
Closed
clever-age-gtonon wants to merge 1 commit into
clever-age-gtonon wants to merge 1 commit into
Conversation
…ns, constraints, default) through the new form UI option Add the `form` UI option declaring the `input` field and each context field of the launch form (type alias or FQCN, form type options with their constraints, default value), whether free context pairs are allowed, and the constraints of the whole form. Typed values are converted into process values by the new ContextValueNormalizer. Deprecate the `entrypoint_type`, `default` and `constraints` UI options (folded into `form` until 4.0). Reserve the `execution_user` context key, validate the format of the free context keys (launch form and schedules), resolve only the requested process option in ProcessConfigurationsManager and the UI options once per launch request. Require symfony/doctrine-bridge. Add documentation, an upgrade guide and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements #160: the process configuration now has full control over the UI launch form (
ui_launch_mode: form). For theinputfield and each context key, it declares the form type, its options (with the field constraints) and its default value. Example: thedelimitercontext value becomes a "Delimiter" select instead of two free text inputs.The data of the form keeps its shape (
{input, context: {key => value}}), so the dispatched message is unchanged.Changes
New
formUI option (ProcessConfigurationsManager):form.inputandform.context.<key>:type,options,default.typeis a closed list of aliases (text,choice,checkbox,integer,date,datetime,dateinterval,enum,entity…) or a form type FQCN.FormTypeInterface, and a button type are each refused with an explicitInvalidOptionsException.options.constraintsuses the same syntax as the global constraints (ConstraintLoader).data,mapped,property_pathandinherit_dataoptions are refused;default/multipleare refused on a file input;extraandexecution_userare reserved keys.form.allow_extra_context(defaulttrue): keeps the free key/value collection for the undeclared keys. Withfalse, an undeclared key in the defaults is refused at resolution.form.constraints: constraints of the whole form, as the formerconstraints.getUiOptions()returns the effectiveformoption: the deprecated format is folded into it.getLaunchFormDefaults()/buildLaunchFormDefaults().getUiOptions,getNotificationOptions,getLogsOptions) now resolves only its own option:Launch form (
LaunchType,ProcessContextType,LaunchAction):contextis now a compoundFormType: one child per declared key, then theextraCollectionTypeof the free pairs. It is merged back into{key => value}on submit, and the declared keys come first.form.constraintson[context][key]are mapped to the declared field.requiredof the declared fields is respected; the rendering of the old format is unchanged.reserved_keysoption ofProcessContextType.execution_useris always the email of the connected user:LaunchAction::dispatch()no longer lets the context override it;form.context;ProcessExecuteMessage::EXECUTION_USER_KEY, constraintProcessContextType::createExecutionUserConstraint()._,-,:, not only digits):key_constraintsoption ofProcessContextType. This also applies to the schedules (ProcessScheduleCrudController), which reserveexecution_usertoo.ui_optionsoption ofLaunchType.ContextValueNormalizer, applied after the validation. It converts the typed values into process values:BackedEnum→ value,UnitEnum→ name;DateInterval→ ISO 8601;Stringable→ string;LogicExceptionwith an explicit message.Deprecations (removal in 4.0):
entrypoint_type→form.input.type,default→form.*.default,constraints→form.constraints.InvalidOptionsException.Dependencies: require
symfony/doctrine-bridge(^6.4 || ^7.4 || ^8) for theentityalias.Documentation:
docs/reference/02-process_ui_options.md: form fields, type aliases, value conversion, free pairs, recommendation ofallow_extra_context: falsewhenform.contextis declared;docs/reference/04-process_executions_and_logs.md,05-scheduler.md,09-notifications.md;docs/cookbooks/form_file_upload.mdrewritten withform:;UPGRADE.mdv3.3 section (before/after example);Tests
403 → 588 tests (1842 assertions), with no deprecation, warning or notice (
--display-deprecations --display-warnings --display-notices).ProcessConfigurationsManagerTest:form: aliases, FQCN, invalid types, constraints, forbidden options, keys, file fields;getLaunchFormDefaults;ui/notification/logsresolutions.ContextValueNormalizerTest(new): every conversion rule and the exceptions.ProcessContextTypeTest:reserved_keys,key_constraints, key format (zz)|x|(?:zz,a/b,a b,{{x}},123… refused).LaunchTypeTest:execution_user;required;allow_extra_context: false;ui_options.Functional/LaunchActionTest:.txtrefused,,and;CSV accepted);Functional/ProcessScheduleCrudTest:execution_userrefused (422, nothing persisted);Controller/Admin/Process/LaunchActionTest(new):dispatch()keeps the email of the connected user asexecution_user.Checks
PHP 8.2 + lowestjob could not be run locally: to be confirmed by the CI.Requirements
Breaking changes
None for a configuration that keeps working with the deprecated options (minor, 3.3). Points to check when upgrading (detailed in
UPGRADE.md):launch[context][<index>]tolaunch[context][extra][<index>].contextis now aFormType(form theme blocks_launch_context_extra_entry_*).default.contextkeys: merged, the last one wins.execution_useris reserved. Existing schedules keep running, but must be renamed to be saved from the UI.notification/logsoptions: they are no longer reported by the process list, only when used (worker, purge command).🤖 Generated with Claude Code