Repository navigation
Commit 8290dc0
Fixes #23293
Clause-②: yes (widening): `DeleteMetaItemOptions` gains the optional
`packageId`, which both `meta.deleteItem` declarations send as
`?package=`.
## What this does
`@objectstack/client`'s `meta.deleteItem` can name the package whose row
it removes. `DeleteMetaItemOptions` gains `packageId?: string`, and the
one query builder both declarations call (`metaDeleteQuery`,
`packages/client/src/index.ts`) appends it as `package=`, beside
`state`. The name, the key and the omission rule are the save path's
(`SaveMetaItemOptions.packageId` and `metaSaveQuery`): only a non-empty
id reaches the wire, and `undefined` and `''` send nothing. Both
declarations, the unscoped `ObjectStackClient.meta` and the
environment-scoped `client.environment(id).meta`, get it with no
per-declaration code, because both already call the one builder.
Why: since PR #23290 (merged as `543b33dee`), the REST reset door
refuses a delete that names no package of an item two or more packages
hold with `409 RESOURCE_CONFLICT`, and the refusal prescribes
`?package=`. Before this change the SDK could not send it. This is the
same class as #11391 on `saveItem`.
The option bag's docblock now says the door reads four carriers and the
bag declares three. `?dropStorage` is still withheld, under the same
ruling as before.
**Level: `minor`** for `@objectstack/client`
(`.changeset/23293-client-delete-package.md`). An optional member on an
exported request-options type is an additive widening. The house form
was checked, not assumed: the two sibling widenings on this same surface
shipped as minors. `SaveMetaItemOptions`, the #11391 save-path bag, and
the `cf71d73` `DeleteMetaItemOptions` bag are both listed under `17.3.0
### Minor Changes` in `packages/client/CHANGELOG.md`.
## Premises re-read on `main` (at `614fdec83`, the branch point)
- **The door.** `DELETE /api/v1/meta/:type/:name`
(`packages/rest/src/rest-server.ts`) declares `package` in
`META_ITEM_RESET_PARAMS`, its accepted query set, and refuses a repeated
`package` (`refuseRepeatedQueryParams(..., ['state', 'dropStorage',
'package', ...])`). It reads the value through `metaItemPackageBinding`,
which is also the save door's reading (`all`, the empty value and a
non-string name no package), and threads it as `packageId` into
`deleteMetaItem`. `543b33dee` is an ancestor of the base: `git
merge-base --is-ancestor 543b33d HEAD` exits 0.
- **One builder.** Both declarations called `metaDeleteQuery(options)`
and `metaDeleteHeaders(options)`, so the member lands once, in the
shared type and the shared builder. Confirmed: the change to those two
declarations is docblock text only.
- **Spec.** `DeleteMetaItemRequestSchema.packageId` already exists (it
arrived with #23165's change). Nothing changes in `packages/spec` or
`packages/rest`.
## Tests (at `13e311f07`, the head this PR opens with: the three commits
plus a merge of `origin/main` at `3490bf5fa`)
New cases in `packages/client/src/meta-delete-item-carriers.test.ts`.
Each claim is made on both declarations, and each has a negative
control.
- **Wire, unscoped and scoped:** a delete naming a package sends
`?package=PACKAGE_ID`. A delete naming none (no bag, `{}`, `packageId:
''`, `packageId: undefined`) sends no query string. With `state`, the
query is `?state=draft&package=PACKAGE_ID` and `package` appears once;
`If-Match` is not disturbed. Encoding matches `saveItem` byte for byte.
Both twins put the same query on the wire for the same options.
- **The real reset door** (the file's existing `bootDoor`: real
`RestServer` routes, real `ObjectStackProtocolImplementation`, real
`sys_metadata` on SQLite). One view is saved into two packages through
the SDK. A delete naming no package is refused with `err.code ===
'RESOURCE_CONFLICT'` and `err.httpStatus === 409`, both rows survive,
and the protocol probe shows no `packageId` arrived. With `{ packageId
}`, only that package's row is gone and the probe shows the package
arrived. The same holds on the scoped twin.
Runs, at `13e311f07` after rebuilding the client's dependency closure
(`pnpm --filter '@objectstack/client^...' build`) on the merged tree:
- `pnpm --filter @objectstack/client exec vitest run --maxWorkers=2`:
`Test Files 51 passed (51)`, `Tests 663 passed (663)`. The same counts
were read at `4ae4bd784`, before the merge.
- `pnpm --filter @objectstack/client run typecheck`: exit 0,
`check:test-typecheck: OK`. `tsc -p tsconfig.test.json --listFiles`
lists `meta-delete-item-carriers.test.ts`, so the new cases are
type-checked.
- Gates: `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `13e311f07` derives 63 commands. All 63
exit 0, and `--ran` reconciles them as `63 derived, 63 run, 0
NOT-MEASURED, 0 UNRUN`. The four artifact-roster gates whose roster sits
under `.changeset/` or `packages/` (`check-changeset-fixed`,
`check:authz-resolver`, `check:error-code-casing`,
`check:filter-alias-parity`) were also run, and each exits 0.
- Lint, narrowed to the two touched TypeScript files: `eslint
--no-inline-config --format json` reads 2 files with 0 errors and 0
warnings. `--print-config` resolves 6 rules for `index.ts`, so the file
is linted and not ignored. The config sets no `parserOptions.project` or
`projectService`, so linting is not type-aware and this diff cannot move
the verdict on any untouched file. The full `pnpm lint` is left to CI.
**Ablation (one-off, no test file kept).** The implementation was
committed first. Then `node scripts/ablation-replace.mjs` removed the
builder's `params.set('package', ...)` line from `metaDeleteQuery`: the
anchor went from 1 hit to 0, the marker from 0 to 1, and the blob from
`3d93926e9ec5` to `209aedd32d88`. The same file then ran **7 failed / 23
passed**. All five wire cases that send a package failed, and so did
both real-door cases that name one. The negative controls and the
package-less 409 case stayed green, which is the expected direction
because they do not depend on the line. The restore was proven on disk:
blob equal to HEAD (`3d93926e9ec5`), `git diff HEAD` empty, `git status`
clean. `index.ts` is imported from source (`./index`), so no build sits
between the mutation and the run.
**Not run locally, declared to CI.** `packages/cli` imports
`DeleteMetaItemOptions` (`src/commands/meta/delete.ts`) and builds the
bag from its flags. The member is additive and optional, and the command
reads no member list. The CLI's typecheck lane and its tests need a
25-package build closure that is not built in this container, so CI runs
them.
## Acceptance notes
- `os meta delete` (and `os meta register`) has no `--package` flag, so
the CLI still cannot name a package on its own commands. The SDK half is
what this PR delivers. The command layer is a separate widening in
`packages/cli`, and no PR or card in flight carries it.
- The console's reset is objectstack-ai/objectui#12335's half, and
objectstack-ai/objectui#12335 remains open.
- The client forwards `packageId` verbatim. How `all` is read is the
door's decision (`metaItemPackageBinding`), as on the save path, and
this client adds no reading of its own.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01BRQ9Mp1yH7R1az6MaUM18H)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8639a19 commit 8290dc0
3 files changed
Lines changed: 230 additions & 6 deletions
File tree
- .changeset
- packages/client/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
840 | 846 | | |
841 | 847 | | |
842 | | - | |
| 848 | + | |
843 | 849 | | |
844 | 850 | | |
845 | 851 | | |
| |||
894 | 900 | | |
895 | 901 | | |
896 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
897 | 923 | | |
898 | 924 | | |
899 | 925 | | |
| |||
906 | 932 | | |
907 | 933 | | |
908 | 934 | | |
909 | | - | |
910 | | - | |
| 935 | + | |
| 936 | + | |
911 | 937 | | |
912 | 938 | | |
913 | 939 | | |
914 | 940 | | |
915 | 941 | | |
916 | 942 | | |
917 | 943 | | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
918 | 947 | | |
919 | 948 | | |
920 | 949 | | |
| |||
1881 | 1910 | | |
1882 | 1911 | | |
1883 | 1912 | | |
1884 | | - | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
1885 | 1921 | | |
1886 | 1922 | | |
1887 | 1923 | | |
| |||
7710 | 7746 | | |
7711 | 7747 | | |
7712 | 7748 | | |
7713 | | - | |
| 7749 | + | |
| 7750 | + | |
7714 | 7751 | | |
7715 | 7752 | | |
7716 | 7753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
257 | 264 | | |
258 | 265 | | |
259 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
260 | 356 | | |
261 | 357 | | |
262 | 358 | | |
| |||
631 | 727 | | |
632 | 728 | | |
633 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
0 commit comments