fix(usecase): carry the pack's recommended profile into the governance link - #811
Conversation
…e link The pack page names its recommended governance profile and then invites the operator to compare it against what is in force. The link opened the readout with nothing selected, so the profile had to be found by hand one screen after reading its name. The readout has always honoured a `profile` query parameter — the issue expected work there and there was none. Only the link never sent one. routeUrl() gains an optional extra-parameter argument; nothing else moves. The test dispatches the real action. The existing render tests hand `governanceUrl` to a view as a fixed string, which can only prove the template prints what it is given, so none of them could have caught this. Dispatching a backend module action was not something this suite did before: it needs the request to exist before the controller is resolved (Extbase's ConfigurationManager captures the ambient one), a route carrying packageName for BackendViewFactory, and $GLOBALS['LANG'] for ModuleTemplate's own chrome. The helper says why for each. Seen to fail first: with the argument removed the assertion fails on the rendered body, and the fifteen tests in the class pass with it back. Closes #778 Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
|
There was a problem hiding this comment.
Automated approval for maintainer PR
All automated quality gates passed. See SECURITY_CONTROLS.md for compensating controls.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #811 +/- ##
============================================
- Coverage 87.43% 87.43% -0.01%
Complexity 9710 9710
============================================
Files 566 566
Lines 31418 31420 +2
============================================
Hits 27471 27471
- Misses 3947 3949 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Review record — no Copilot review exists for this diff (monthly, account-wide quota exhausted), so the green gate is not a read of the change. What was checked: One premise of the issue was wrong and checking it removed most of the work. #778 asked for the route parameter "plus whatever the readout needs to honour a pre-selection". The readout needs nothing — The existing tests could not have caught this, and that is why a new kind of test is here. Seen to fail first: with the argument removed the assertion fails on the rendered body; restored, the fifteen tests in the class pass. Merge safety checked rather than assumed: this branch and #801 both add to
Merging on that basis. |



The pack detail page prints the governance profile a pack recommends, then says "Compare this posture with what is in force" and links the readout. The link carried no profile, so the operator landed on an unselected readout and had to find the recommendation again by hand — one screen after reading its name.
One thing the issue expected turned out to be already done
#778 asked for the route parameter "plus whatever the readout needs to honour a pre-selection". The readout needs nothing:
LlmModuleController::governanceAction()already readsprofileoff the query string, and its own profile buttons already link that way. Only the sender was missing.So this is
routeUrl()gaining an optional extra-parameter argument and one call site using it.GovernanceProfileis a backed enum, so the value is the same string the buttons use.The test dispatches the controller, which is new here
UseCasePackRenderTesthandsgovernanceUrlto a view as a fixed string. That is right for what those tests check — the template's markup — and it means none of them could ever have caught this, because the value under test was supplied by the test.So this one runs the real action and asserts on the rendered body. Nothing in the suite dispatched a backend module action before, and three things were needed to make it work; each is commented where it sits rather than left as incantation:
ConfigurationManagercaptures the ambient one, which the neighbouring DI test already works around;BackendViewFactoryresolves template paths from the route'spackageName, so the request needs arouteattribute;ModuleTemplatetranslates its own chrome from$GLOBALS['LANG'].Seen to fail first. With the argument removed the assertion fails on the rendered body; restored, the fifteen tests in the class pass.
Gates:
phpstanlevel 10 clean,unit7137 pass,functional -d sqliteonUseCasePack*32 pass,cglandrector -nstable at PHP 8.2 after applying.Closes #778