Skip to content

Commit 171cf6d

Browse files
feat(spec): requires accepts audit-compliance and access-policy-console, two cloud-loader capability tokens beside governance (#32039)
domain:spec#3 · os-support-ai · session_01WGufzgudmrzv5ZGMtfJQKc <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBX5AKQ7ZjuoowRzDFy9HZig)_ Fixes #32011 Clause-②: yes (widening: two new accepted `requires` tokens) Metadata-protocol: added Skills-docs: follow-up #32041 — skills/objectstack-platform/SKILL.md (L318-320, the "Enterprise / cloud" bullet, names `ai-seat` and `governance` as the tokens only cloud's objectos-runtime resolves and now omits `audit-compliance` and `access-policy-console`; `skills/**` is outside this card). No `content/docs/**` sentence lists the cloud-loader tokens (`git grep -n -e ai-seat -e governance -- skills content/docs ':!content/docs/releases'` at 36864c4: 1 hit, that SKILL.md line; control `hierarchy-security`: 6 hits in 4 files) Prior rulings read: platform_capability_tokens,governance,audit-compliance,access-policy-console → 9 hits; ADR-0027 Decision §14, ADR-0033 Decision §10, ADR-0076 D3, ADR-0076 D4/D5/D6/D8, ADR-0076 D8, ADR-0086 D6, ADR-0086 D7, ADR-0104 D3; thread: none; repo: objectstack-ai/objectstack. Every hit is on the word "governance" in another sense (authoring governance, authz governance); none rules on the capability vocabulary. ADR-0033 §6 puts audit and publish governance in the paid tier, which agrees with a cloud-only token. Carried: objectstack-ai/cloud#4218 (repo:cloud#1, `Notify: serial · #4218 behind #32011`, 6755116793): cloud's loader adds the two `CAPABILITY_PROVIDERS` entries after a pin carries this, flipping the hosted catalog column for audit compliance (cloud#3665) and the access-policy console (cloud#3668). Until then `defineStack` accepts both tokens and no runtime provides them; the open edition's `os build` preflight reports them unavailable. ## 维护者速读 - 改了什么:`requires` 新接受两个能力 token:`audit-compliance` 和 `access-policy-console`,与 `governance` 同组(只由云端 objectos-runtime 加载器提供);provider 表各加一行,`package: null`、`edition: 'cloud'`,与 `governance` 同形。 - 为什么改:云端有这两项按环境开通的能力,没有 token 就无法在 stack 里声明,云端只能把它们标成不可用。 - 风险与回滚:只放宽;原来能过的照旧能过,近似拼写(`audit_compliance`、`access-policy`)照旧拒收。本仓不装任何包,开源版 `os build` 对这两个 token 的处理与 `governance` 完全一致(判为仅云端可用并失败)。回滚即还原本 PR。 - 先看:`packages/spec/src/kernel/platform-capabilities.ts`(token 组与两行 provider);`packages/spec/src/stack-requires.test.ts` 新增的 describe。 - 两分钟验证:`pnpm --filter @objectstack/spec exec vitest run src/stack-requires.test.ts src/kernel/platform-capabilities.test.ts`,预期 2 个文件全绿。 - 需要你做的:无,席位落地。 ## What changes - **`PLATFORM_CAPABILITY_TOKENS`** (`packages/spec/src/kernel/platform-capabilities.ts`): `audit-compliance` and `access-policy-console` join the enterprise / cloud-runtime group after `governance`. The group comment now names all four cloud-loader tokens (`ai-seat`, `governance`, `audit-compliance`, `access-policy-console`) and says this repository installs nothing for them. The `PlatformCapabilityProvider.package` docblock that lists the `null`-package tokens names the two new ones too. - **`PLATFORM_CAPABILITY_PROVIDERS`**: `'audit-compliance': { package: null, edition: 'cloud', note: 'cloud audit-compliance tier' }` and `'access-policy-console': { package: null, edition: 'cloud', note: 'cloud access-policy console' }`. No package name is invented: cloud's loader resolves both, and nothing here could install one. - **Changeset**: `@objectstack/spec` minor, carrying the declaration lines above. What does not move: `defineStack`'s refusal path (an unknown token still gets `STACK_CAPABILITY_UNKNOWN`, 422), the `os build` / `os validate` preflight code (it reads the provider table, so both tokens classify `unavailable` exactly as `governance` does), `objectstack serve` (a known token with no core `CAPABILITY_PROVIDERS` row is skipped quietly, as for `ai-seat` / `governance`), and the CLI vocabulary-drift test, which does not enumerate the cloud-only set and needed no edit. ## Tests - `packages/spec/src/stack-requires.test.ts`, new top-level describe: `defineStack` accepts `requires: ['audit-compliance']` and `['access-policy-console']` and passes each through untouched, and accepts all four cloud-loader tokens together. The near misses `audit_compliance`, `auditCompliance`, `access-policy` and `access_policy_console` are each refused with the ADR-0112 envelope: `code` `STACK_CAPABILITY_UNKNOWN`, `status` 422, one `issues` entry naming the token. - `packages/spec/src/kernel/platform-capabilities.test.ts`, new top-level describe: the `package: null` rows are exactly `ai-seat`, `governance`, `audit-compliance`, `access-policy-console`; each of the four is in the vocabulary with `edition: 'cloud'`, `package: null` and a note; both new tokens classify `unavailable` even when every package resolves; the near-miss spellings are not in the vocabulary. <details><summary>Test readings at 36864c4</summary> - `pnpm --filter @objectstack/spec test` (under os-verify-lock): Test Files 829 passed (829), Tests 26276 passed and 1 todo; VERDICT command-exit 0. - `pnpm --filter @objectstack/spec typecheck`: VERDICT command-exit 0; its `check:test-typecheck` leg reads "52 file(s) / 240 error(s) / 131 pinned signature(s) held in test-typecheck-debt.json", so both edited test files compile with no new error. - `pnpm --filter @objectstack/spec check:generated` after the spec build: exit 0, every artifact up to date (nothing to regenerate: the vocabulary is a constant, not a Zod schema, and no reference page lists it). - CLI, after `pnpm --filter '@objectstack/cli^...' build`: `vitest run test/serve-capability-vocabulary.test.ts test/capability-preflight.test.ts`: Test Files 2 passed, Tests 38 passed. - Ablation, once, on `src` (both spec test files import `src`, no `dist` hop): `node scripts/ablation-replace.mjs` removed the `'audit-compliance'` entry from `PLATFORM_CAPABILITY_TOKENS` (anchor 1 → 0, blob 87b422b → 18b32c27). The two edited files went red: Tests 4 failed, 75 passed (79): the provider-map 1:1 pin, the cloud-row pin for `audit-compliance`, and both `defineStack` acceptance pins (refused with "requires: 'audit-compliance' is not a known platform capability"). Restore: blob back to 87b422b, equal to HEAD, `git diff HEAD` empty. A first attempt used a replacement that was a substring of the anchor; the tool refused it before any test ran, so that run measured nothing. </details> ## Acceptance notes - Two comments outside this card's file surface still name only the older cloud tokens as examples: `packages/cli/src/commands/serve.ts:5370` ("`ai-seat`/`governance` by cloud's objectos-runtime — stay quiet for those") and the `validateKnownCapabilities` docblock in `packages/spec/src/stack.zod.ts:6227` ("(`hierarchy-security` / `ai-seat` / `governance`)"). Both describe behaviour that holds for the new tokens too; neither is a defect. Noted, not filed. - PR body: the seat signature line is first and the project attribution block follows it, the shape this project's card PRs use. ## Verification <details><summary>Local gates at 36864c4</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 85 families for the 4 changed paths. All 85 ran after a full `npx turbo run build --concurrency=2` (exit 0), each exit 0. `--ran`: "85 derived, 85 run, 0 NOT-MEASURED, 0 UNRUN", exit 0. - `node scripts/check-changeset-no-major.mjs --base origin/main --event` with this body as the `pull_request` payload: exit 0, "declares clause-② `yes (widening)` and metadata-protocol `added`" and no package moved at `patch`. Control, the same body with `Metadata-protocol: narrowed`: exit 1, naming the missing `(narrowing)` arm. - `node scripts/pm/check-prior-rulings.mjs --card 32011 --terms ...`: exit 0, the 9 hits named above. - `origin/main` moved 8 commits after the branch point (60f8149 → 09bf7de) before this PR opened; none touches the four changed paths (the only `packages/spec/src/kernel` change is `public-auth-features.ts`), so the branch was not re-merged. CI runs the merged tree. - Every CI family (`Lint & Repo Gates`, `TypeScript Type Check`, `Test Core`, the rest) is read from this PR's check-runs, not re-run locally. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzgudmrzv5ZGMtfJQKc)_ <!-- signed: domain:spec#3 · os-support-ai · session_01WGufzh7cM8EmUX4T2CBNHX --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8523ef9 commit 171cf6d

4 files changed

Lines changed: 100 additions & 3 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
feat(spec): `requires` accepts `audit-compliance` and `access-policy-console`, two capabilities cloud's runtime loader resolves, beside `governance`
6+
7+
Clause-②: yes (widening: two new accepted `requires` tokens)
8+
Metadata-protocol: added
9+
Skills-docs: follow-up owed — skills/objectstack-platform/SKILL.md (its Enterprise / cloud bullet names `ai-seat` and `governance` as the cloud-resolved tokens and now omits these two); no `content/docs/**` sentence lists the cloud-loader tokens
10+
11+
- **`PLATFORM_CAPABILITY_TOKENS`** gains `audit-compliance` and `access-policy-console` in the enterprise / cloud-runtime group, so `defineStack({ requires: ['audit-compliance'] })` and `requires: ['access-policy-console']` are accepted at authoring time. Near misses such as `audit_compliance` or `access-policy` are still refused as unknown capabilities (`STACK_CAPABILITY_UNKNOWN`).
12+
- **`PLATFORM_CAPABILITY_PROVIDERS`** gains a row for each in `governance`'s shape: `package: null`, `edition: 'cloud'`, with the notes `cloud audit-compliance tier` and `cloud access-policy console`. This repository installs nothing for either token, so, exactly as for `ai-seat` and `governance`, the `os build` / `os validate` preflight classifies both as unavailable under the open edition and fails with "provided only by a cloud runtime", while `objectstack serve` mounts nothing for them and stays quiet. A stack that declares one is meant for a cloud runtime whose loader provides it.
13+
14+
Nothing that parsed before parses differently.

‎packages/spec/src/kernel/platform-capabilities.test.ts‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,41 @@ describe('push — the mobile push capability', () => {
386386
expect(classifyRequiredCapability('push', (pkg) => pkg === '@objectstack/service-push').status).toBe('ok');
387387
});
388388
});
389+
390+
// The cloud runtime loader resolves a closed set of tokens this repository
391+
// installs nothing for. Each row has `governance`'s shape — `package: null`,
392+
// `edition: 'cloud'`, a note — so the `os build` preflight classifies it
393+
// unavailable rather than advising an install no registry can satisfy.
394+
describe('the cloud-loader-only capability tokens', () => {
395+
const CLOUD_LOADER_TOKENS = ['ai-seat', 'governance', 'audit-compliance', 'access-policy-console'];
396+
397+
it('are exactly the package-less rows', () => {
398+
const packageless = Object.entries(PLATFORM_CAPABILITY_PROVIDERS)
399+
.filter(([, p]) => p.package === null)
400+
.map(([t]) => t);
401+
expect(new Set(packageless)).toEqual(new Set(CLOUD_LOADER_TOKENS));
402+
});
403+
404+
it.each(CLOUD_LOADER_TOKENS)('%s is in the vocabulary with a cloud row, no package and a note', (token) => {
405+
expect(isKnownPlatformCapability(token)).toBe(true);
406+
const row = PLATFORM_CAPABILITY_PROVIDERS[token];
407+
expect(row?.package).toBeNull();
408+
expect(row?.edition).toBe('cloud');
409+
expect(row?.note).toEqual(expect.any(String));
410+
});
411+
412+
it('audit-compliance and access-policy-console are unavailable even when every package resolves', () => {
413+
const allInstalled = () => true;
414+
for (const token of ['audit-compliance', 'access-policy-console']) {
415+
const c = classifyRequiredCapability(token, allInstalled);
416+
expect(c.status, token).toBe('unavailable');
417+
expect(c.provider?.edition, token).toBe('cloud');
418+
}
419+
});
420+
421+
it('their near-miss spellings are not in the vocabulary', () => {
422+
for (const miss of ['audit_compliance', 'auditCompliance', 'access-policy', 'access_policy_console']) {
423+
expect(isKnownPlatformCapability(miss), miss).toBe(false);
424+
}
425+
});
426+
});

‎packages/spec/src/kernel/platform-capabilities.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ export const PLATFORM_CAPABILITY_TOKENS: readonly string[] = Object.freeze([
7676
'webhooks',
7777
// Enterprise / cloud-runtime capabilities (no open-edition provider:
7878
// `hierarchy-security` ships in @objectstack/security-enterprise via
79-
// `plugins[]`; `ai-seat` / `governance` are resolved by cloud's
80-
// objectos-runtime loader only)
79+
// `plugins[]`; `ai-seat` / `governance` / `audit-compliance` /
80+
// `access-policy-console` are resolved by cloud's objectos-runtime loader
81+
// only — this repository installs nothing for them)
8182
'hierarchy-security',
8283
'ai-seat',
8384
'governance',
85+
'audit-compliance',
86+
'access-policy-console',
8487
]);
8588

8689
/**
@@ -139,7 +142,8 @@ export interface PlatformCapabilityProvider {
139142
/**
140143
* npm package whose plugin the runtime loads to satisfy this capability, or
141144
* `null` when the capability is a cloud-runtime tier with no standalone
142-
* package to install (`ai-seat` / `governance`).
145+
* package to install (`ai-seat` / `governance` / `audit-compliance` /
146+
* `access-policy-console`).
143147
*/
144148
readonly package: string | null;
145149
/** Which edition ships an installable version of {@link package}. */
@@ -231,6 +235,8 @@ export const PLATFORM_CAPABILITY_PROVIDERS: Readonly<Record<string, PlatformCapa
231235
},
232236
'ai-seat': { package: null, edition: 'cloud', note: 'cloud AI-seat tier' },
233237
governance: { package: null, edition: 'cloud', note: 'cloud governance tier' },
238+
'audit-compliance': { package: null, edition: 'cloud', note: 'cloud audit-compliance tier' },
239+
'access-policy-console': { package: null, edition: 'cloud', note: 'cloud access-policy console' },
234240
});
235241

236242
/**

‎packages/spec/src/stack-requires.test.ts‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,45 @@ describe('defineStack requires validation', () => {
4747
});
4848
});
4949

50+
// The cloud runtime loader's per-environment tiers are `requires` tokens like
51+
// `governance`: `audit-compliance` and `access-policy-console` are accepted at
52+
// authoring, while their near-miss spellings are still refused as unknown —
53+
// the ADR-0112 envelope, one issue per distinct token.
54+
55+
describe('defineStack requires — the cloud-loader tokens audit-compliance and access-policy-console', () => {
56+
type Envelope = Error & { code?: string; status?: number; issues?: readonly string[] };
57+
const refusalOf = (requires: string[]): Envelope | null => {
58+
try {
59+
defineStack({ requires });
60+
return null;
61+
} catch (e) {
62+
return e as Envelope;
63+
}
64+
};
65+
66+
it.each([['audit-compliance'], ['access-policy-console']])('accepts %s and passes it through untouched', (token) => {
67+
expect(refusalOf([token])).toBeNull();
68+
expect(defineStack({ requires: [token] }).requires).toEqual([token]);
69+
});
70+
71+
it('accepts both beside the other cloud-loader tokens', () => {
72+
const requires = ['ai-seat', 'governance', 'audit-compliance', 'access-policy-console'];
73+
expect(defineStack({ requires }).requires).toEqual(requires);
74+
});
75+
76+
it.each([['audit_compliance'], ['auditCompliance'], ['access-policy'], ['access_policy_console']])(
77+
'still refuses the near miss %s as an unknown capability',
78+
(token) => {
79+
const refused = refusalOf([token]);
80+
expect(refused).toBeInstanceOf(Error);
81+
expect(refused?.code).toBe('STACK_CAPABILITY_UNKNOWN');
82+
expect(refused?.status).toBe(422);
83+
expect(refused?.issues).toHaveLength(1);
84+
expect(refused?.issues?.[0]).toContain(`requires: '${token}' is not a known platform capability`);
85+
},
86+
);
87+
});
88+
5089
// #14153 — `defineStack` refuses an auto-launched flow (record_change /
5190
// schedule / time_relative / api) whose stack does not declare
5291
// `requires: ['triggers']`. Since #20332 that is one arm of two: the triggers

0 commit comments

Comments
 (0)