Skip to content

Commit f3b46d8

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/sec-grant-holder-sentence
2 parents ee912fb + d5fd948 commit f3b46d8

27 files changed

Lines changed: 1276 additions & 157 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
feat(cli): `os deploy` and the `d` key in `os dev` deploy to a self-hosted runtime (Docker Community or Enterprise) that `os environments use-runtime` remembered; `os package install` falls back to it
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
**`os environments use-runtime <url> --token <key>`** (new) remembers a self-hosted runtime and an API key it issued, and makes it the deploy target. The key is tried on the runtime's install-local door first (`--no-verify` skips that); a rejected key, a runtime that does not serve install-local, or one that cannot be reached is refused and nothing is recorded. Both are stored in `~/.objectstack/cloud.json` (0600) as their own record beside the cloud session: `os cloud login` and `os cloud logout` keep it, and the key is only ever sent to that url. `os environments switch <id>` makes ObjectOS Cloud the deploy target again (the runtime stays remembered); `os environments use-runtime --forget` drops it.
11+
12+
**`os deploy`** with a runtime as the active target (and no `--env`) builds the app, asks the runtime's install-local dry run and prints the upgrade plan (declared `renamedFrom` renames included), then installs the build inline — no catalog publish and no `-dev` version — and reports it live from the runtime's answer. A refusal from the dry run or the install stops the deploy with exit 1 and the runtime's sentence; a runtime that does not serve install-local (one booted from a composed artifact) or that predates the dry run is named, with what to do, exit 1. `--confirm-access-upgrade <finding-set>` passes the access-upgrade confirmation through (and is refused when the target is ObjectOS Cloud). **The `d` key** names the remembered runtime and deploys there without asking for a cloud login.
13+
14+
**`os package install`** without `-u` / `$OS_RUNTIME_URL` installs into the remembered runtime, and without `-t` / `--email` uses its key — only when the url is that runtime's. With nothing remembered the default stays `http://localhost:3000`. Its 404 answer now names the composed-artifact case and what to do.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): validation examples guard nullable fields, hooks teach `body`, the `requires:` table names `mailbox` and `package-registry`, `os generate` drops `agent`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`objectstack-data` `rules/validation.md` now guards every ordering or arithmetic operand in its examples with `!= null` (the due-date, date-range, amount, discount and order-total predicates) and states the rule once: an unguarded `<` or `+` on a field with no `required: true` / `defaultValue` is refused at publish. Its external-validation hook and the `examples-objects.md` lifecycle hook are written as a sandboxed `body`, and the `SKILL.md` index names the inline `handler` only as the deprecated form; the validation section says a `body` has no outbound HTTP, so an external-API check goes through a Connector recipe. `objectstack-platform` lists `mailbox` (`@objectstack/service-mailbox`) and `package-registry` (`@objectstack/service-package`) in the `requires:` table, and `references/operations.md` no longer offers the retired `os generate agent`. The platform behaviour already shipped; this release only teaches it.

‎.claude/skills/pm-dispatch/references/platform-readings.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@
385385
- 强制档不因临缺授权降档:临缺非退役,退役唯维护者裁;不达档起隔离达档子代理或等档。
386386
- 本车道强制多是过宽的回忆:`dispatch-gates.mjs --tier PATH` 逐路径现推,路径线是下限非放行。
387387
- 该脚本只答自己那棵树:姊妹仓路径回 absent from this tree,姊妹仓的档位与条款②只能手推。
388-
- required checks 的名单是每仓事实,objectstack 十个:
389-
`TypeScript Type Check` · `Lint & Repo Gates` · `Test Core` · `Build Core` · `Lint UI` ·
390-
`Governed Surface Queue Guard` · `Type Check UI` · `Test UI` · `Build & E2E UI` · `Live E2E UI`。
388+
- required checks 的名单是每仓事实,objectstack 十一个:
389+
`TypeScript Type Check` · `Lint & Repo Gates` · `Test Core` · `Build Core` · `Lint UI` · `Test UI` ·
390+
`Governed Surface Queue Guard` · `Type Check UI` · `Build & E2E UI` · `Live E2E UI` · `Dogfood Regression Gate`。
391391
- ⭐ 本表的 `mustName` 声明 `statesTheSet` ⇒ 必须逐字等于注册表,加注册行不跟改本表即红。
392392
- ⇒ 门绿即名单逐字齐全的读数;⛔ 但数量词未钉:实测 七→六 照绿,只能手跟改。
393393
- ⛔ 聚合命令同样不作判定:`check:type-check-debt` 可在包级 typecheck 绿时红。

‎.claude/skills/pm-dispatch/references/review-checklist.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
- ⛔ 非当前 head 上的 `cancelled` 零动作、永不重跑:新推送自带全套 run。
4747
- 席位核对门禁证据 = check-runs(名+结论);本地并集只证本地子集,⛔ 不替缺席者。
4848
- `!` 或 `(narrowing)`:入队前核 `dogfood_battery` 钉 head、全量、红已修/已报;缺或收窄 ⇒ REWORK。
49-
- 把发送或写挪到应答之后的 PR:dogfood 门禁不跑于 PR 与队列,全绿照样红 `main` 的 push 全量。
49+
- 把发送或写挪到应答之后的 PR:dogfood 门禁不跑于 PR、跑于队列,全绿 PR 照样被队列弹出。
5050
- ⇒ 入队前 grep `packages/qa/dogfood/test` 里应答后紧读该副作用的用例,同一 PR 改为有界等待。
5151

5252
## 断言与收益

‎.github/workflows/ci.yml‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@ concurrency:
122122
# github.event_name != 'pull_request'
123123
#
124124
# in its `if:`, so a dogfood red shows on the queue build of the entry that
125-
# carries it rather than first on `main`'s push run after it. It is advisory
126-
# there: the context is outside the required set (below), so the queue may
127-
# merge the entry before or despite the shards.
125+
# carries it rather than first on `main`'s push run after it, and the red
126+
# ejects that entry: the context is in the required set again (below).
128127
# `main`'s 4-hourly `schedule` run, its `push` runs and an on-demand
129128
# `workflow_dispatch` carry the FULL BATTERY: all of that plus the three jobs
130129
# below that spell
@@ -139,9 +138,9 @@ concurrency:
139138
# `scripts/ci/scheduled-full-run.mjs --release-gate`). ⛔ No affected-only
140139
# dogfood filter on the queue: the shards run on every entry, through the
141140
# `core` output, which is 'true' on `merge_group` (letter C was not ruled).
142-
# The queue enforces only the ruleset's required set, and `Dogfood Regression
143-
# Gate` is outside it since #22998 (check:required-contexts' tombstone); this
144-
# file does not decide whether it rejoins.
141+
# The queue enforces only the ruleset's required set. `Dogfood Regression
142+
# Gate` left it by #22998 and rejoined it by the #30461 follow-up ruling
143+
# (ruling record 6669982756); check:required-contexts pins its row.
145144
#
146145
# Spelled as a DENY-list of the per-PR events on purpose — the filter
147146
# contract's half 1 below, applied to events: a trigger added to `on:` later
@@ -2724,9 +2723,9 @@ jobs:
27242723
overwrite: true
27252724

27262725
dogfood-gate:
2727-
# Stable check name for a SHARDED job (#3622 follow-up). Since #22998 the
2728-
# context is outside the required set (THE TWO SPEEDS above `jobs:`). On a
2729-
# PR both legs skip and this gate counts zero expected attestations; on a
2726+
# Stable check name for a SHARDED job (#3622 follow-up), a required
2727+
# context again since #30461 (THE TWO SPEEDS above `jobs:`). On a PR both
2728+
# legs skip and this gate counts zero expected attestations; on a
27302729
# queue build (since #30461) the three dogfood shards run and are counted,
27312730
# while `dogfood-verify` skips and is judged with zero expected; the full
27322731
# battery runs and counts both. The history below is why the name and the
@@ -2738,10 +2737,9 @@ jobs:
27382737
# EVERY pull request in the repo sat permanently BLOCKED (mergeable, all
27392738
# checks green, merge button dead). #3622's own comment called for updating
27402739
# branch protection; keeping the contract HERE instead means a future
2741-
# shard-count change cannot deadlock the repo a second time. From #6865
2742-
# until #22998 the bare name was pinned by `check:required-contexts`; it
2743-
# left that registry with the required set, so a rename now falsifies the
2744-
# prose that names it without reddening anything — treat it as contract.
2740+
# shard-count change cannot deadlock the repo a second time. The bare name
2741+
# is pinned by `check:required-contexts` (since #6865; out of that registry
2742+
# from #22998 until #30461) — treat it as contract.
27452743
#
27462744
# Also aggregates dogfood-verify (the CLI pass that used to ride shard 1),
27472745
# so the one context still covers everything it covered before the split.

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,11 @@ Even inside your own worktree, operate defensively:
505505
yet"; `in_progress` is not a pass, and arming a red PR hides it
506506
([why](docs/agents/multi-agent-discipline.md#arming-a-red-pr-hides-it)). Always read *two* things:
507507
the queue branch **and** `origin/main`. And **the queue enforces only the required
508-
set** — ten contexts block: `Lint & Repo Gates` (all `check:*` gates), `TypeScript Type Check`,
508+
set** — eleven contexts block: `Lint & Repo Gates` (all `check:*` gates), `TypeScript Type Check`,
509509
`Test Core`, `Build Core`, `Governed Surface Queue Guard`, `Lint UI`, `Type Check UI`, `Test UI`,
510-
`Build & E2E UI` and `Live E2E UI`; a check outside those ten is advisory
510+
`Build & E2E UI`, `Live E2E UI` and `Dogfood Regression Gate`; a check outside those eleven is advisory
511511
([why that matters](docs/agents/multi-agent-discipline.md#advisory-checks-ride-through)). A required context is
512-
matched by check-run name, so a rename detaches its gate silently — treat those ten names as contract.
512+
matched by check-run name, so a rename detaches its gate silently — treat those eleven names as contract.
513513
**Two speeds** — PR runs carry the fast set, queue runs add the dogfood shards; `main`'s scheduled and push runs
514514
carry the full battery ([detail](docs/agents/multi-agent-discipline.md#two-speeds-which-runs-carry-which-battery)).
515515
**Main-red:** a full-battery red is its lane's first work — triage files it under

‎docs/agents/multi-agent-discipline.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Arming a red PR does not queue it, it hides it:
123123

124124
← [`AGENTS.md` › Multi-agent working discipline](../../AGENTS.md#multi-agent-working-discipline)
125125

126-
A check outside those ten is advisory and rides through, and an advisory red
126+
A check outside those eleven is advisory and rides through, and an advisory red
127127
that lands rides `main`'s merge ref into every later PR until stanched.
128128

129129
## Two speeds: which runs carry which battery
@@ -134,9 +134,9 @@ A check outside those ten is advisory and rides through, and an advisory red
134134
of wall per queue entry (median, 2026-11-05); `main`'s scheduled (4-hourly) and push runs
135135
carry the full battery — dogfood, e2e, `Temporal Conformance (live PG + MySQL)` — read by the publish lane before
136136
any approval. Queue runs also carry the three `Dogfood Regression Gate` shards (ruling record
137-
6663883327), so a dogfood red shows on the queue build, advisory only; `Dogfood Verify CLI`,
137+
6663883327), so a dogfood red shows on the queue build; `Dogfood Verify CLI`,
138138
Temporal Conformance and `UI Published Artifacts` stay full-battery only. The `Dogfood Regression
139-
Gate` context is outside the required set, so the queue does not hold an entry on it.
139+
Gate` context is in the required set again (ruling record 6669982756), so a dogfood red ejects the entry.
140140

141141
## Re-arm awareness
142142

‎packages/cli/src/commands/deploy.ts‎

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,31 @@
4545
*
4646
* ⛔ Not the retired `os publish` id (see `package/publish.ts`'s header), on
4747
* purpose: that id is documented as removed and must stay unresolvable.
48+
*
49+
* ## A self-hosted runtime target
50+
*
51+
* When `os environments use-runtime` made a self-hosted runtime (the Docker
52+
* image, Community or Enterprise) the active deploy target, the same command
53+
* with no flags deploys THERE instead (`--env` still names a cloud environment
54+
* and deploys to it). There is no catalog and no version to mint: the build is
55+
* sent inline to the runtime's install-local door — `os package install` itself,
56+
* run in this process with the remembered url and key, so its refusals and
57+
* answers stay in ONE place:
58+
*
59+
* 1. build (`compileForDeploy`), as above;
60+
* 2. the dry run — the runtime's package upgrade plan of the installed
61+
* version against this build, printed; nothing is installed. A runtime
62+
* that refuses it, or does not serve install-local, stops the deploy here
63+
* with its sentence and exit 1;
64+
* 3. the install, with `--confirm-access-upgrade` passed through; the door's
65+
* refusals (an access upgrade to confirm, …) stop the deploy with exit 1;
66+
* 4. the answer — install-local registers the package in the live kernel
67+
* before it answers, so the answer IS "live": `hotLoaded` ⇒ 0; a package
68+
* the running kernel could not load ⇒ 1, naming the restart it waits for.
69+
*
70+
* Whether an upgrade is refused for a rename or a type change (epic
71+
* cloud#3652 Q3) is install-local's verdict, not this command's: a refusal it
72+
* answers is printed and stops the deploy like any other.
4873
*/
4974

5075
import { readFile } from 'node:fs/promises';
@@ -56,7 +81,10 @@ import { describeEnvironment, resolveInstallTarget } from '../utils/install-targ
5681
import { compileForDeploy } from '../utils/deploy-build.js';
5782
import { devVersion } from '../utils/dev-version.js';
5883
import { fetchEnvironmentOrigin, waitUntilServed, wakeEnvironment, type ServedVersionVerdict } from '../utils/served-version.js';
84+
import { activeRuntimeTarget } from '../utils/runtime-target.js';
85+
import type { RuntimeTarget } from '../utils/cloud-config.js';
5986
import PackagePublish from './package/publish.js';
87+
import PackageInstall from './package/install.js';
6088

6189
/** The artifact the build writes and the publish reads — `os build`'s default output. */
6290
export const DEPLOY_ARTIFACT = 'dist/objectstack.json';
@@ -66,12 +94,14 @@ export const DEPLOY_POLL_INTERVAL_MS = 3_000;
6694

6795
export default class Deploy extends Command {
6896
static override description =
69-
'Deploy this app to your ObjectOS Cloud environment: build it, publish a dev version, install it, and wait until it is live';
97+
'Deploy this app to your ObjectOS Cloud environment (build it, publish a dev version, install it, and wait until '
98+
+ 'it is live), or to the self-hosted runtime `os environments use-runtime` made the active target';
7099

71100
static override examples = [
72101
'$ os deploy',
73102
'$ os deploy --env env_abc123 # your account reaches several environments',
74103
'$ os deploy --no-wait # return once the install is recorded',
104+
'$ os deploy --confirm-access-upgrade <finding-set> # self-hosted: confirm the findings the runtime printed',
75105
];
76106

77107
static override flags = {
@@ -105,13 +135,34 @@ export default class Deploy extends Command {
105135
description: 'API key for ObjectOS Cloud (bearer token; defaults to OS_CLOUD_API_KEY / OS_TOKEN, then `os cloud login`)',
106136
env: 'OS_CLOUD_API_KEY',
107137
}),
138+
'confirm-access-upgrade': Flags.string({
139+
description:
140+
'Self-hosted runtime target: confirm the access findings of this upgrade with the finding-set token the '
141+
+ "runtime's refusal printed (as `os package install --confirm-access-upgrade`)",
142+
}),
108143
};
109144

110145
async run(): Promise<void> {
111146
const { flags } = await this.parse(Deploy);
112147
printHeader('Deploy');
113148

114149
try {
150+
// 0. Target: the self-hosted runtime when it is the active one and no
151+
// cloud environment was named.
152+
const runtime = flags.env ? undefined : await activeRuntimeTarget();
153+
if (runtime) {
154+
await this.deployToRuntime(runtime, flags['confirm-access-upgrade']);
155+
return;
156+
}
157+
if (flags['confirm-access-upgrade'] !== undefined) {
158+
printError(
159+
'`--confirm-access-upgrade` confirms a self-hosted runtime\'s refusal; the deploy target is ObjectOS Cloud. '
160+
+ 'Drop the flag, or record the runtime with `os environments use-runtime <url> --token <key>`.',
161+
);
162+
this.exit(1);
163+
return;
164+
}
165+
115166
// 1. Credential.
116167
const { token, baseUrl } = await resolveCloudCredential({ token: flags.token, server: flags.server });
117168
if (!token) {
@@ -229,6 +280,59 @@ export default class Deploy extends Command {
229280
this.exit(1);
230281
}
231282
}
283+
284+
/**
285+
* The self-hosted half (the header's "A self-hosted runtime target"):
286+
* build → dry run (plan printed) → install → the `hotLoaded` answer.
287+
*/
288+
private async deployToRuntime(runtime: RuntimeTarget, confirmAccessUpgrade: string | undefined): Promise<void> {
289+
printStep(`Deploying to the self-hosted runtime ${runtime.url} (os environments use-runtime)`);
290+
291+
printStep('Building...');
292+
const artifactPath = resolvePath(process.cwd(), DEPLOY_ARTIFACT);
293+
if (compileForDeploy(artifactPath) !== 0) {
294+
printError('The build failed — fix the errors above, then run `os deploy` again. Nothing was installed.');
295+
this.exit(1);
296+
return;
297+
}
298+
299+
const install = async (extra: string[]) => {
300+
const command = new PackageInstall(
301+
[artifactPath, '--url', runtime.url, '--token', runtime.token, ...extra],
302+
this.config,
303+
);
304+
command.retryCommand = 'os deploy';
305+
command.embedded = true;
306+
await command.run();
307+
return command.outcome;
308+
};
309+
310+
console.log('');
311+
printStep(`Asking ${runtime.url} for the upgrade plan (dry run — nothing is installed)...`);
312+
const plan = await install(['--dry-run']);
313+
if (plan?.kind !== 'dry-run') {
314+
printError(`${runtime.url} did not answer the dry run with a plan, so nothing more was sent. Upgrade the runtime, then run \`os deploy\` again.`);
315+
this.exit(1);
316+
return;
317+
}
318+
319+
printStep(`Installing ${plan.manifestId} ${plan.version} into ${runtime.url}...`);
320+
const outcome = await install(confirmAccessUpgrade !== undefined ? ['--confirm-access-upgrade', confirmAccessUpgrade] : []);
321+
if (outcome?.kind !== 'installed') {
322+
printError(`${runtime.url} did not answer the install as a managed package install, so this cannot say ${plan.manifestId} is live (see above).`);
323+
this.exit(1);
324+
return;
325+
}
326+
if (!outcome.hotLoaded) {
327+
printError(
328+
`${runtime.url} recorded ${outcome.manifestId} ${outcome.version}, but its running kernel could not load it, so `
329+
+ 'it is not live: it loads when the runtime restarts. Fix the cause above, then run `os deploy` again.',
330+
);
331+
this.exit(1);
332+
return;
333+
}
334+
printSuccess(`Live: ${runtime.url} now serves ${outcome.manifestId} ${outcome.version}.`);
335+
}
232336
}
233337

234338
/** Print the wait's verdict; return the exit code it means. */

0 commit comments

Comments
 (0)