Repository navigation
Commit a1285f2
Fixes #23350
Clause-②: yes (widening)
## What this does
`os meta delete` and `os meta register` each take an optional
`--package` flag (a package id, for example `com.acme.crm`) and forward
it verbatim as the SDK's `packageId`, which the SDK sends as
`?package=`:
- `os meta delete`: `metaDeleteOptions` maps `--package` to
`DeleteMetaItemOptions.packageId`, beside `--if-match` and `--draft`.
This is the remedy the reset door's `409 RESOURCE_CONFLICT` prescribes
for an item that two or more packages hold.
- `os meta register`: the new exported `metaRegisterOptions` maps
`--package` to `SaveMetaItemOptions.packageId`, and `run()` passes that
bag to `client.meta.saveItem`. Before this change the call took no
options.
- Without `--package`, both commands send the same request as before
(pinned on the wire below).
- An empty or blank `--package` is refused before a client exists, the
same way an empty `--if-match` already is. For example, `--package
"$PKG"` with `PKG` unset expands to an empty value, and the SDK would
send that as a package-less request. A package-less request is not
always refused: for an item one package holds, the door resolves it to
that package's row. So the operator's command line would read as naming
one package while the server picks the row. This is the CLI's own input
refusal. A non-empty id is never reshaped.
- The two docblocks the card names now list the reset door's carriers
instead of counting them: `DeleteMetaItemOptions` in
`packages/client/src/index.ts`, and `metaDeleteOptions` in
`packages/cli/src/commands/meta/delete.ts`. Both state why `dropStorage`
and `member` are not sent.
## Measurements (the dispatch's hypotheses)
All measured on `origin/main` `08ea7e368` (the base of this branch).
- **H1 (delete):** confirmed. The SDK option is
`DeleteMetaItemOptions.packageId`, sent by `metaDeleteQuery` as
`?package=` behind a truthy guard. The flag forwards the string
unchanged: `metaDeleteOptions({ package: ' com.qa.alpha ' })` answers `{
packageId: ' com.qa.alpha ' }`. On the real door, `--package
com.qa.alpha` puts `?package=com.qa.alpha` on the wire, and the door
hands the protocol `packageId: 'com.qa.alpha'`.
- **H2 (register):** confirmed. `SaveMetaItemOptions.packageId` exists
and is sent as `?package=` by `metaSaveQuery`. `os meta register` saves
**active**: unflagged, it sends `PUT /api/v1/meta/view/NAME` with no
query string and no `?mode=`, and the row lands with `state: 'active'`.
- **The door's answer to a package-less active save of an item two
packages hold:** `409 RESOURCE_CONFLICT`. The CLI's `--format json`
envelope carries `code: 'RESOURCE_CONFLICT'` and `httpStatus: 409`, and
its message names both packages. Nothing is written: both rows keep
their bodies.
- This was measured through the real oclif command against the real
`RestServer` route, the real `ObjectStackProtocolImplementation` and
real SQLite `sys_metadata` tables (`register-package.test.ts`, case 2).
- So the active save refuses exactly as the draft save does since PR
#23408.
- **H3 (carriers):** confirmed, five carriers. The reset door reads the
`If-Match` header plus the query parameters `state`, `dropStorage`,
`package` and `member`. The query half is `META_ITEM_RESET_PARAMS` in
`packages/rest/src/rest-server.ts`. The actor comes from the session,
not the request. The docblocks now name all five rather than counting
them.
- **H4 (generated reference):** nothing reads these flags.
- No oclif manifest is generated or committed.
- No page under `content/docs/**` other than the release-owned
`releases/` tree mentions `os meta delete` or `os meta register` flags.
- `check:cli-examples-parity`'s table has no `meta` row.
- `scripts/docs-audit/affected-docs.mjs` maps `register.ts` to the
phrase `os meta register` as a reviewer prompt, not a generated file.
`check-affected-docs.mjs` ran green on this diff.
- Nothing to regenerate.
## Where the edits sit
All inside the claim's file surface:
- `packages/cli/src/commands/meta/delete.ts`: the flag,
`metaDeleteOptions`, its docblock, `EMPTY_PACKAGE_DELETE_REFUSAL` and
one example.
- `packages/cli/src/commands/meta/register.ts`: the flag,
`metaRegisterOptions`, `EMPTY_PACKAGE_SAVE_REFUSAL`, the `saveItem`
options and one example.
- `packages/client/src/index.ts`: the `DeleteMetaItemOptions` header
only. Comment text, no type change.
- Tests:
- `packages/cli/src/commands/meta/delete-reset-carriers.test.ts` gains
Part 6, plus one title and comment in Part 1 that stated the old count.
- `packages/cli/src/commands/meta/register-package.test.ts` is new and
uses the same real-door harness.
- `.changeset/23350-cli-meta-package-flag.md`: `@objectstack/cli` minor;
`@objectstack/client` patch, because the docblock ships in
`dist/index.d.ts` (measured: `grep -c "reads these carriers"
packages/client/dist/index.d.ts` answers 1, and `files` lists `dist`).
## Tests
Code under test is identical at `7560e7f9e` and the head `7ec2fb6c7`;
the only commit between them adds the changeset.
**The pins (triage `6157686519`), each with a negative control, all
through the real door:**
- Delete, no flag, two packages: `--format json` reports `code:
'RESOURCE_CONFLICT'` and `httpStatus: 409`, both rows remain, no
`packageId` reaches the protocol, and the wire search is empty.
- Delete, `--package com.qa.alpha`: alpha's row is removed and beta's
remains. The same probe now sees `packageId` arrive, and the wire reads
`?package=com.qa.alpha`. A package that holds no row (`com.qa.gamma`)
removes nothing and answers `deleted: false`.
- Register, `--package com.qa.alpha`: alpha's row gets the new body and
beta's is untouched. The negative control is the unflagged two-package
save above, refused 409 with nothing written.
- Also covered:
- the empty-refusal cases, each with a positive control on the same
instruments;
- `--package` composed with `--draft` and `--if-match`
(`?state=draft&package=com.qa.alpha` plus the header);
- identical bytes through both SDK twins;
- a save into a new package.
**Runs, each under `scripts/pm/os-verify-lock.sh`:**
- `vitest run --project integration` on the two meta files at
`7ec2fb6c7`: `Test Files 2 passed (2)`, `Tests 37 passed (37)`. Per-file
test time on the shared box: `delete-reset-carriers` 8.8 s,
`register-package` 7.2 s.
- `pnpm --filter @objectstack/cli exec vitest run --project unit` at
`7560e7f9e`: `Tests 4278 passed | 29 skipped`, with 285 of 287 files
passed.
- The 2 failed files were `test/published-subpath-console.pin.test.ts`
and `test/published-subpath-hook-body.pin.test.ts`. Both refused with
"packages/cli is not built", a prerequisite rather than a verdict.
- After `pnpm --filter @objectstack/cli build`, those two files plus
`test/vitest-tiers-partition.test.ts`: `Test Files 3 passed (3)`, `Tests
51 passed (51)`.
- `pnpm --filter @objectstack/cli typecheck`: exit 0, and
`check:test-typecheck: OK`. `tsc --noEmit --listFiles` lists both meta
test files.
- `pnpm --filter @objectstack/client typecheck`, then `vitest run` in
`packages/client`: exit 0, `Test Files 51 passed (51)`, `Tests 663
passed (663)`.
- The integration layer beyond the two touched files is declared to CI.
No spawn test covers `os meta delete` or `os meta register`:
`test/remote-api-commands.test.ts` imports the command classes and is
unit-tier.
**Ablation (one-off, no file kept), on the delete flag's forwarding:**
- The mutation went through `node scripts/ablation-replace.mjs`. It
replaced `if (packageId !== undefined) options.packageId = packageId;`
with `void packageId; /* ABLATION-23350: forwarding removed */`.
- Anchor count 1 to 0; blob `614a82e6f310` to `39e86c3e9afe`.
- No build or `dist` step applies: the subject is imported relatively
from `src` (`./delete.js`).
- The run: `Tests 5 failed | 24 passed (29)`. These five went red:
- the `metaDeleteOptions` mapping;
- NAMING ONE (exit 1, the 409, where 0 was expected);
- NAMING A PACKAGE THAT HOLDS NO ROW;
- the composition case;
- the in-step twins case.
- As predicted, two cases stayed green: NAMING NONE (the negative
control) and the empty-refusal case. In the empty-refusal case, a
package-less delete of a one-package item resolves to that package
anyway.
- Restored: blob back to `614a82e6f310`, equal to HEAD, and `git diff
HEAD` empty.
## Gates
- Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `7ec2fb6c7`: 66 commands, each run and
recorded with its exit code before any pipe.
- `--ran` reconciliation: "66 derived famil(ies) accounted for — 63 run,
3 NOT-MEASURED (3 DERIVED from a recorded exit 3)".
- The three exit-3 gates are `PREREQUISITE NOT MET` in this checkout
(packages outside this card are not built). They are declared to CI:
- `check:skill-examples`
- `check:dual-build-cjs-loads`
- `check:i18n-coverage`
- The derivation warned that `origin/main` had moved 3 commits
(`4e0838d99`, `8d5b7bb94`, `b60eb78d3`) since the base.
- They touch `packages/spec/src/stack.zod.ts`, `service-mailbox` and two
gate files. None of them is in `packages/cli` or `packages/client`.
- So `main` was not merged before opening. CI runs the merge ref.
## Acceptance notes
Observations, not filed.
- The door reads `?package=all` as naming no package
(`metaItemPackageBinding`, shared with the save door; the SDK's
`DeleteMetaItemOptions.packageId` docblock states it). So `--package
all` reaches the door as a package-less request. The flag forwards
verbatim by design, and what an id names is the door's decision.
- `packages/client/src/meta-delete-item-carriers.test.ts`'s header still
narrates "three carriers" and then "a fourth carrier joined later". That
is a historical note in a test file outside this claim's surface, left
as is.
- `delete-reset-carriers.test.ts` now measures 8.8 s of test time on the
shared box, under the 10 s line.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01YRp5z4kK6vgYkrdH97ztsy)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 22fb225 commit a1285f2
6 files changed
Lines changed: 739 additions & 13 deletions
File tree
- .changeset
- packages
- client/src
- cli/src/commands/meta
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
388 | 392 | | |
389 | 393 | | |
390 | 394 | | |
391 | | - | |
| 395 | + | |
392 | 396 | | |
393 | | - | |
394 | | - | |
| 397 | + | |
| 398 | + | |
395 | 399 | | |
396 | 400 | | |
397 | 401 | | |
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
| 406 | + | |
402 | 407 | | |
403 | 408 | | |
404 | 409 | | |
| |||
762 | 767 | | |
763 | 768 | | |
764 | 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 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
33 | 53 | | |
34 | 54 | | |
35 | 55 | | |
| |||
45 | 65 | | |
46 | 66 | | |
47 | 67 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
53 | 83 | | |
54 | 84 | | |
55 | 85 | | |
56 | 86 | | |
| 87 | + | |
57 | 88 | | |
58 | 89 | | |
59 | 90 | | |
60 | 91 | | |
61 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
62 | 97 | | |
63 | 98 | | |
64 | 99 | | |
65 | 100 | | |
66 | 101 | | |
67 | 102 | | |
| 103 | + | |
| 104 | + | |
68 | 105 | | |
69 | 106 | | |
70 | 107 | | |
| |||
77 | 114 | | |
78 | 115 | | |
79 | 116 | | |
| 117 | + | |
80 | 118 | | |
81 | 119 | | |
82 | 120 | | |
| |||
132 | 170 | | |
133 | 171 | | |
134 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
135 | 182 | | |
136 | 183 | | |
137 | 184 | | |
| |||
0 commit comments