Skip to content

v5.4

Choose a tag to compare

@njoubert-cleverage njoubert-cleverage released this 21 Oct 12:36
· 86 commits to main since this release

Changes

  • #320 README: add an installation section (composer require, bundle registration without Symfony Flex), linking to the quick start.
  • #319 Composer: require PHP ^8.2 instead of >=8.2 (PHP 9 is no longer accepted before being tested), remove the authorization of the symfony/flex plugin, which is not required (the CI installs it globally).
  • #318 CommandRunnerTask, ProcessLauncherTask and SubprocessInstance receive the project directory, the path of the console and the environment (%kernel.project_dir%, %kernel.environment%) instead of the kernel: passing a KernelInterface is deprecated, the arguments will only accept strings in v6.0. SubprocessInstance writes the JSON buffer of ProcessLauncherTask (json_buffering) in the system temporary directory instead of var/ of the project (which may be read-only), no longer creates the unused <log dir>/process directory, and omits --env when no environment is given (default environment of the console). Update documentation, add tests.
  • #317 The bundle throws exceptions implementing ProcessExceptionInterface instead of raw SPL exceptions (124 throw): new Exception\UnexpectedValueException, RuntimeException, InvalidArgumentException and LogicException, extending the SPL exceptions thrown before (same messages, the existing catch keep working). All the errors of the bundle can be caught with ProcessExceptionInterface, except the exceptions of the Symfony components. Update documentation, add tests.
  • #311 Deprecate the cleverage_process.event_listener.data_queue service and DataQueueEventListener (it keeps a copy of the ProcessState of every cleverage_process.data_queue event in memory, without limit): injecting or fetching the service triggers a deprecation, they will be removed in v6.0. Write your own listener of the event dispatched by the event_dispatcher task. Update documentation, add tests.
  • #312 Add read-only interfaces for the process manager and the registries, implemented by the existing classes and autowired by their interface: ProcessManagerInterface (execute()), ProcessConfigurationRegistryInterface (getProcessConfiguration(), getProcessConfigurations(), hasProcessConfiguration()), TransformerRegistryInterface (getTransformer(), getTransformers(), hasTransformer()) and TaskRegistryInterface (getTask()). Type your services on them: the classes will be final in v6.0 (the services of the bundle will then be typed on the interfaces). Update documentation, add tests.
  • #310 Process configuration tree: a task error_strategy other than skip or stop is deprecated (notice when the container is compiled; it was accepted and the process failed with "Unknown error strategy" when the task failed), it will be rejected in v6.0. The process public key is a boolean node: a non-boolean value is rejected when the container is compiled, instead of a TypeError when the configuration is built. Describe the nodes of the process, task and generic transformer configurations (config:dump-reference clever_age_process). Update documentation, add tests.
  • #309 Composer: ext-intl is no longer required, it is suggested: it is only needed by the slugify transformer (SlugifyTransformer), which is replaced by a service failing with an explicit message when the extension is missing (UnavailableServicesCompilerPass). Update documentation, add tests.
  • #305 Bundle best practices, residues: the generic transformers are no longer autowired (explicit arguments). ProcessHelpCommand receives the TaskRegistry instead of the service container (passing a container is deprecated). Fetching from the service container a task of the application made public by the TaskInterface autoconfiguration is deprecated (container.private tag, new internal PublicTaskDeprecationCompilerPass); the tasks made public by the application itself are not concerned. Trigger the missing deprecation notices: CheckSerializerCompilerPass, errors task configuration key (use error_outputs). TaskConfiguration::getErrors() triggers a single notice on PHP 8.4+. CleverAgeProcessBundle is marked @final since 5.4. Update documentation, add tests.
  • #299 Require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85: the functions of PHP 8.3 to 8.5 can be used while supporting PHP 8.2. Rector targets PHP 8.2 (withPhpVersion(), withPhpSets() read from composer.json) and applies the rules using a newer function when its polyfill is required: ProcessConfiguration uses array_any() again; array_first() replaces reset() / current() in ProcessConfiguration::getMainTask(), ConstraintLoader and ProcessHelpCommand (no internal array pointer, same results).
  • #279 Define the public API (Symfony BC promise): the classes not meant to be extended are marked @final since 5.4 (the engine: ProcessManager, ProcessConfigurationRegistry, TransformerRegistry, ContextualOptionResolver; the models: ProcessState, ProcessHistory, SubprocessInstance, the configurations, the events, the Filesystem files; the concrete tasks and transformers), they will be final in v6.0: extending them triggers a deprecation with the Symfony DebugClassLoader. The abstract classes, interfaces, traits, exceptions and the file tasks extended by other tasks (FileReaderTask, LineReaderTask, FolderBrowserTask, CsvReaderTask, InputCsvReaderTask, Filesystem\CsvResource) stay open. TaskRegistry, new in this version, is final. The infrastructure classes are marked @internal: CleverAgeProcessExtension, Configuration, the commands, DataQueueEventListener, PhpFunctionProvider, the Monolog processors, ProcessLogger and TaskLogger. Update documentation.
  • #269 Composer: symfony/process, symfony/stopwatch, symfony/var-dumper and symfony/monolog-bundle are no longer required, they are suggested (applications using them must require them). Without symfony/process (CommandRunnerTask, ProcessLauncherTask) or symfony/stopwatch (StopwatchTask), the container still compiles and these tasks fail with an explicit message (UnavailableServicesCompilerPass); without symfony/var-dumper, nothing is dumped (as before); without symfony/monolog-bundle, the cleverage_process* channels and processors are not registered and the default logger is used. monolog/monolog stays required (Logger\*Processor). Remove the unused symfony/monolog-bridge dependency. ProcessConfiguration no longer uses array_any() (PHP 8.4), whose polyfill was only installed by the removed packages. Add a conflict with cleverage/doctrine-process-bundle, cleverage/soap-process-bundle and cleverage/ui-process-bundle <3.3, which use the MonologBundle without requiring it. Update documentation, add tests.
  • #91 Reference a task by a code in the process configurations: new task key (task: transformer), next to its options. The code of a task service is declared with the new code attribute of the cleverage.task tag or the new #[AsTask(code: '...')] attribute (autoconfiguration); every task of the bundle has a code, given on its reference page (snake case of its class name without Task, e.g. transformer, constant_output, csv_reader). The codes are resolved when the container is compiled (TaskLocatorCompilerPass): an unknown or duplicate code fails the compilation. Referencing a task by its service (e.g. service: '@CleverAge\ProcessBundle\Task\TransformerTask') is deprecated (configuration deprecation), it will be removed in v6.0: use task: <code>. The documentation examples use the codes. Update documentation, add tests.
  • #276 TransformerRegistry: the transformers are loaded lazily from a service locator indexed by code (new internal TransformerLocatorCompilerPass, new optional TransformerRegistry constructor argument): a transformer is only instantiated when a process uses it. The code is given by the new code attribute of the cleverage.transformer tag, or by the new #[AsTransformer(code: '...')] attribute (autoconfiguration); it must be the one returned by getCode(). All the bundle transformers and the generic transformers have their code. Duplicate codes fail the container compilation. A transformer tagged without code is still registered eagerly, with TransformerRegistry::addTransformer(), which is deprecated (the code will be required in v6.0, #280). RegistryCompilerPass is no longer used and deprecated. TransformerInterface::getCode() is deprecated (@deprecated PHPDoc: no runtime notice is possible for an interface method), it will be removed from the interface in v6.0 (#280): keep implementing it, returning the code of the tag until then. Update documentation, add tests.
  • #149 Apply Symfony best practices to the tasks and transformers services: they are defined explicitly (no more autowiring, autoconfiguration nor bindings in the bundle), keeping their class name as service id. Same arguments, tags and shared settings as before (generated from the previously autowired definitions). They stay public, but fetching them directly from the service container ($container->get(<class>)) is deprecated (container.private tag): they will be private in v6.0, use dependency injection (autowiring by class and decoration keep working). Update documentation.
  • #275 The tasks are fetched from a service locator built at compile time from the services referenced by the process configurations (new TaskRegistry, cleverage_process.registry.task, and internal TaskLocatorCompilerPass) instead of the whole service container: a task service can be private. ProcessManager and ProcessHelpCommand get the registry as a new optional last constructor argument; not passing it is deprecated (the tasks are then fetched from the container), and fetching a task service not referenced by the process configurations known at compile time falls back on the container with a deprecation. Both fallbacks will be removed in v6.0 (#114). Update documentation, add tests.
  • #278 The container no longer fails to compile when the Symfony serializer or validator is not enabled: the tasks and transformers depending on them (NormalizerTask, DenormalizerTask, SerializerTask, DeserializerTask, normalize and denormalize transformers, ValidatorTask) are replaced by services failing with an explicit message when they are used (new internal UnavailableServicesCompilerPass). CheckSerializerCompilerPass is no longer used and deprecated. Update documentation, add tests.
  • #272 DependencyInjection: autoconfiguration of the services implementing TaskInterface (public, not shared, monolog.logger tag on cleverage_process_task) and TransformerInterface (cleverage.transformer tag, monolog.logger tag on cleverage_process_transformer): the _instanceof rules or explicit tags are no longer needed with autoconfigure: true; a setting explicitly defined on a service wins. Add FQCN aliases to autowire ProcessManager, ProcessConfigurationRegistry, TransformerRegistry and ContextualOptionResolver. Update documentation, add tests.
  • #274 CI: test the lowest versions allowed by composer.json (--prefer-lowest, PHP 8.2). Fix the lower bounds it revealed: require psr/log ^2|^3 (Logger\AbstractLogger and the loggers of the tests use the typed LoggerInterface signatures, a fatal error with psr/log 1) and monolog/monolog ^3 (the Logger\*Processor classes use Monolog\LogRecord, Monolog 3 only: a TypeError on every log of the cleverage_process* channels with Monolog 2).
  • #273 Trigger the deprecations with trigger_deprecation() (symfony/deprecation-contracts, now required) instead of @trigger_error(..., E_USER_DEPRECATED): the messages are prefixed with the package and the version that introduced the deprecation (e.g. Since cleverage/process-bundle 5.1: ...), as for the Symfony packages. Same E_USER_DEPRECATED level. Add tests.
  • #270 Add a .gitattributes: the development files (.docker/, .github/, tests/, quality tools and PHPUnit configurations, Makefile…) are no longer part of the archive installed by Composer (dist). Remove the obsolete test fixtures of src/Resources/tests/ (not used since the tests rewrite).
  • #271 DependencyInjection: CleverAgeProcessExtension::findServices() loads the service definition files with a glob pattern instead of a Finder (same files), Configuration uses arrayPrototype() / variablePrototype() / scalarPrototype() instead of prototype() (same configuration tree). Add tests.
  • #282 Require psr/container (ProcessHelpCommand), ext-xmlreader (XmlStreamReaderTask) and ext-libxml (XmlFile, XmlStreamReaderTask, XpathEvaluatorTransformer), used directly; add symfony/cache (used by the tests) to the dev requirements.
  • #268 Clean up composer.json: remove the unused symfony/dotenv, symfony/runtime and symfony/error-handler dependencies (applications relying on the bundle to install them must require them), bound symfony/service-contracts to ^2.5|^3, update the package description.

Fixes

  • #307 Fix InputAggregatorTask: when a branch skips an item (filter, error with the skip strategy), the inputs received from the other branches for this item are dropped instead of being joined with the inputs of the next item. The inputs of an item are told apart by the executions of their common ancestors (new ProcessState::getExecutionCount(), incremented by the ProcessManager before each execution of a task). InputAggregatorTask is no longer deprecated (its limits described in 2018 no longer exist) and is marked @final since 5.4. Update documentation, add tests.
  • #301 Fix ProcessManager: the history of the parent process is restored after a failed process too, so that the logs of a parent process going on after a failed sub-process (e.g. process_executor task with the skip error strategy) are no longer attributed to the sub-process (process_id, process_code and process_context added by the Monolog processors), and that no history of a failed process is left after its execution (getProcessHistory()). The Critical process failure log and the cleverage_process.fail event are still attributed to the failed process. ProcessManager implements ResetInterface (kernel.reset tag): its state is reset between two messages of a long-running worker. Add tests.