Repository navigation
Commit f9977c1
fix(runtime): POST /api/v1/packages parses the manifest's id leg (#19473)
Part of #19417
Clause-②: no (narrowing)
## What landed
`POST /api/v1/packages` parses the manifest's `id` leg through
`ManifestSchema.shape.id` — the declaration, **by reference** — exactly
as the
`version` leg beside it has since #19120. An id `MANIFEST_ID_PATTERN`
refuses is
answered `400` / `VALIDATION_ERROR` carrying the declaration's OWN
sentence, and
neither install writer runs.
Before: `packages/runtime/src/domains/packages.ts` read the id
positionally
(`typeof manifest?.id === 'string' ? manifest.id.trim() : ''`) and
parsed
nothing, so a complete manifest with `id: 'pkg-a'` installed and
answered `201`
while `defineStack()`, `os build`, `os validate` and the publish face
all refused
the same id. The author was handed a package that could never be rebuilt
or
published.
Nothing in `packages/spec` moves. `ManifestSchema.shape.id` is already a
plain
`ZodString` carrying the regex and its custom refusal, so the escape
this order
named — *"the id leg cannot be gated by reference without a
`packages/spec`
change"* — is **false**, measured:
```text
typeof leg: object ZodString
"pkg-a" -> false Invalid package id 'pkg-a' on `manifest.id`. … Did you mean 'com.example.pkg-a'?
"com.acme.crm" -> true
"com.example.my_erp"-> false … Did you mean 'com.example.my-erp'?
```
## The two design calls, and what decided them
### 1. Scope — the `id` leg alone
Taken as the seat preferred, and for a reason the measurement supplies
rather
than a preference: each of the remaining residual classes is a separate
narrowing of a published wire contract, and this card was graded on the
`manifest.id` class. Measured through `HttpDispatcher.handlePackages`
**after**
this change:
```text
201 1. manifest missing `type` (wrapped)
201 1. manifest missing `type` (bare)
201 2. unknown key, WRAPPED form (dropped)
201 2. unknown key, BARE form (schema refuses by name)
201 3. string-typed `enableOnInstall`
201 3. string-typed body `overwrite`
201 4. install options on the BARE form
400 CONTROL the card class — id `pkg-a`
201 CONTROL a conforming install
```
All seven spellings of the four left-standing classes still answer
`201`; the
card's class is the only one that moved, and the conforming control
still
installs. Closing the rest remains the one call this handler pointedly
does not
make, `PackageInstallBodySchema.safeParse(body)`.
1 parent 5e7d83c commit f9977c1
4 files changed
Lines changed: 652 additions & 9 deletions
File tree
- .changeset
- packages/runtime/src
- domains
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
592 | 601 | | |
593 | 602 | | |
594 | 603 | | |
595 | 604 | | |
596 | 605 | | |
597 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
598 | 626 | | |
599 | 627 | | |
600 | 628 | | |
| |||
0 commit comments