Skip to content

Commit db5d9f8

Browse files
committed
Merge origin/main (C10 #4767) into claude/issue-4737-action-location-dual-source
生成物冲突按 #4535 §7 重新生成,不做文本合并: - json-schema.manifest.json:合并会静默复活 C10 蓄意删除的 9 个 system/EnvironmentArtifact* 键(gen:schema 实测报 disappeared),故取 main 版本后由 gen:schema 重新落我方 RENAMED_DEFS 承接(studio/ActionLocation → studio/ActionContributionLocation),delta 对 main 恰 ±1 行 - 两张 shrink-only ratchet(dual-source / docs-import-surface)不归 merge driver 管,手工解冲突:取 main 版本后只删本单那一行,diff 对 main 为纯单行删除 - api-surface.json / references 由 gen:api-surface + gen:docs 从合并树重生成 - authorable-surface.json 与 main 逐字节一致(0-key carry 复证) Claude-Session: https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9 Co-authored-by: Claude <noreply@anthropic.com>
2 parents a566e32 + 9f601e8 commit db5d9f8

12 files changed

Lines changed: 653 additions & 807 deletions
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
"@objectstack/spec": major
3+
---
4+
5+
BREAKING(spec): `EnvironmentArtifact` 信封收敛为单一声明 —— `@objectstack/spec/system` 持有活的 wire 形状,`@objectstack/spec/cloud` re-export;从未实现的 v0 家族(`functions` / `manifest` / `payloadRef` 及其 8 个子 schema)退役 (#4740, #4535 C10)
6+
7+
`EnvironmentArtifact` / `EnvironmentArtifactInput` / `EnvironmentArtifactSchema` 过去被两个入口导出,但**不是同一个声明**,拿到哪个形状只取决于 import 路径 —— #4411 陷阱:
8+
9+
| 入口 | 声明位置(旧) | 形状 | 状态 |
10+
|:--|:--|:--|:--|
11+
| `@objectstack/spec/cloud` | `cloud/environment-artifact.zod.ts` | **活的 wire 形**:`checksum` 为 64 位 hex **字符串**,`metadata` = `ObjectStackDefinitionSchema` | ****:全仓唯一 runtime Zod parse(`packages/metadata/src/plugin.ts` `_parseAndRegisterArtifact`)与 cloud 仓全部 type import 都用这侧 |
12+
| `@objectstack/spec/system` | `system/environment-artifact.zod.ts` | 文档化「v0」:`checksum``{ algorithm, value }` **对象**、分类袋 `metadata`、内联 `functions[]`、必填 `manifest`、保留位 `payloadRef` | **declared-only**:三仓(objectstack / cloud / objectui)零代码消费者,从未有任何 producer 产出过该形状 |
13+
14+
两侧互相解析不过(checksum 类型硬冲突)。按维护者裁决(#4740,路线 A′):**单一声明落 `./system`、取活的 wire 形状,`./cloud` 改为 re-export 同一声明** —— 两个入口现在解析到同一批符号,对活消费者零迁移。
15+
16+
## FROM → TO
17+
18+
```ts
19+
// 不变 —— cloud 入口的名字与形状都没变,只是声明搬家(re-export)
20+
import { EnvironmentArtifactSchema, type EnvironmentArtifact } from '@objectstack/spec/cloud';
21+
22+
// 不变(形状变了!)—— system 入口同名导出仍在,但现在是活的 wire 形:
23+
// checksum: string(64 hex) 而非 { algorithm, value } 对象
24+
// metadata: ObjectStackDefinition 而非分类袋
25+
import { EnvironmentArtifactSchema, type EnvironmentArtifact } from '@objectstack/spec/system';
26+
```
27+
28+
```ts
29+
// FROM —— 编译期起将以 TS2305 失败(实测三仓零命中,预期无人受影响)
30+
import {
31+
EnvironmentArtifactChecksumSchema, EnvironmentArtifactFunctionSchema,
32+
EnvironmentArtifactManifestSchema, EnvironmentArtifactMetadataSchema,
33+
EnvironmentArtifactPayloadRefSchema, EnvironmentArtifactRequirementSchema,
34+
EnvironmentArtifactHashAlgorithmEnum, EnvironmentArtifactFunctionLanguageEnum,
35+
} from '@objectstack/spec/system';
36+
// TO —— 无替代物:v0 家族从未被任何 producer/consumer 实现。
37+
// 校验 checksum 用 Sha256DigestSchema(现同时从 ./system 与 ./cloud 导出);
38+
// 校验 metadata 用 ObjectStackDefinitionSchema(根入口)。
39+
```
40+
41+
## ⚠️ wire 形状警示(#4666 盲区:key 级门禁不可见的类型变更)
42+
43+
- `EnvironmentArtifact['checksum']`:对 `./system` 侧 import 者是 **`{ algorithm, value }` 对象 → 64 位 hex 字符串** 的类型变更(`./cloud` 侧一直是字符串,不变)。线上 wire 从来只有字符串形;pin 测试钉住「旧对象形 → 拒;hex 字符串 → 过」。
44+
- `EnvironmentArtifact['metadata']`:对 `./system` 侧 import 者从宽松分类袋(passthrough)变为受 `ObjectStackDefinitionSchema` 校验的编译产物。
45+
- 退役键 `functions` / `manifest` / `payloadRef``retiredKey()` tombstone:作者写入即得升级指引(tsc 处 `never`,parse 处 prescription),不是静默剥离。
46+
47+
## 退役论证(#4734 先例逐条评估,不照抄)
48+
49+
**无 ADR-0087 D2/D3 conversion**:信封是**传输形状**,不是 authorable 元数据 —— 不作为 `sys_metadata` 行落库、不在 conversion walker 走的 stack 树上;且 `objectstack compile` 与控制面从未产出过这三个键(cloud 仓 `cloud-artifact-helpers.ts` 一直写 hex 字符串 checksum;函数代码走独立 runtimeModule,从不内联)。存量行**不可能携带**,conversion 写不出能跑到的 fixture(`converge-activation-event-schema` 同款论证)。tombstone prescription 即迁移文档。
50+
51+
## 定级理由(逐条自证)
52+
53+
**major**:`./system` 的 16 个已发布导出名(8 schema const + 8 type)消失,外部 import 将以 TS2305 失败 —— 与 C14 / C16 同形,但**实测三仓 import 级零命中**。同时:
54+
55+
- **零元数据迁移**:被删 9 个 def(`system/EnvironmentArtifact` 全家)均不从 `BUILTIN_METADATA_TYPE_SCHEMAS` 元数据根可达,#4650 门禁对 `authorable-surface.json` 被删 46 行的实跑判定是 7 组「def no longer emitted by this build」自证路径(输出见 PR);无 conversion / migration,`spec-changes.json` / upgrade-guide 零变化。
56+
- **runtime 零行为变化**:`packages/metadata/src/plugin.ts` 的 parse 目标形状就是收敛后的形状,一字未动。
57+
- cloud 仓 3 处 type import(`artifact-api-client.ts` / `file-artifact-api-client.ts` / `registry-reader.ts`,均 `spec/cloud`)名字与形状均不变。
58+
- JSON Schema 产物:`system/EnvironmentArtifact*` 9 个 def 停止发布(`json-schema.manifest.json` 同步删键,#2978 蓄意移除通道);新增 `system/Sha256Digest`(声明随家搬迁,`./cloud` 仍导出)。
59+
60+
## 基线 6 → 3
61+
62+
`dual-source-exports.baseline.json` 删掉 `EnvironmentArtifact` / `EnvironmentArtifactInput` / `EnvironmentArtifactSchema` 三行,其余行一字未动。

content/docs/concepts/north-star.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ development live outside this repo.
6363
validated against `ObjectStackDefinitionSchema`). When published to Cloud it is
6464
wrapped in the immutable environment artifact envelope defined by
6565
`EnvironmentArtifactSchema` in
66-
`packages/spec/src/system/environment-artifact.zod.ts`.
66+
`packages/spec/src/system/environment-artifact.zod.ts` (the single
67+
declaration; `@objectstack/spec/cloud` re-exports it).
6768

6869
The artifact contains:
6970

7071
- `schemaVersion`
7172
- `environmentId`
7273
- `commitId`
73-
- `checksum`
74-
- `metadata`
75-
- `functions`
76-
- `manifest`
77-
- optional provenance and payload-reference fields
74+
- `checksum` — a SHA-256 hex digest (string) of the canonical `metadata`
75+
serialization
76+
- `metadata` — the compiled `ObjectStackDefinition` itself
77+
- optional `builtAt` / `builtWith` provenance
7878

7979
The artifact is enough to describe what the runtime should load. It is not
8080
enough to deploy by itself; the host still supplies deployment config.

content/docs/references/cloud/environment-artifact.mdx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@ description: Environment Artifact protocol schemas
55

66
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
77

8-
# Environment Artifact Envelope (M1)
8+
# Environment Artifact Envelope — re-export (#4740, #4535 C10)
99

10-
Describes the response shape of `GET /api/v1/cloud/environments/:environmentId/artifact`
10+
The envelope has exactly ONE declaration:
1111

12-
— the assembled artifact ObjectOS pulls from the control plane.
12+
`../system/environment-artifact.zod` (maintainer route A′ on #4740
1313

14-
Distinct from the marketplace `PackageArtifactSchema` (a .tgz file listing).
14+
`./system` holds the live wire shape, `./cloud` re-exports it). Importing
1515

16-
This envelope wraps the compiled `ObjectStackDefinitionSchema` produced by
16+
from `@objectstack/spec/cloud` and `@objectstack/spec/system` yields the
1717

18-
`objectstack compile` together with control-plane assigned identity
18+
SAME symbols, so the import path can never change the shape a consumer
1919

20-
(`commitId`, `checksum`).
20+
gets (the #4411 dual-source trap, closed for this name).
21+
22+
Do NOT re-declare the envelope here. A second declaration under this name
23+
24+
is exactly what `check:dual-source-exports` and the symbol-identity pin in
25+
26+
`../system/environment-artifact.test.ts` exist to reject.
2127

2228
<Callout type="info">
2329
**Source:** `packages/spec/src/cloud/environment-artifact.zod.ts`

content/docs/references/system/environment-artifact.mdx

Lines changed: 44 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -5,210 +5,90 @@ description: Environment Artifact protocol schemas
55

66
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
77

8-
# Environment Artifact Format Protocol (v0)
8+
# Environment Artifact Envelope
99

10-
Defines the immutable envelope produced by `objectstack compile` and consumed
10+
THE single declaration of the environment artifact envelope (#4740,
1111

12-
by the ObjectStack runtime at boot. The artifact carries everything a runtime instance
12+
#4535 C10 — maintainer route A′). `@objectstack/spec/cloud` re-exports
1313

14-
needs to hydrate an environment kernel without reading control-plane DB rows
14+
this file; both entry points resolve to these exact symbols, so the
1515

16-
directly.
16+
chosen entry point can never change the shape a consumer gets (the
1717

18-
## Boundary
19-
20-
- **Artifact (this schema):** environment metadata + inlined function code +
21-
22-
plugin/driver requirements. Immutable, content-addressable via `commitId`
23-
24-
and `checksum`.
25-
26-
- **Deployment Config (NOT in this schema):** business DB coordinates,
27-
28-
credentials, environment identity, secrets. Injected at runtime.
18+
#4411 dual-source trap, closed for this name).
2919

30-
See `content/docs/concepts/north-star.mdx` §6.3 for the runtime-inputs
20+
Describes the response shape of
3121

32-
boundary, and `ROADMAP.md` M1 for the milestone definition.
22+
`GET /api/v1/cloud/environments/:environmentId/artifact`the assembled
3323

34-
## Storage / Distribution
35-
36-
v0 stores the full payload inline. Future revisions may swap `metadata` /
37-
38-
`functions` for a `payloadRef` that points at out-of-band storage (S3,
39-
40-
signed URL). The envelope shape preserves room for that indirection without
41-
42-
a breaking schema bump.
43-
44-
<Callout type="info">
45-
**Source:** `packages/spec/src/system/environment-artifact.zod.ts`
46-
</Callout>
24+
artifact ObjectOS pulls from the control plane, and the shape the runtime
4725

48-
## TypeScript Usage
49-
50-
```typescript
51-
import { EnvironmentArtifactSchema, EnvironmentArtifactChecksumSchema, EnvironmentArtifactFunctionSchema, EnvironmentArtifactFunctionLanguageEnum, EnvironmentArtifactHashAlgorithmEnum, EnvironmentArtifactManifestSchema, EnvironmentArtifactMetadataSchema, EnvironmentArtifactPayloadRefSchema, EnvironmentArtifactRequirementSchema } from '@objectstack/spec/system';
52-
import type { EnvironmentArtifact, EnvironmentArtifactChecksum, EnvironmentArtifactFunction, EnvironmentArtifactManifest, EnvironmentArtifactMetadata, EnvironmentArtifactPayloadRef, EnvironmentArtifactRequirement } from '@objectstack/spec/system';
53-
54-
// Validate data
55-
const result = EnvironmentArtifactSchema.parse(data);
56-
```
57-
58-
---
59-
60-
## EnvironmentArtifact
61-
62-
ObjectStack Environment Artifact envelope (v0)
63-
64-
### Properties
65-
66-
| Property | Type | Required | Description |
67-
| :--- | :--- | :--- | :--- |
68-
| **schemaVersion** | `'0.1'` || Environment artifact envelope schema version |
69-
| **environmentId** | `string` || Environment identifier (control-plane scoped) |
70-
| **commitId** | `string` || Content-addressable revision id |
71-
| **checksum** | `{ algorithm: Enum<'sha256' \| 'sha384' \| 'sha512'>; value: string }` || Artifact integrity checksum |
72-
| **builtAt** | `string` | optional | ISO-8601 timestamp of when the artifact was built |
73-
| **builtWith** | `string` | optional | Build tool identifier |
74-
| **metadata** | `Record<string, any>` || Compiled environment metadata grouped by category |
75-
| **functions** | `{ name: string; language: Enum<'javascript' \| 'typescript'>; code: string; source?: object; … }[]` || Inlined function code packaged with the artifact |
76-
| **manifest** | `{ plugins?: { id: string; version?: string }[]; drivers?: { id: string; version?: string }[]; engine?: object }` || Plugin/driver requirements baked into the artifact |
77-
| **payloadRef** | `{ url: string; expiresAt?: string; checksum: object }` | optional | Out-of-band payload reference (reserved for future use) |
78-
79-
80-
---
26+
metadata loader parses at boot (`packages/metadata/src/plugin.ts`,
8127

82-
## EnvironmentArtifactChecksum
28+
`_parseAndRegisterArtifact` — the one runtime Zod parse of this envelope).
8329

84-
Artifact integrity checksum
30+
Distinct from the marketplace `PackageArtifactSchema` (a .tgz file
8531

86-
### Properties
32+
listing). This envelope wraps the compiled `ObjectStackDefinitionSchema`
8733

88-
| Property | Type | Required | Description |
89-
| :--- | :--- | :--- | :--- |
90-
| **algorithm** | `Enum<'sha256' \| 'sha384' \| 'sha512'>` || Hash algorithm used for the artifact checksum |
91-
| **value** | `string` || Hex-encoded digest of the artifact body |
34+
produced by `objectstack compile` together with control-plane assigned
9235

36+
identity (`commitId`, `checksum`).
9337

94-
---
95-
96-
## EnvironmentArtifactFunction
97-
98-
A single inlined function
99-
100-
### Properties
101-
102-
| Property | Type | Required | Description |
103-
| :--- | :--- | :--- | :--- |
104-
| **name** | `string` || Function machine name (snake_case) |
105-
| **language** | `Enum<'javascript' \| 'typescript'>` || Source language of the function code |
106-
| **code** | `string` || Inlined function source |
107-
| **source** | `{ path?: string; exportName?: string }` | optional | Source-map metadata for the function |
108-
| **hash** | `string` | optional | Hex SHA-256 of the inlined code |
109-
110-
111-
---
112-
113-
## EnvironmentArtifactFunctionLanguageEnum
114-
115-
Source language of the function code
116-
117-
### Allowed Values
118-
119-
* `javascript`
120-
* `typescript`
38+
## Boundary
12139

40+
- **Artifact (this schema):** compiled environment metadata plus
12241

123-
---
42+
provenance. Immutable, content-addressable via `commitId` and
12443

125-
## EnvironmentArtifactHashAlgorithmEnum
44+
`checksum`.
12645

127-
Hash algorithm used for the artifact checksum
46+
- **Deployment Config (NOT in this schema):** business DB coordinates,
12847

129-
### Allowed Values
48+
credentials, environment identity, secrets. Injected at runtime.
13049

131-
* `sha256`
132-
* `sha384`
133-
* `sha512`
50+
See `content/docs/concepts/north-star.mdx` §6.3 for the
13451

52+
runtime-inputs boundary.
13553

136-
---
54+
## History (#4740)
13755

138-
## EnvironmentArtifactManifest
56+
This file previously documented a richer "v0" envelope — a
13957

140-
Plugin/driver requirements baked into the artifact
58+
`\{ algorithm, value \}` checksum object, a category-bag `metadata`, inlined
14159

142-
### Properties
60+
`functions[]`, a required plugin/driver `manifest`, and a reserved
14361

144-
| Property | Type | Required | Description |
145-
| :--- | :--- | :--- | :--- |
146-
| **plugins** | `{ id: string; version?: string }[]` | optional | |
147-
| **drivers** | `{ id: string; version?: string }[]` | optional | |
148-
| **engine** | `{ objectstack: string }` | optional | |
62+
`payloadRef` indirection — that NO producer or consumer ever implemented:
14963

64+
`objectstack compile` ships function code as standalone runtime modules
15065

151-
---
66+
referenced from the compiled definition, and the control plane has always
15267

153-
## EnvironmentArtifactMetadata
154-
155-
Compiled environment metadata grouped by category
156-
157-
### Properties
158-
159-
| Property | Type | Required | Description |
160-
| :--- | :--- | :--- | :--- |
161-
| **objects** | `any[]` | optional | |
162-
| **fields** | `any[]` | optional | |
163-
| **views** | `any[]` | optional | |
164-
| **apps** | `any[]` | optional | |
165-
| **pages** | `any[]` | optional | |
166-
| **dashboards** | `any[]` | optional | |
167-
| **reports** | `any[]` | optional | |
168-
| **flows** | `any[]` | optional | |
169-
| **workflows** | `any[]` | optional | |
170-
| **triggers** | `any[]` | optional | |
171-
| **agents** | `any[]` | optional | |
172-
| **tools** | `any[]` | optional | |
173-
| **skills** | `any[]` | optional | |
174-
| **permissions** | `any[]` | optional | |
175-
| **permissionSets** | `any[]` | optional | |
176-
| **positions** | `any[]` | optional | |
177-
| **translations** | `any[]` | optional | |
178-
| **datasources** | `any[]` | optional | |
179-
| **datasets** | `any[]` | optional | |
180-
| **actions** | `any[]` | optional | |
181-
| **apis** | `any[]` | optional | |
68+
served the wire shape below (string SHA-256 checksum, `metadata` = the
18269

70+
compiled definition). The declaration converged to the live wire shape;
18371

184-
---
72+
the never-implemented keys are tombstoned below (ADR-0049
18573

186-
## EnvironmentArtifactPayloadRef
74+
enforce-or-remove: declared = enforced, or absent).
18775

188-
Out-of-band payload reference (reserved for future use)
76+
<Callout type="info">
77+
**Source:** `packages/spec/src/system/environment-artifact.zod.ts`
78+
</Callout>
18979

190-
### Properties
80+
## TypeScript Usage
19181

192-
| Property | Type | Required | Description |
193-
| :--- | :--- | :--- | :--- |
194-
| **url** | `string` || Signed URL pointing at the artifact payload |
195-
| **expiresAt** | `string` | optional | ISO-8601 expiry timestamp |
196-
| **checksum** | `{ algorithm: Enum<'sha256' \| 'sha384' \| 'sha512'>; value: string }` || Checksum of the referenced payload |
82+
```typescript
83+
import { Sha256DigestSchema } from '@objectstack/spec/system';
84+
import type { Sha256Digest } from '@objectstack/spec/system';
19785

86+
// Validate data
87+
const result = Sha256DigestSchema.parse(data);
88+
```
19889

19990
---
20091

201-
## EnvironmentArtifactRequirement
202-
203-
A plugin or driver dependency declaration
204-
205-
### Properties
206-
207-
| Property | Type | Required | Description |
208-
| :--- | :--- | :--- | :--- |
209-
| **id** | `string` || Plugin/driver package id |
210-
| **version** | `string` | optional | SemVer range required by the environment |
211-
21292

21393
---
21494

0 commit comments

Comments
 (0)