Review main Merged

81617[TASK] Respect the AsCommand `hidden` constructor argument

Benjamin Franzke CR +2 V +2 Normal +192 −10 updated 11/07/23, 06:13

Commit message

Symfony's AsCommand attribute encodes `hidden = true` into
a trailing `|` for the name attribute. Drop that for our
command list and mark the command as hidden in the command
registry.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Chris Müller +1
    • Garvin Hicking +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Chris Müller +1
    • Garvin Hicking +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 9

Review log 1822

  1. Benjamin Franzke uploaded patch set 1 10/30/23, 16:48

  2. core-ci voted on patch set 1 V +1 10/30/23, 16:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48365

  3. Chris Müller voted on patch set 1 V +1 CR +1 10/30/23, 16:59

  4. Garvin Hicking commented on patch set 1 10/30/23, 18:33

    But now this |name cariation isn't (yet?) documented, and the hidden-part looks as if dropped altogether? Just from reading the current ReST I would wonder what happened to the formerly existing "hidden" command option?
  5. Benjamin Franzke uploaded patch set 2 CR +1 V +1 10/31/23, 05:18

  6. Benjamin Franzke commented on patch set 2 10/31/23, 05:19

    Reply

    `hidden` is encoded into a leading `|` in symfony's AsAttribute constructor. I've had plans to add a functional for that and did so now. Updated the patch accordingly.
  7. core-ci voted on patch set 2 V -1 10/31/23, 05:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48376

  8. Andreas Kienast commented on patch set 2 10/31/23, 05:47

    Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst:18

    Just for clarity: since we're editing this file anyway, I'd write `schedulable` (with backticks) to make it more clear we're dealing with a keyword here.
  9. Garvin Hicking commented on patch set 2 10/31/23, 07:01

    Reply

    What I meant was a sentence in the ReST file like: To indicate that a command shall be hidden from the command lisg, you can prepend the "|" pipe character in front of the name of the Symfony Attribute, like this: (example) I wonder, if such "magic" is used, couldn't we also append a "|" character at the end, too, to make "schedulable" be set? Or two "|" in front? It feels a bit odd that one parameter can be accessed, but not the other...?
  10. Benjamin Franzke uploaded patch set 3 V -1 10/31/23, 07:37

  11. Benjamin Franzke commented on patch set 2 10/31/23, 07:37

    Reply

    No, `hidden` is a defined constructor argument and thus "ok" to be used, but we rather won't introduce implicit public api like a trailing |. Sorry. The intention is: *Every* proper command should actually be schedulable – which means: "It can work without runtime user interaction" (I think it actually is an antipattern that we have the `schedulable` flag at all). And I'm not talking about DX-console-commands like b13/make: they should/must not be published to production anyway.

    Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst:18 Reply

    Ack
  12. core-ci voted on patch set 3 V +1 10/31/23, 07:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48383

  13. Garvin Hicking commented on patch set 3 10/31/23, 09:29

    Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst:17

    The Test case uses: ``` #[AsCommand(name: 'testdi:ascommand:hidden', description: 'This is a hidden command.', hidden: true)] ``` so shouldn't the Changelog note at this point say "Only the parameters `command`, `description`, `hidden` are still viable."?
  14. Benjamin Franzke commented on patch set 4 V +1 11/06/23, 08:10

    Published edit on patch set 3.
  15. Benjamin Franzke commented on patch set 4 11/06/23, 08:11

    Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst:17 Reply

    Done (feel free to edit the patchsets if you see obvious issues).
  16. core-ci voted on patch set 4 V +1 11/06/23, 08:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48613

  17. Chris Müller voted on patch set 4 V +1 CR +1 11/06/23, 09:07

  18. Garvin Hicking commented on patch set 4 V +1 CR +1 11/06/23, 16:46

    Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst:17 Reply

    Perfect. Didn't want to hijack anything and wanted to ensure we're on the same page :-) Thanks!
  19. Oliver Hader voted on patch set 4 CR +1 11/06/23, 18:09

  20. Oliver Hader commented on patch set 4 V +1 11/06/23, 18:20

    Seems to be working... but it's really "ugly" in Symfony's `AsCommand` since these properties are not exposed explicitly...
  21. Benjamin Franzke voted on patch set 4 V +2 CR +2 11/07/23, 06:13

  22. Benjamin Franzke merged patch set 5 11/07/23, 06:13