Commit 49f51e1
authored
fix: ship registry reader with framework so Tools→Packages works in fresh apps (#2543)
* fix: ship registry reader with framework so Tools→Packages works in fresh apps
The debug bar's Tools→Packages link (and the standalone packagelist
page it opens) silently rendered an empty registry list in apps
generated with `wheels new`. Public.$loadRegistryPackages gated on
FileExists("/cli/lucli/services/packages/Registry.cfc") — that path
only exists in the framework dev repo. User apps ship vendor/wheels/
without cli/, so the gate always returned an empty array.
Move the registry reader into the framework at
vendor/wheels/services/packages/{Registry,HttpClient,ManifestCache}.cfc
so it ships with every generated app. Public.cfc now instantiates the
bundled component directly and the file-existence gate is gone.
Keep the registry list scoped to the standalone Tools→Packages page —
the inline Environment > Packages section now shows installed packages
only, so the debug bar stays compact and we don't trigger a registry
walk on every dev-mode page load. The CLI keeps its own copies under
cli/lucli/services/packages/; both contexts have their own classpath
mappings (modules.wheels.* vs wheels.*) and dedup is left for a
follow-up.
Issue #2530.
* fix: validate versions array in Registry.fetchManifest before listAll() reads it
Address PR #2543 reviewer A. listAll() reads
local.m.versions[ArrayLen(local.m.versions)] without first checking
that the .versions key exists, is an array, and is non-empty. The
existing manifest validation only checked for .name. A registry entry
that passed the .name check but lacked .versions would crash with an
Expression-level "element VERSIONS is undefined" error — bypassing
both the per-package RegistryMalformed skip in listAll() and the
three typed catches in Public.$loadRegistryPackages, surfacing as an
unhandled stack trace on the Tools → Packages page.
Validate the .versions invariant in fetchManifest so cached and
fresh manifests share one guard, and the per-package skip
catches a typed throw. Mirrored into the CLI's Registry.cfc to
keep both copies in sync per the in-file note.
New RegistryFetchManifestSpec exercises the framework Registry with
a fake HttpClient — covers missing key, non-array, empty array, and
the listAll() end-to-end skip path. Adds wheels.tests._assets.packages.FakeHttpClient
trimmed to the framework HttpClient surface (no download()).
CHANGELOG entry for #2530 also rewritten to match the final UX
(registry list scoped to the standalone Tools → Packages page only)
and a new entry added for the validation fix.
* fix: validate cached manifests on read so stale on-disk entries can't crash listAll
Address PR #2543 reviewer B follow-up. The previous fix only validated
manifests on the fresh-fetch path before writing to cache. The
cache-hit path in fetchManifest returned the on-disk entry without
revalidating, so a manifest written by an older Registry version that
didn't enforce the versions invariant could still crash listAll() with
an Expression-level error.
Extract the manifest contract assertion into $validateManifest() and
call it from both the cache-hit and fresh-fetch paths. Mirrored into
the CLI's Registry.cfc to keep both copies in sync.
New spec case writes a stale-bad manifest to the cache directly, marks
it fresh, then verifies fetchManifest re-validates on read instead of
returning the stale entry.1 parent 6ea3d8b commit 49f51e1
12 files changed
Lines changed: 749 additions & 211 deletions
File tree
- cli/lucli/services/packages
- vendor/wheels
- events/onrequestend
- services/packages
- tests
- _assets/packages
- specs
- events
- packages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
24 | 19 | | |
25 | | - | |
26 | | - | |
| 20 | + | |
| 21 | + | |
27 | 22 | | |
28 | | - | |
29 | | - | |
| 23 | + | |
| 24 | + | |
30 | 25 | | |
31 | | - | |
32 | | - | |
| 26 | + | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
36 | 31 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 60 | + | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
97 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
98 | 118 | | |
99 | 119 | | |
100 | 120 | | |
101 | 121 | | |
102 | 122 | | |
103 | | - | |
104 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
105 | 133 | | |
106 | 134 | | |
107 | 135 | | |
| |||
120 | 148 | | |
121 | 149 | | |
122 | 150 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
130 | 161 | | |
131 | 162 | | |
132 | 163 | | |
133 | 164 | | |
134 | 165 | | |
135 | 166 | | |
136 | 167 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
141 | 172 | | |
142 | 173 | | |
143 | 174 | | |
| |||
154 | 185 | | |
155 | 186 | | |
156 | 187 | | |
| 188 | + | |
157 | 189 | | |
0 commit comments