test(architecture): lock down two routing/filter silent-failure modes

Encodes two bugs that recently cost debugging time as architecture tests so
they cannot recur.

PageTemplateNamingTest
  MintyPHP's Router splits page filenames on parens. `view(default).phtml` →
  view="view", template="default". A nested group like `view($id)(none).phtml`
  produces an empty view name, resolves to the wrong file, and the response
  silently becomes an empty body. URL parameters belong only in the .php
  action filename. This test flags any .phtml with more than one paren group.

FilterSchemaConsistencyTest
  Every query key declared in a list's filter-schema.php must also appear in
  the toolbar section (standard pagination/sort keys exempted). If a filter
  param is not in the toolbar, Grid.js's URL-sync drops it on every refetch —
  the filter works on initial page load and breaks after any user interaction.
  This test caught one dormant violation (system-audit's target_type), which
  is now declared as a hidden toolbar field for future use.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 15:37:26 +02:00
parent 811588290c
commit 21c331cd06
3 changed files with 204 additions and 0 deletions

View File

@@ -46,6 +46,14 @@ return gridFilterSchema([
'dir' => ['type' => 'dir', 'default' => 'desc'],
],
'toolbar' => [
[
// Dormant capability — kept in toolbar as hidden so Grid.js preserves
// the param across refetches if/when a UI is added.
'key' => 'target_type',
'type' => 'hidden',
'input_id' => 'system-audit-target-type-filter',
'default' => '',
],
[
'key' => 'search',
'type' => 'text',