Repository navigation
Commit 732def5
docs(client, cli): say environments activate writes no server state (#31806)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9PMDzvc5jP3MDLgvgcsqgUY)_
Fixes #31783
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:SDK `environments.activate` 的注释、环境接口列表,以及 CLI `os environments
switch` / `create` 的注释、`--remote` 说明和 `--no-remote`
提示,改为如实描述:这个调用只确认调用者是该环境成员,不写任何服务器状态。
- 为什么改:原文说服务器会把当前环境写进会话,实际上 cloud 的路由什么都不写(回 `sessionUpdated:
false`);当前环境只存在 CLI 本地的 credentials 里。
- 风险与回滚:只改注释、flag 说明和一行提示文字,行为不变。回滚即还原本 PR。
- 先看:`packages/cli/src/commands/environments/switch.ts`(flag
说明与提示)、`packages/client/src/index.ts`(`activate` 的
jsdoc)、`packages/cli/src/commands/environments/create.ts`。
- 两分钟验证:`git grep -n -E "session row|server session|server-side
session|active_environment_id" packages/client/src
packages/cli/src/commands/environments`,预期无输出。
- 需要你做的:无,席位落地。
## What changes
Option A of the card, wording only. Every place in `packages/client` and
`packages/cli` that said the server writes or switches the session's
active environment now says what happens: the `/activate` call reads the
environment, confirms the caller is a member of it, and writes no server
state; the active environment lives in the CLI's local credentials.
Places changed (line numbers on head `dd02a89c`):
1. `packages/client/src/index.ts:3389`: the environments endpoint list
(card place 1).
2. `packages/client/src/index.ts:3703-3711`: the `environments.activate`
jsdoc (card place 2). It also says the answer carries `sessionUpdated:
false` and that the CLI keeps the active environment locally and sends
it per request (`X-Environment-Id`).
3. `packages/cli/src/commands/environments/switch.ts:15-18`: the
command's doc comment (card place 3), plus `:21-22`, one added sentence
that the active environment lives only in the local files.
4. `packages/cli/src/commands/environments/switch.ts:52`: the `--remote`
flag description, now `Also call /activate on the server to confirm
access (writes no server state)` (card place 4).
5. `packages/cli/src/commands/environments/switch.ts:76`: the code
comment (card place 5).
6. `packages/cli/src/commands/environments/switch.ts:110`: the
`--no-remote` note, now `(local only — /activate was not called)` (card
place 6, user-visible text; FAIL round 1 replaced an inaccurate first
wording, since `environments.get` has already resolved the environment
on the server by then).
7. Further hits from the delta's grep (ruling 1), same claim in
`packages/cli`: `packages/cli/src/commands/environments/create.ts:25-27`
(doc comment) and `:125` (code comment, "the server session is already
switched").
The grep ran over `packages/client` and `packages/cli` for
`active_environment_id`, "session row", "server session", "server-side
session", `sessionUpdated` and "session's active environment". Left as
they are: `packages/cli/src/commands/logout.ts:29` ("Revoke server-side
session", a real server write, unrelated), the `sessionUpdated` field in
the `activate` return type (the wire shape), and
`client.environments-namespace.test.ts:333-342`, which relays a stub
envelope with `sessionUpdated: true` to pin pass-through and says
nothing about what the server does.
No code path, flag or default changes. `--remote` stays default-on
(option B not taken).
Changeset: `.changeset/31783-environments-activate-wording.md`, patch
for `@objectstack/client` and `@objectstack/cli`. Rule followed:
AGENTS.md Post-Task Checklist step 3 and os-dev's published-surface
test. The client jsdoc ships in the published `.d.ts`, and the flag
description and the `--no-remote` note ship in the CLI's help and
output, so this is not the comments-only fast lane.
The `--remote` description is not snapshot-tested and appears in no
generated doc or help file (`git grep` for the old texts outside
`switch.ts`: zero hits), so nothing was regenerated.
`content/docs/deployment/cli.mdx:3137-3138` already describes switch and
create as local-only and needs no change.
## Tests
No test changes. No test pins the old texts.
## Acceptance notes
- Option B (drop the default-on `/activate` call) is not in this PR.
`switch` already calls `environments.get` on the same id just before
`/activate`, so the default call adds a second access check and nothing
else. Seat ruling at review: no card for B.
## Verification
Head `dd02a89c` (FAIL round 1 fix on top of `d9a5e8ff`, which is
`ea8fe660` plus a merge of `origin/main` at `2b752aa4`). All three heads
were measured green; the numbers below are `dd02a89c`'s.
<details><summary>Builds, tests, typecheck, lint</summary>
- `turbo run build --concurrency=2 --filter='./packages/**'
--filter='./examples/**'` under the lock: `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/client test`: `Test Files 56 passed (56)`,
`Tests 721 passed (721)`; then `pnpm --filter @objectstack/client
typecheck` green.
- `pnpm --filter @objectstack/cli typecheck`, then `pnpm --filter
@objectstack/cli exec vitest run --project unit --maxWorkers=2`: `Test
Files 406 passed (406)`, `Tests 5777 passed (5777)`. One lock run for
the client and cli legs: `VERDICT command-exit 0`. The integration tier
is left to CI (no integration or spawn-entry file touched).
- `eslint --no-inline-config` on the three touched files: exit 0 (re-run
on `switch.ts` at `dd02a89c`: exit 0) (neither package has its own lint
script).
</details>
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `dd02a89c`: 65 commands, each run with
its exit code captured before any pipe; all 65 exit 0. Reconciliation:
`dispatch-gates --ran: 65 derived famil(ies) accounted for — 65 run, 0
NOT-MEASURED`. On the first round, four gates first answered exit 3
(prerequisite not met: the teardown self-test fixture commit, and dist
for the dual-build, i18n-coverage and skill-examples gates). They went
green after fetching the fixture commit and building packages and
examples.
</details>
No ablation: wording only, no tested behaviour changed.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRXLCQFr5TnPia6y3J)_
<!-- signed: domain:server#2 · os-steve ·
session_01ADHkmQKZzp4DLtqiCkZZRM -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0243357 commit 732def5
4 files changed
Lines changed: 31 additions & 13 deletions
File tree
- .changeset
- packages
- client/src
- cli/src/commands/environments
| 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 | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3386 | 3386 | | |
3387 | 3387 | | |
3388 | 3388 | | |
3389 | | - | |
| 3389 | + | |
3390 | 3390 | | |
3391 | 3391 | | |
3392 | 3392 | | |
| |||
3701 | 3701 | | |
3702 | 3702 | | |
3703 | 3703 | | |
3704 | | - | |
3705 | | - | |
3706 | | - | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
3707 | 3711 | | |
3708 | 3712 | | |
3709 | 3713 | | |
| |||
0 commit comments