Commit e998240
committed
fix(rest): drop a nav group DECLARED empty, not just one the gate emptied (#7380)
`filterNav`'s docblock has promised "Drop empty groups so the sidebar doesn't
render a label with nothing under it" since #4651, but the guard in front of
that branch was `Array.isArray(e.children) && e.children.length > 0`. A group
authored `children: []` therefore never entered the branch that OWNS the rule —
it fell through the else and shipped in `GET /meta/app` as a bare label. The one
shape the sentence most obviously covers was the one shape it could not reach.
The judgement is now on what SURVIVES rather than on how the entry got there: a
`type: 'group'` with no surviving children is dropped whether it BECAME empty
(children gated away) or STARTED empty (`children: []`). Nesting composes, and a
group carrying no `children` key at all — unreachable through the spec, but
reachable at runtime because this filter reads untyped documents off the
metadata store — is the same dead label and drops too.
Contribution slots are the shape this actually shipped. `setup.app.ts` is
authored entirely out of it: nine group anchors with `children: []`, filled on
read by `Registry.applyNavContributions` (ADR-0029 D7). That merge runs in the
protocol layer BEFORE this filter, so a filled slot arrives with children and
survives while an unfilled one arrives `[]` and is now dropped — exactly the
"a disabled capability contributes nothing and its slot stays empty" case
`setup.app.ts` documents.
The rule is `type: 'group'` and nothing else. An `object` entry navigates on its
own `objectName`, so emptiness says nothing about whether to serve it; non-group
entries keep today's behaviour exactly. A group cannot be a target —
`GroupNavItemSchema` is a `strictObject` declaring no target key and rejecting
any, and reads "Does not perform navigation itself". Measured before the change:
of the 16 childless `type: 'group'` entries across the shipped apps and the
examples, zero carry a target key, so the drop is unconditional.
Because `areas[].navigation` runs through the same `filterNav`, an area holding
only childless groups now empties and is dropped by the existing area rule; an
area authored `navigation: []` still passes through, and that divergence is
documented at `filterAreas`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WNJY6He34CWyS8VDBtxVM91 parent ba63f0e commit e998240
3 files changed
Lines changed: 411 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2772 | 2772 | | |
2773 | 2773 | | |
2774 | 2774 | | |
2775 | | - | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
2776 | 2780 | | |
2777 | 2781 | | |
2778 | 2782 | | |
| |||
2839 | 2843 | | |
2840 | 2844 | | |
2841 | 2845 | | |
2842 | | - | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
2843 | 2892 | | |
2844 | | - | |
2845 | | - | |
2846 | 2893 | | |
2847 | 2894 | | |
2848 | 2895 | | |
| 2896 | + | |
2849 | 2897 | | |
2850 | 2898 | | |
2851 | 2899 | | |
| |||
2858 | 2906 | | |
2859 | 2907 | | |
2860 | 2908 | | |
2861 | | - | |
2862 | | - | |
2863 | | - | |
2864 | | - | |
2865 | | - | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
2866 | 2928 | | |
2867 | 2929 | | |
2868 | 2930 | | |
| |||
0 commit comments