Repository navigation
Commit a360cee
fix(cloud-connection): install-local's hotLoaded reports what the hot-register did (#22728)
Fixes #22695
Clause-②: no
## What changes
`POST /api/v1/marketplace/install-local`
(`packages/cloud-connection/src/marketplace-install-local-plugin.ts`)
answered `hotLoaded: true` as a literal. A cloud-fetched manifest whose
`manifest.register` throws takes the lenient path: the install writes
its ledger entry and answers `200`, and the package loads at the next
restart. That answer told its caller the running kernel already held the
package.
- **Step 3 records its outcome.** A local, `hotLoadError`, stays
undefined exactly when `manifest.register` succeeds. The answer's
`hotLoaded` is derived from it, never written as a literal.
- **The new key is `hotLoadError`** (string): the register error's
message. It is present only beside `hotLoaded: false`. On a hot-loaded
install it is omitted (not `null`), so the success answer's key set is
unchanged. objectstack-ai/objectui#12098 reads `hotLoaded`, and can show
`hotLoadError` as the reason.
- **The `note` follows the same record.** It makes the same claim
`hotLoaded` does, so on the lenient path it no longer says "App is now
available in this runtime". It says the package is installed and cached,
the running kernel could not load it, and the runtime registers it again
at its next restart.
- **Unchanged.** The lenient path still installs: the ledger entry is
written and the package loads at the next restart. An inline manifest
whose register throws is still refused with `422
PLUGIN_REGISTER_FAILED`, and nothing is written. Whether the lenient
path should stay lenient is ⛔ not decided here (triage `6098821061`:
"Not in scope").
The lenient path's answer, abridged:
```json
{ "success": true, "data": { "manifestId": "com.example.crm", "hotLoaded": false, "hotLoadError": "MESSAGE", "upgradedFrom": null, "note": "App installed and cached on this runtime, but the running kernel could not load it (`hotLoadError` says why). The runtime registers it again at its next restart." } }
```
`MESSAGE` stands for the register error's message, passed through as the
register threw it.
## Premise check, against `origin/main` `eae3368ae`
- **Held.** `manifestService.register(manifest)` is awaited at `:1257`;
an inline manifest's failure answers `422 PLUGIN_REGISTER_FAILED` at
`:1266`; a cloud-fetched manifest's failure only warns at `:1269`;
`hotLoaded: true` at `:1348` is a literal.
- **No second spelling.** No other answer in the file records a
hot-register failure. The listing's `notLoaded` marker (`{ code,
requiredRange }`) records only an entry the boot rehydrate refused on
the protocol handshake. The DELETE answer's `cleanups[].error` records a
failed withdrawal from the running kernel. Neither is this event.
- **No async install job.** `marketplace-install-local-jobs.test.ts` is
about a package's declared scheduled jobs. It reads `hotLoaded` only as
one key of the success answer's key set (`Object.keys(data)`). That set
is unchanged here, and the pin stays green.
## Tests
- **New:**
`packages/cloud-connection/src/marketplace-install-local-hot-loaded.test.ts`,
3 cases. It imports the plugin from source, not through `dist`.
- Lenient path: a cloud-fetched snapshot whose register throws answers
`200`, `hotLoaded: false`, `hotLoadError` equal to the thrown message.
The ledger entry is written, and the note does not say "now available".
- CONTROL: a register that succeeds answers `hotLoaded: true`, with no
`hotLoadError` key.
- CONTROL: an inline manifest whose register throws answers `422
PLUGIN_REGISTER_FAILED` in the declared envelope, and nothing is
written.
- **Ablation**, from the committed fix at `83034b34c`.
`scripts/ablation-replace.mjs` put `hotLoaded: true,` back (anchor hits
1 then 0, blob `10b51ce6aaec` then `cb1f247d39c6`). Result: `Tests 1
failed | 2 passed (3)`. The lenient case went red (`expected true to be
false`), and both controls stayed green. Restore: blob equal to HEAD
(`10b51ce6aaec`), `git diff HEAD` empty.
- **Package suite:** `pnpm --filter @objectstack/cloud-connection test`:
`Test Files 43 passed (43)`, `Tests 517 passed (517)`. `pnpm --filter
@objectstack/cloud-connection typecheck`: exit 0. `tsc --noEmit -p
tsconfig.test.json --listFiles` lists the new test (43 package test
files in the program).
- Tests ran at `83034b34c`. `58fccccf2` adds only the changeset, so the
code is byte-identical.
## Gates, at `58fccccf2` (this PR's head)
- **Derived families.** I ran the 50 dispatch lines plus the 14 families
the re-derivation added. `dispatch-gates --ran`: 64 derived, 64 run, 0
NOT-MEASURED, all exit 0. `check:dual-build-cjs-loads` first answered
PREREQUISITE NOT MET (no `dist/`). After a full `pnpm build` (72 of 72
tasks) it passed: 107 require entry points across 66 packages.
- **`pnpm lint`**, narrowed to the touched files, with the narrowing
proven:
- (1) eslint's own config. `--print-config` applies 3 active rules to
the plugin file and 5 to the test. eslint ignores the changeset `.md`:
"File ignored because no matching configuration was supplied".
- (2) `--format json`: 3 results. The 2 linted files have 0 errors and 0
warnings.
- (3) Invariance. The config enables no type-aware linting: every
`parserOptions` is `{ ecmaVersion, sourceType }`, with no `project` or
`projectService`, the only parser is `@typescript-eslint/parser`, and
every rule is per-file. So this diff cannot move an untouched file's
verdict.
## Acceptance notes
- **Observation, not filed.** Until the next restart, the GET listing
serves a lenient-path entry with no `notLoaded` marker. The marker
covers only a protocol refusal at rehydrate, and a rehydrate whose
register throws is not marked either. Carrier: none.
- **Observation, not filed.** After a failed register on the lenient
path, the install still runs `syncSchemas`, binds handlers, seeds and
announces the hot install, over a kernel that does not hold the package.
This belongs to the open question of whether the lenient path stays
lenient, and is not touched here.
- **Handed to the dispatcher for filing, not fixed here.** `os package
install` prints "Package installed into the running kernel" for any
`200`, whatever `hotLoaded` says
(`packages/cli/src/commands/package/install.ts:224`). I measured it with
a scratch probe that ran the command against a stubbed answer carrying
`hotLoaded: false`. The probe is not committed.
---
_Generated by [Claude
Code](https://claude.ai/code/session_019SvPnd2bzECRNmAU9i6E4k)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e5899a6 commit a360cee
3 files changed
Lines changed: 244 additions & 4 deletions
File tree
- .changeset
- packages/cloud-connection/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 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 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| |||
1249 | 1255 | | |
1250 | 1256 | | |
1251 | 1257 | | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
1252 | 1267 | | |
1253 | 1268 | | |
1254 | 1269 | | |
1255 | 1270 | | |
1256 | 1271 | | |
1257 | 1272 | | |
1258 | 1273 | | |
| 1274 | + | |
1259 | 1275 | | |
1260 | 1276 | | |
1261 | 1277 | | |
1262 | 1278 | | |
1263 | 1279 | | |
1264 | 1280 | | |
1265 | 1281 | | |
1266 | | - | |
| 1282 | + | |
1267 | 1283 | | |
1268 | 1284 | | |
1269 | | - | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1270 | 1292 | | |
1271 | 1293 | | |
1272 | 1294 | | |
| |||
1345 | 1367 | | |
1346 | 1368 | | |
1347 | 1369 | | |
1348 | | - | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1349 | 1378 | | |
1350 | 1379 | | |
1351 | 1380 | | |
| |||
1358 | 1387 | | |
1359 | 1388 | | |
1360 | 1389 | | |
1361 | | - | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1362 | 1397 | | |
1363 | 1398 | | |
1364 | 1399 | | |
| |||
0 commit comments