Skip to content

Commit 0ca5218

Browse files
docs(skills): a generated platform catalog, and objectstack-project asks "does the platform ship it?" (#35572)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg646vnpLvaexGfHCmasWBga)_ Fixes #35345 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:写元数据应用的人在加对象、字段或流程之前,技能先让他翻一份自动生成的平台能力目录:平台已经带的(用户、附件、评论、审计、通知、邮件、汇率、导入、审批、共享、队列、Webhook、设置)直接用;平台没有而别的应用也会要的,先给平台立卡、应用里自建并打标记。平台本身的运行行为不变。 - 为什么做:跨套件主数据那项决定要求"先查平台有没有"成为建应用的固定一步;没有这份目录,各应用会各自重建平台已有的对象,升级时成双份。 - 出错会怎样:只涉及技能文本与一份生成的参考页;目录若与平台源码不一致,生成门禁会红而不会发出错版本;撤回本次合并即可,无数据影响。 - 要你做什么:无,席位复核后落地(一个技能文件的字数上限按卡上的裁决记录抬了一行,正文有算账)。 ## 席位核对 ### What changes **1. The platform catalog, generated.** `skills/objectstack-project/references/platform-catalog.md` is emitted by the existing `packages/spec/scripts/build-skill-references.ts` (the `check:skill-refs` generator), so the same `--check` leg verifies it and the generated manifest proves its ownership. The hand lists live in a new `packages/spec/scripts/lib/platform-catalog.ts` — outside `packages/spec/src/**`, nothing exported from the package: - `APP_FACING_OBJECT_GROUPS` — 30 objects in six groups (people and organizations; files, comments and history; notifications and mail; money, imports and approvals; sharing, ownership and routing; integration and settings). Each row: the object, what the app would otherwise build, how the app reaches it. The **name** column is not typed into the page: every row must be a member of `PLATFORM_PROVIDED_OBJECT_NAMES` and the "Mounted by" column is derived from `PLATFORM_OBJECTS_BY_PACKAGE` (`packages/spec/src/system/constants/platform-object-names.ts:37`, `:193`). - `VALUE_DOMAIN_ROWS` — a `Record<ValueDomain, …>`, so a member added to `ValueDomainSchema` (`packages/spec/src/shared/value-domain.zod.ts:96-100`) is a type error until the catalog names it; the field names come from `VALUE_DOMAIN_FIELD_NAMES` (`:114-118`, whose jsdoc already says this catalog reads it). The section's paragraph states what `main` does: the write refuses a non-member; forms pick the currency code from ISO 4217 (`ui/packages/fields/src/widgets/TextField.tsx`, the `iso_4217_currency` swap only); a time zone or a country is a plain text input, and no list or filter reads the domain; a text field named like one without the domain is an `os lint` warning (`field/missing-value-domain`). - `CAPABILITY_ROWS` — one line per token of `PLATFORM_CAPABILITY_TOKENS` (`packages/spec/src/kernel/platform-capabilities.ts`), with the mounting package from `PLATFORM_CAPABILITY_PROVIDERS` and the always-on set from `PLATFORM_ALWAYS_ON_CAPABILITIES`. - `NOT_PLATFORM_ROWS` — party master data (customers, suppliers, contacts) and item master data (materials, products, plants): one app owns each, another matches by the ruled keys (country plus credit code or registration number; material number and plant code), no platform object — ruling A on #35328. - `PLANNED_ROWS` — two rows, each **not available**: units → ADR-0158 (contract accepted, nothing shipped); working calendars → #35340 (carded, contract in design). The section's paragraph says an interim unit field stores the contract's UN/ECE Rec 20 codes (`H87`, `KGM`) as option values with the business's spellings as labels, which is what eval 22 asserts. `catalogProblems()` refuses a Planned row whose state reads as usable, a relative link or a bare `#NNNNN`, and more than four rows (ADR-0049: a planned row never reads as shipped). `catalogProblems()` runs before `renderPlatformCatalog()`; a problem makes `check:skill-refs` fail with "hand-written rows disagree with packages/spec/src" instead of emitting a page. Every hand-written paragraph is in the exported `PROSE` constant and every hand-written string is summed by `handWrittenBytes()` (see the pin test): the page is generator-owned for the ratchet, but its prose has an author who pays. **2. The pin test** `packages/spec/scripts/platform-catalog.test.ts` (53 cases with the sibling guards file): the live catalog has no problem; every object row is registered, unique, both columns filled; the subset leaves out the kernel-only objects (`sys_jwks` and friends); capability keys equal the token set, value-domain keys equal `ValueDomainSchema.options`; a fabricated catalog passes, and one with `sys_fictional`, a duplicate, an empty cell, a stranger token, a missing domain, a usable-sounding Planned row, a bare id, a relative link or five Planned rows is refused — each named; the generator source imports the lib, guards before rendering, and manages only the catalog path; and a **pricing leg** holds the hand-written text under a shrink-only ceiling in the ratchet's own measure, `ceil(utf8 bytes / 4)`: 6331 bytes → 1583 tokens on the first round, 6321 bytes → 1581 after the second (the Planned paragraph's unit-code clause, paid by four cuts in `PROSE`; the pin lowered to the measurement), raised only by the ratchet header's path (cut first, then the measured remainder under the standing ruling), with the derived names, packages, editions and boot flags left out so a token the spec adds costs one description line. **3. Gate edits (read these as gate edits — the claim amendment 7012111198 widened the file surface for exactly them):** - `scripts/pm/check-governed-merges.mjs` — ONE line: the `spec-skill-refs` row's `candidate` regexp is now `/^skills\/[^/]+\/references\/(?:_index|platform-catalog)\.md$/`. The regexp is the narrowing gate; the manifest still proves each file is generator-owned, so a hand edit to the catalog stays governed. No other row or rule touched. - `scripts/check-skills-token-ratchet.mjs` — the self-test's pinned excluded-path list names `skills/objectstack-project/references/platform-catalog.md` (without it the ratchet prices a generated file as hand-authored and every regeneration turns it red); and the `skills/objectstack-project/SKILL.md` ceiling row is raised `2901 → 2990`, with the raise's authority (the standing path, ruling record 6513306068, alone) and arithmetic in the row's comment (see Verification › skills readings); the `skills/objectstack-data/rules/field-types.md` row is lowered `3553 → 3541` to its measurement. - `scripts/pm/check-governed-merges.mjs --self-test` — two cases in the `#11705` battery (floor 23 → 25): the catalog path routes to the `spec-skill-refs` row while four near-miss spellings (another folder, `.mdx`, `-catalogue`, `.md.bak`) stay governed; and the catalog's prose source location is pinned — the generator's import resolves to a module under the row's `trustedGeneratorPrefixes` that exports `PROSE`. **4. `skills/objectstack-project/SKILL.md`.** §0 is now "Three questions before any work": the third asks "Does the platform ship it?" — read the catalog, use what it lists; absent, and a second app would copy it, file a platform card at `objectstack-ai/objectstack` and build the app's own meanwhile, marked `// PLATFORM-CANDIDATE: <link>`; textually apart from §3 ("a defect is never worked around; a missing capability may be built and marked"). §5 step 4 sweeps the `PLATFORM-CANDIDATE` markers beside the `PLATFORM-GAP` tests. Question 3 (`:46-51`) follows the "Default to own use" paragraph that belongs to question 2 (`:42-44`), so the two questions read apart; the MCP-only sentence (`:53`, "only §0 and §3 apply") covers the new question through §0. Paid for by two same-file cuts: the "read it from there afterwards" clause in question 2 and the "Inject the defect and run the command" aside in §2 (its instruction survives in the §2 retire paragraph, `:134-137`). **5. `skills/objectstack-data/rules/field-types.md`.** The currency paragraph (`:170-172`) gains one sentence, in its current wording: "Likewise `'iana_time_zone'` (`Asia/Shanghai`) and `'iso_3166_alpha2'` (`CN`) on a `text` field: the write refuses a non-member, so never a free-text or picklist copy." The `// per record:` literal stays (`:160-161`): it is the one place the data skill shows `homeAmount` nested inside `currencyConfig`, and eval 24 expects that shape. Paid for in the same file by four restatement cuts — the `localization.currency` sentence (said by the roll-up paragraph's "metadata never names the home currency"), the `password` row's "never hashed" aside (said by "PLAINTEXT at rest"), the autonumber "(it grows, never wraps)" aside (said by "a MINIMUM, not a cap") and its `CASE-{0000}` example (in the table above it), and "for every one" after `--all-organizations` — and the row is lowered to the measurement, 3553 → 3541, to bank the headroom (shrink-only). **6. Evals.** `skills/objectstack-project/evals/project-process.json` 7–9 (an attachments table → `sys_attachment` + `files: true`; a business-hours calendar → a platform card + `PLATFORM-CANDIDATE`, not "Blocked by"; an audit table → `sys_audit_log` / `sys_activity`). `skills/objectstack-data/evals/objects-fields-relationships.json` 22–24 (a free-text unit → a `select` whose option values are the contract's UN/ECE Rec 20 codes in exact uppercase, `H87` for a piece, `KGM`, `XBX`, with the business's spellings as labels, so the platform unit table later adds validation and leaves stored values unchanged — ADR-0158 U1/U2 — plus `PLATFORM-CANDIDATE`; country and time zone → the two value domains, a plain text input for both, no picklist, no regex; an exchange-rate table → `sys_exchange_rate` + `homeAmount`). **7. Changeset** `.changeset/35345-skills-platform-catalog.md`, `@objectstack/skills: patch`, the two declaration lines copied in. No `@objectstack/spec` changeset: `packages/spec`'s `files[]` does not ship `scripts/`, and nothing under `src/` moved. **Not in this PR (ruled out of scope):** a value-domain lint, a shadow-object lint, `.claude/skills/pm-dispatch/**`. Sibling #35442 (`packages/mcp/**`) is file-disjoint; overlap-check at `origin/main` clean, 0 PR heads. ### Per-row reach readings (every catalog row says how the app reaches the object; these are the sources) <details><summary>Object rows: what each `sys-*.object.ts` exposes</summary> `enable.apiEnabled` defaults to true; `apiMethods` undefined = all six primitives, `['get','list']` = read-only over REST. - People and organizations — `sys_user` `apiMethods: ['get','list','update','bulk']` + `aiReadable` (`plugin-security/src/objects/sys-user.object.ts:1661-1689`); `sys_organization` `['get','list','update']` (`sys-organization.object.ts:560-583`); `sys_business_unit` default-open (`:297-304`; apps seed it, `stack.zod.ts:2886`); `sys_team` `['get','list']` (`:243-255`; approvers `'team'`, `approval.zod.ts:35`); `sys_user_position` full CRUD (`:223-229`; positions distribute permission sets, ADR-0090). - Files, comments and history — `sys_file` / `sys_attachment` `apiEnabled: true` (`sys-attachment.object.ts:141-144`), uploads through `/api/v1/storage/upload/...`, the `enable.files` switch (`object.zod.ts:392`); `sys_comment` (`:319-322`) with `enable.feeds` (`object.zod.ts:401`); `sys_activity` `['get','list']` (`:431-435`) with `enable.activities`; `sys_audit_log` `['get','list']` (`:690-694`; the `audit` capability token is opt-in); `sys_recycle_bin` `apiEnabled: false` (`:119-123`) — reached only through `POST /api/v1/data/:object/recycle-bin/:entryId/restore` (`rest/recycle-bin-routes.test.ts:78`), which is what the row says. - Notifications and mail — `sys_notification` `['get','list']` (`:271-274`); `sys_inbox_message` (`:162`); `sys_email` (`:288-291`); `sys_mailbox` and `sys_mail_message` are `managedBy: 'engine-owned'` (`packages/services/service-mailbox/src/objects/sys-mailbox.object.ts:33`, `sys-mail-message.object.ts:36`), served through get and list only, the mailbox to `manage_mailboxes` holders; `requires: ['mailbox']` mounts the objects and the ingest seam and syncs no mailbox — rows exist only where the host composes `MailboxServicePlugin({ imap })` with an account source (`packages/services/service-mailbox/README.md:5`, `:11-12`, `:30`); no Setup entry names the mailbox; `mailAssociation` field type (`field.zod.ts:2016`). Both rows say so. - Money, imports and approvals — `sys_exchange_rate` `apiEnabled` (`:170-173`) read by `homeAmount` (`field.zod.ts:779`); `sys_import_job` `['get','list']` (`:148-152`) created through `POST /data/:object/import/jobs`; `sys_approval_request` `['get','list']` + `aiReadable` (`:943-957`); `sys_approval_action` `['get','list']`; `sys_approval_delegation` full (`:235-241`). - Sharing, ownership and routing — `sys_record_share` `['get','list']` (`:326-329`); `sys_share_link` (`:299-305`); `sys_sharing_rule`, `sys_queue`, `sys_queue_member`, `sys_assignment_rule` unrestricted, authored through the stack keys `sharingRules` / `queues` / `assignmentRules` (`stack.zod.ts:1001`, `:1013`, `:1022`). - Integration and settings — `sys_webhook` full CRUD, stack key `webhooks` (`stack.zod.ts:1061`); `sys_setting` `['get','list']` (`:249-259`); `sys_personal_view` default-open (`:133-137`). Actions may target platform objects (`stack.zod.ts:6071-6082`). </details> ### Tests - `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 scripts/` — the new `platform-catalog.test.ts` plus the existing `skill-map-guards.test.ts` (output in Verification). - `check:skill-refs` round-trips the catalog (`gen:skill-refs` then `--check`, in sync, 10 files + the catalog); `check:skill-identifier-liveness` picks the catalog's rows up with no wiring change (Leg 1 reads table rows whose first cell is one backticked identifier). - Evals are fixtures, not executed here (no eval runner in CI); each case was written against the SKILL text it exercises. ### Acceptance notes Read first, by risk: (1) `packages/spec/scripts/lib/platform-catalog.ts` — the `APP_FACING_OBJECT_GROUPS` rows and `PLANNED_ROWS` (the hand-written prose the page carries); (2) `skills/objectstack-project/SKILL.md` §0 question 3 (`:46-51`) and §5 step 4 (`:179-181`); (3) `scripts/pm/check-governed-merges.mjs`, the one regexp line. Two-minute check: open `skills/objectstack-project/references/platform-catalog.md`; every object row shows a `sys_*` name, a package, a "what you would otherwise build" cell and a reach cell; the Planned table has two rows, both marked **not available**, each linking to its contract. Then `pnpm --filter @objectstack/spec gen:skill-refs && git status --short skills/` prints nothing. ### Verification Final head `1295eb7c33b9bb1714f0c71ffb2a47f767c78a56` (`373171be` the work, `fd1c7203` one pre-PR merge of `origin/main` at `c890070f`, `1295eb7c` the role-word reword). Local scope per os-dev 〈本地验证范围〉: the touched package built, typechecked and its `scripts/` tests run under the verify lock; the derived gate families run unlocked; every exit code captured before any pipe (`cmd :: exit N` record, reconciled with `dispatch-gates --ran`). `packages/spec/src/**` is untouched, so the package's full `src/` suite is CI's. <details><summary>Locked runs (OS_VERIFY_LOCK_SLOT=card-35345), on 373171b's tree</summary> ``` pnpm --filter @objectstack/spec build :: exit 0 pnpm --filter @objectstack/spec typecheck :: exit 0 (covers check:scripts-typecheck for the new lib + test) pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 scripts/ :: exit 0 Test Files 81 passed (81) · Tests 1641 passed (1641) · VERDICT command-exit 0 · held the lock 9m31s re-run at 1295eb7 (after the reword): vitest run scripts/platform-catalog.test.ts scripts/skill-map-guards.test.ts Test Files 2 passed (2) · Tests 53 passed (53) · VERDICT command-exit 0 ``` </details> <details><summary>Derived gate families — dispatch-gates --commands (158 commands at fd1c720) → --ran reconciliation</summary> ``` dispatch-gates --ran: 126 derived famil(ies) accounted for — 121 run, 5 NOT-MEASURED (5 DERIVED from a recorded exit 3), 0 UNRUN exit 0: 151 of 161 recorded commands exit 3 (PREREQUISITE NOT MET, a built package or a deep clone this box has not; nothing measured — CI's): node scripts/check-plugin-teardown-shape.mjs --self-test (fixture pinned to a commit outside the shallow clone) pnpm --filter @objectstack/lint run check:doc-formula-expressions (@objectstack/formula not built) pnpm --filter @objectstack/lint run check:doc-security-posture (@objectstack/lint not built) pnpm --filter @objectstack/spec run check:skill-examples (client-react dist absent) pnpm check:docs-transcript-drift · check:dual-build-cjs-loads · check:i18n-coverage · check:lean-entry-closure (dist absent) exit 1: pnpm check:role-word :: exit 1 → the generated page's sys_user_position row said "user-to-role"; reworded to "user-to-position" in the lib, page regenerated (1295eb7); re-run :: exit 0 pnpm --dir ui exec vitest run scripts/ :: exit 1 → Test Files 2 failed | 169 passed | 2 skipped; Tests 27 failed | 5050 passed. Both failing files are ui/scripts/__tests__/date-only-zone-pins-10183.test.ts (27: each spawned ui package test "ran no case at all: expected 0 to be greater than 0") and unit-registry-absence-collision.test.ts (2). Neither reads skills/**, packages/spec/scripts/** or the two root scripts this PR touches; the failures are the spawned ui package runs finding nothing to run on this box (no ui build). Not re-run locally; the family is CI's. ``` Re-run at 1295eb7 after the reword, all exit 0: `check:role-word`, `check:skill-refs` (in sync), `check-skills-token-ratchet` (+ `--self-test`, 104 cases), `check-governed-merges --self-test` (911 assertions; the live `spec-skill-refs` row keeps the catalog governed through the manifest), `check-skill-identifier-liveness` (Leg 1 545 citations), `check-skill-links` (269 links), `check-doc-authoring`, `check-nul-bytes`, `check-closing-keyword-parity`, `check-issue-citations`, `overlap-check --branch=HEAD` (clean, 0 PR heads), `check:commit-card-trailers --range origin/main..HEAD` (3 commits, model-free pair). </details> <details><summary>Fix round 1 (L2 record 7015659227) — head 0626f7e, local gates</summary> ``` locked (OS_VERIFY_LOCK_SLOT=card-35345, NODE_OPTIONS=--max-old-space-size=4096): pnpm --filter @objectstack/spec typecheck && vitest run --maxWorkers=2 scripts/platform-catalog.test.ts scripts/skill-map-guards.test.ts :: exit 0 Test Files 2 passed (2) · Tests 56 passed (56) · VERDICT command-exit 0 (a first attempt with the default 2 GB heap OOMed inside check:test-typecheck's tsc; the earlier full run had the larger heap) unlocked, exit 0 each: node scripts/pm/check-governed-merges.mjs --self-test (913 assertions) · node scripts/check-skills-token-ratchet.mjs · --self-test (104) · pnpm --filter @objectstack/spec run check:skill-refs (in sync, 10 files) · pnpm check:role-word · check-skill-identifier-liveness · check-skill-links · check-doc-authoring · check-nul-bytes · check-issue-citations · check-closing-keyword-parity · overlap-check --branch=HEAD (clean) · check:commit-card-trailers --range origin/main..HEAD (4 commits) ``` </details> Dogfood battery: n/a — no `!` in the title and no `(narrowing)` arm. MCP GitHub calls: reads only (`issue_read` on the card and its comments); REST writes: none (the PR and the report comment go through the relay and `post-stamped.mjs`). <details><summary>skills readings — per file, lines and tokens (ratchet measure: ceil(utf8 bytes/4), stamp line excluded)</summary> | File | Before (lines · tokens/ceiling) | After (lines · tokens/ceiling) | |:--|:--|:--| | `skills/objectstack-project/SKILL.md` | 206 · 2900/2901 | 213 · 2990/2990 (ceiling raised +89, see below) | | `skills/objectstack-data/rules/field-types.md` | 265 · 3553/3553 | 267 · 3541/3541 (the `homeAmount` literal back, four restatement cuts, row lowered to the measurement) | | `skills/objectstack-project/references/platform-catalog.md` | — | 155 · 2668 (generator-owned, measured, not ratcheted); its hand-written text 1581 tokens, ceiling 1581 in the pin test | | `skills/objectstack-project/evals/project-process.json` | 108 | 156 (eval fixture, measured, not ratcheted) | | `skills/objectstack-data/evals/objects-fields-relationships.json` | 387 | 438 (eval fixture) | </details> <details><summary>skills readings — whole package</summary> | Bundle total | Before | After | |:--|:--|:--| | sum of all `SKILL.md` (tokens) | 63935 | 64025 (+90: this card's SKILL.md) | | ratcheted (authored) tokens / ceilings | 195676 / 200598 | 195754 / 200675 | | generator-owned (measured, not ratcheted) | 11885 | 14553 (+2668: the catalog) | | eval fixtures (measured, not ratcheted) | 67411 | 69045 (+1634: six cases) | | whole shipped tree | 274972 | 279352 | **The ceiling raise, 2901 → 2990 on `skills/objectstack-project/SKILL.md`.** Authority: the standing path alone, ruling record 6513306068 (「A:先削重复,余额按实测提高」), on its own form — two same-file cuts first (142 bytes: the §2 "Inject the defect" aside, whose technique survives in §2's retire sentence, and the §0 "read it from there afterwards" clause, restated by the same sentence), then the measured remainder, +89 tokens, with the row pinned AT the measurement (2990/2990, zero headroom). Scope: this card's — the maintainer's 「立卡 p1」 on it (2026-11-19); no ruling orders the wording and none is cited for it. `field-types.md` is paid in full in its own file; its row is untouched. </details> <details><summary>Premise readings A1–A4 (re-anchored at origin/main 94fb8db, then c890070; all hold)</summary> - A1 — `skills/objectstack-project/SKILL.md:26` was "Two questions"; §3 `:133-144` defects only; `:45` MCP-only builds apply §0 and §3; §5 step 4 at `:172-173` swept blocked issues and `PLATFORM-GAP` tests. After: §0 `:26` three questions, question 3 `:46-51` (after the own-use paragraph `:42-44`), §5 step 4 `:179-181`, MCP sentence `:53`. - A2 — `packages/spec/src/shared/value-domain.zod.ts:96-100` three members, `:114-118` `VALUE_DOMAIN_FIELD_NAMES`; `platform-object-names.ts:37` `PLATFORM_OBJECTS_BY_PACKAGE`, `:177` `CLOUD_PROVIDED_OBJECT_NAMES`, `:193` `PLATFORM_PROVIDED_OBJECT_NAMES`. The generator reads all four; nothing added to `packages/spec/src/**`. - A3 — `skills/objectstack-ai/SKILL.md:209` `list_objects` filters system objects by default, so an MCP build cannot discover the platform objects by listing: the catalog is their only door, which is why question 3 is inside §0 (the MCP-only set). - A4 — `check:skill-refs` = `tsx scripts/build-skill-references.ts --check` (`packages/spec/package.json:281`); the catalog is emitted through the same `createSink` emit/flush, managed by its own `manageDir` call (objectstack-project is not in `SKILL_MAP`, unchanged); `check:skill-identifier-liveness` walks `skills/**/*.md` including `references/` (its self-test pins that) — Leg 1 counted 545 citations on this tree, the catalog's included. </details> **Deviations from the dispatch order:** none in scope. Two items for L2: (a) the ceiling raise above (the order says pay for added skill bytes; the SKILL.md remainder could not be cut from this file without deleting an instruction, so it went the standing path with the arithmetic in the row — accepted by the seat as a deviation beyond amendment 7012111198); (b) branch is `claude/project-thread-1d1bw6` (claim amendment 7011960871). `main` was merged once, before this PR was opened (token rule: pre-PR). **Fix round 1 (L2 record 7015659227 → head 0626f7e):** M1 the value-domain paragraph and eval 23 now state what `main` does (write refusal; ISO 4217 picker for the currency code only; plain text input for a time zone or a country; no list or filter reads the domain). M2 the `sys_mailbox` row: engine-owned, read-only for `manage_mailboxes` holders, mounted by `requires: ['mailbox']`, rows only where the host composes an IMAP account source, no Setup entry; the `sys_mail_message` row says where its rows come from. S1 the ceiling row and this body cite 6513306068 alone; the card's own grading is its scope. S2 the hand-written text is priced in the pin test (1583/1583, shrink-only). S3 eval 22 expects Rec 20 codes as values. S4 the `homeAmount` literal is back, paid by four same-file cuts. N1 positions distribute permission sets. N2 question 3 moved after the own-use paragraph (a reorder, +1 byte: 11977 → 11978, still 2990 tokens). N5 two governed-merges self-test cases (the catalog and its near misses; the prose source pinned under the trusted prefix). N6 the ruled keys on both master-data rows. Not taken: N3 (restoring the §2 aside costs bytes this file cannot pay; its technique is in the retire sentence), N4 (a per-package mounting table is not a cheap fix; the fallback is true for the rows on the page), N7 (a follow-up card for a domain-skill pointer, the seat's). The body's "+89 subtotal pin" line is gone (no such hunk); the size is the measured one. **Fix round 2 (L2 delta d1 PASS 7016983755, the seat's routing → head f4ab3b4):** S5 the catalog's Planned paragraph states the unit codes an interim field stores (`H87`, `KGM` as values, the business's spellings as labels), so eval 22's literals have a home in the published text; paid inside the hand-written ceiling by four cuts in `PROSE` ("If the platform ships it, use it." — §0 question 3 says it; "instead of building the service"; the Planned paragraph's repeated "(objectstack-project §0, question 3)" and "today"; "Maintainers regenerate this" → "Regenerate"; "this page, not the runtime, is where to look" → "look here, not at the runtime"), 6321 bytes → 1581, pin lowered. N10 the ceiling comment reads the file's current bytes (11978, ceil(11958/4) = 2990). N11 the `field-types.md` row lowered 3553 → 3541. Left as the seat said: N8, N9. Local at f4ab3b4, all exit 0: spec typecheck + the two pin tests (56/56) under the lock; governed self-test (913), ratchet + self-test, skill-refs, role-word, liveness, links, doc-authoring, nul, citations, closing-keyword, overlap, commit trailers (5 commits). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CbQCBay2ZapF4WUt1Y <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CbQCBay2ZapF4WUt1Y --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7411f9b commit 0ca5218

11 files changed

Lines changed: 1043 additions & 18 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): a generated platform catalog, and `objectstack-project` asks "does the platform ship it?" before any new object, field or flow
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`objectstack-project` gains `references/platform-catalog.md`, generated from `@objectstack/spec`: the platform objects an app would otherwise build (users, attachments, comments, the audit trail, notifications, mail, exchange rates, imports, approvals, sharing, queues, webhooks, settings), each with what it replaces and how the app reaches it; the three value domains and the field names that should declare them; every `requires` capability switch with what it mounts; the master data that stays with each app; and a short Planned section whose rows are marked not available and link to their contract.
11+
12+
Its §0 asks a third question: check the catalog before adding an object, a field or a flow; use what the platform ships; when it is absent and a second app would copy it, file a platform card and build the app's own meanwhile, marked `// PLATFORM-CANDIDATE: <link>`. §5's bump sweep now retires those markers beside the `PLATFORM-GAP` tests. A defect (§3) is still never worked around; the new question is about a missing capability.
13+
14+
`objectstack-data`'s currency paragraph now teaches `valueDomain` for a time zone (`iana_time_zone`) and a country (`iso_3166_alpha2`) beside the currency code.
15+
16+
Six new eval cases (an attachments table, a business-hours calendar, a change-history table, a free-text unit, a country and time zone, an exchange-rate table) expect the platform object, the value domain, or a platform card with the marker.

‎packages/spec/scripts/build-skill-references.ts‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import path from 'path';
2828
import { exportListDescription } from './lib/export-list';
2929
import { findModuleDocBlock } from './lib/file-description';
3030
import { createSink, type Owns } from './lib/generated-output';
31+
import { PLATFORM_CATALOG_PATH, catalogProblems, renderPlatformCatalog } from './lib/platform-catalog';
3132
import {
3233
SHARED_CORE_SCHEMAS,
3334
TRANSITIVE_ALLOWLIST,
@@ -445,8 +446,21 @@ function main() {
445446
totalSkills += 1;
446447
}
447448

449+
// The platform catalog (lib/platform-catalog.ts): the one page that tells a
450+
// metadata-app project what the platform already ships. Its skill,
451+
// objectstack-project, has no SKILL_MAP entry (it teaches process, not a
452+
// schema), so its `references/` folder is managed for this ONE file and
453+
// nothing else — a hand-written note beside it is left alone, and no
454+
// `_index.md` is claimed there. The names on the page come from the
455+
// contract package; the hand-written rows are refused before emit when one
456+
// names an object, token or domain the package does not declare.
457+
const catalogProblemList = catalogProblems();
458+
const catalogAbs = path.resolve(REPO_ROOT, PLATFORM_CATALOG_PATH);
459+
manageDir(path.dirname(catalogAbs), (abs) => path.resolve(abs) === catalogAbs);
460+
if (catalogProblemList.length === 0) emit(catalogAbs, renderPlatformCatalog());
461+
448462
flush({
449-
surface: 'skills/*/references/_index.md',
463+
surface: 'skills/*/references/_index.md and the platform catalog',
450464
regenerate: ' pnpm --filter @objectstack/spec gen:skill-refs\n git add skills',
451465
guard: () => {
452466
// A dangling SKILL_MAP entry drops a schema pointer from a shipped skill.
@@ -460,6 +474,14 @@ function main() {
460474
` schema's current path, or drop the entry if the concept is gone.`
461475
);
462476
}
477+
if (catalogProblemList.length) {
478+
return (
479+
`The platform catalog's hand-written rows disagree with packages/spec/src:\n\n` +
480+
catalogProblemList.map((p) => ` - ${p}`).join('\n') +
481+
`\n\n Fix the rows in packages/spec/scripts/lib/platform-catalog.ts — a row names only\n` +
482+
` what the contract package declares.`
483+
);
484+
}
463485
// Nothing emitted means nothing compared; "no drift" would read as green.
464486
if (totalSkills === 0) return `No skills found under ${path.relative(REPO_ROOT, SKILLS_DIR)} — nothing to generate.`;
465487
return null;

‎packages/spec/scripts/lib/platform-catalog.ts‎

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* Pins over the platform catalog (`lib/platform-catalog.ts`), the page
5+
* `build-skill-references.ts` emits at `skills/objectstack-project/references/platform-catalog.md`.
6+
*
7+
* The page's names are generated from the contract package and its prose is
8+
* authored beside the generator, so the one thing a gate cannot see — a
9+
* hand-written row naming an object the registry does not hold — is what
10+
* these tests refuse. Three legs, as `skill-map-guards.test.ts` has:
11+
*
12+
* - the LIVE leg asks the real lists the questions the generator asks, so a
13+
* row that goes stale (an object retired, a token renamed) reds here and
14+
* in `check:skill-refs` alike;
15+
* - the BEHAVIOUR leg drives `catalogProblems` over fabricated inputs, one
16+
* that must be refused per rule and one that must pass, so neither an
17+
* always-green nor an always-red guard survives;
18+
* - the WIRING leg reads the generator and asserts it calls the guard and
19+
* emits the page at the one shared path.
20+
*/
21+
22+
import fs from 'node:fs';
23+
import path from 'node:path';
24+
import url from 'node:url';
25+
26+
import { describe, expect, it } from 'vitest';
27+
28+
import { PLATFORM_PROVIDED_OBJECT_NAMES } from '../src/system/constants/platform-object-names';
29+
import { PLATFORM_CAPABILITY_TOKENS, RETIRED_PLATFORM_CAPABILITY_GUIDANCE } from '../src/kernel/platform-capabilities';
30+
import { ValueDomainSchema } from '../src/shared/value-domain.zod';
31+
import {
32+
APP_FACING_OBJECT_GROUPS,
33+
CAPABILITY_ROWS,
34+
PLANNED_ROWS,
35+
PLATFORM_CATALOG_PATH,
36+
PROSE,
37+
VALUE_DOMAIN_ROWS,
38+
catalogProblems,
39+
handWrittenBytes,
40+
renderPlatformCatalog,
41+
} from './lib/platform-catalog';
42+
43+
const HERE = path.dirname(url.fileURLToPath(import.meta.url));
44+
const GENERATOR = path.resolve(HERE, 'build-skill-references.ts');
45+
46+
const allRows = APP_FACING_OBJECT_GROUPS.flatMap((g) => g.rows);
47+
48+
describe('the live catalog — every name is one the contract package declares', () => {
49+
it('refuses nothing on the real lists', () => {
50+
expect(catalogProblems()).toEqual([]);
51+
});
52+
53+
it('names only registered platform objects, each once, each with both prose columns', () => {
54+
const names = allRows.map((r) => r.name);
55+
expect(new Set(names).size).toBe(names.length);
56+
for (const row of allRows) {
57+
expect(PLATFORM_PROVIDED_OBJECT_NAMES.has(row.name), row.name).toBe(true);
58+
expect(row.builds.trim().length, row.name).toBeGreaterThan(0);
59+
expect(row.reach.trim().length, row.name).toBeGreaterThan(0);
60+
}
61+
});
62+
63+
it('is an app-facing SUBSET: infrastructure objects stay out', () => {
64+
expect(allRows.length).toBeLessThan(PLATFORM_PROVIDED_OBJECT_NAMES.size);
65+
for (const infra of ['sys_jwks', 'sys_oauth_access_token', 'sys_scim_user', 'sys_metadata', 'sys_migration']) {
66+
expect(allRows.some((r) => r.name === infra), infra).toBe(false);
67+
}
68+
});
69+
70+
it('covers every capability token exactly, and no retired one', () => {
71+
expect(Object.keys(CAPABILITY_ROWS).sort()).toEqual([...PLATFORM_CAPABILITY_TOKENS].sort());
72+
for (const retired of Object.keys(RETIRED_PLATFORM_CAPABILITY_GUIDANCE)) {
73+
expect(retired in CAPABILITY_ROWS, retired).toBe(false);
74+
}
75+
});
76+
77+
it('covers every value domain exactly', () => {
78+
expect(Object.keys(VALUE_DOMAIN_ROWS).sort()).toEqual([...ValueDomainSchema.options].sort());
79+
});
80+
81+
it('keeps the planned section short, linked by URL, and never readable as usable', () => {
82+
expect(PLANNED_ROWS.length).toBeGreaterThan(0);
83+
expect(PLANNED_ROWS.length).toBeLessThanOrEqual(4);
84+
const page = renderPlatformCatalog();
85+
for (const row of PLANNED_ROWS) {
86+
expect(row.link).toMatch(/^https:\/\//);
87+
expect(page).toContain(`| ${row.concept} | **not available**`);
88+
}
89+
});
90+
91+
it('renders a page with no bare internal issue id and one row per object', () => {
92+
const page = renderPlatformCatalog();
93+
expect(page).not.toMatch(/(?<![#&])#[0-9]{3,5}(?![0-9A-Za-z])/);
94+
for (const row of allRows) expect(page).toContain(`| \`${row.name}\` |`);
95+
for (const token of PLATFORM_CAPABILITY_TOKENS) expect(page).toContain(`| \`${token}\` |`);
96+
for (const domain of ValueDomainSchema.options) expect(page).toContain(`| \`${domain}\` |`);
97+
// Pure: two renders are byte-identical, which is what makes `--check` honest.
98+
expect(renderPlatformCatalog()).toBe(page);
99+
});
100+
});
101+
102+
describe('catalogProblems — refuses a wrong row, passes a right one', () => {
103+
const registry = new Set(['sys_real']);
104+
const tokens = ['tok'];
105+
const domains = ['dom'];
106+
const good = {
107+
groups: [{ title: 'g', rows: [{ name: 'sys_real', builds: 'x', reach: 'y' }] }],
108+
capabilityRows: { tok: 'mounts' },
109+
valueDomainRows: { dom: { builds: 'x', example: 'y' } },
110+
plannedRows: [{ concept: 'c', state: 'nothing shipped', link: 'https://example.invalid/c' }],
111+
registry,
112+
tokens,
113+
domains,
114+
};
115+
116+
it('passes a consistent fabricated catalog', () => {
117+
expect(catalogProblems(good)).toEqual([]);
118+
});
119+
120+
it('refuses a row naming an object the registry does not hold', () => {
121+
const problems = catalogProblems({ ...good, groups: [{ title: 'g', rows: [{ name: 'sys_fictional', builds: 'x', reach: 'y' }] }] });
122+
expect(problems).toHaveLength(1);
123+
expect(problems[0]).toContain('sys_fictional');
124+
expect(problems[0]).toContain('PLATFORM_PROVIDED_OBJECT_NAMES');
125+
});
126+
127+
it('refuses a duplicate row and an empty prose column', () => {
128+
const problems = catalogProblems({
129+
...good,
130+
groups: [{ title: 'g', rows: [{ name: 'sys_real', builds: 'x', reach: 'y' }, { name: 'sys_real', builds: ' ', reach: 'y' }] }],
131+
});
132+
expect(problems.some((p) => p.includes('listed twice'))).toBe(true);
133+
expect(problems.some((p) => p.includes('empty "what you would otherwise build"'))).toBe(true);
134+
});
135+
136+
it('refuses a capability table that is not exhaustive, or names an unknown token', () => {
137+
expect(catalogProblems({ ...good, capabilityRows: {} })).toEqual([expect.stringContaining('capability tok: no catalog line')]);
138+
expect(catalogProblems({ ...good, capabilityRows: { tok: 'm', nope: 'm' } })).toEqual([expect.stringContaining('capability nope: not in PLATFORM_CAPABILITY_TOKENS')]);
139+
});
140+
141+
it('refuses a value-domain table that misses a member or names a stranger', () => {
142+
expect(catalogProblems({ ...good, valueDomainRows: {} })).toEqual([expect.stringContaining('value domain dom: no catalog line')]);
143+
expect(catalogProblems({ ...good, valueDomainRows: { dom: { builds: 'x', example: 'y' }, bcp47: { builds: 'x', example: 'y' } } }))
144+
.toEqual([expect.stringContaining('value domain bcp47: not in ValueDomainSchema')]);
145+
});
146+
147+
it('refuses a planned row that reads as usable, links by bare id, or exceeds the cap', () => {
148+
const usable = catalogProblems({ ...good, plannedRows: [{ concept: 'c', state: 'available now', link: 'https://example.invalid/c' }] });
149+
expect(usable).toEqual([expect.stringContaining('reads as usable')]);
150+
const bareId = catalogProblems({ ...good, plannedRows: [{ concept: 'c (#12345)', state: 'nothing shipped', link: 'https://example.invalid/c' }] });
151+
expect(bareId).toEqual([expect.stringContaining('bare internal issue id')]);
152+
const relative = catalogProblems({ ...good, plannedRows: [{ concept: 'c', state: 'nothing shipped', link: '../x.md' }] });
153+
expect(relative).toEqual([expect.stringContaining('absolute URL')]);
154+
const five = Array.from({ length: 5 }, (_, i) => ({ concept: `c${i}`, state: 'nothing shipped', link: 'https://example.invalid/c' }));
155+
expect(catalogProblems({ ...good, plannedRows: five })).toEqual([expect.stringContaining('capped')]);
156+
});
157+
158+
it('renderPlatformCatalog throws rather than emitting a refused catalog (wired through the same guard)', () => {
159+
// The live lists pass, so the throw is pinned by reading the source: the
160+
// render asks catalogProblems() first and refuses on any problem.
161+
const src = fs.readFileSync(path.resolve(HERE, 'lib/platform-catalog.ts'), 'utf-8');
162+
expect(src).toMatch(/const problems = catalogProblems\(\);\s*if \(problems\.length > 0\) \{\s*throw/);
163+
});
164+
});
165+
166+
describe('pricing — the hand-written text is ratcheted, shrink-only', () => {
167+
// The page is generator-owned for `check-skills-token-ratchet` (its bytes
168+
// are a function of this module and the contract package), so no CEILINGS
169+
// row prices it there. Its prose is still customer context every project
170+
// reads before it builds, and the author who can pay is the one editing
171+
// this module — so the ceiling lives here, over the hand-written part only
172+
// (`handWrittenBytes`: paragraphs, titles, both prose columns, descriptions,
173+
// the "Not owned" and "Planned" rows), in the ratchet's own measure,
174+
// ceil(utf8 bytes / 4). The derived names, packages, editions and boot
175+
// flags are not counted, so a token the spec adds costs one description.
176+
//
177+
// Shrink-only: lower the number when text is cut. Raising it follows the
178+
// ratchet header's path — cut restated text first, then raise by the
179+
// measured remainder under the standing ruling it names — with the
180+
// arithmetic in the PR body, and pinned AT the measurement.
181+
// 6331 bytes -> ceil(6331 / 4) = 1583 (2026-11-19, the PR that adds the page)
182+
// 6321 bytes -> 1581 (the same PR's second review round: the Planned paragraph
183+
// gained the unit-code clause, paid by four cuts in PROSE; lowered to the measurement)
184+
const HAND_WRITTEN_CEILING_TOKENS = 1581;
185+
186+
it('measures every hand-written string the page carries and nothing derived', () => {
187+
const page = renderPlatformCatalog();
188+
for (const line of Object.values(PROSE).flat()) expect(page).toContain(line);
189+
for (const row of allRows) {
190+
expect(page).toContain(row.builds);
191+
expect(page).toContain(row.reach);
192+
}
193+
// A derived cell is not priced: the owning package is on the page but in no hand-written string.
194+
expect(page).toContain('| `sys_user` | ');
195+
expect(Object.values(PROSE).flat().join('\n')).not.toContain('plugin-security');
196+
});
197+
198+
it(`keeps the hand-written text at or under ${HAND_WRITTEN_CEILING_TOKENS} tokens`, () => {
199+
const tokens = Math.ceil(handWrittenBytes() / 4);
200+
expect(tokens, `hand-written text is ${tokens} tokens; the ceiling is shrink-only — cut text, or raise it by the ratchet's path`).toBeLessThanOrEqual(HAND_WRITTEN_CEILING_TOKENS);
201+
});
202+
203+
it('counts bytes, so a longer description moves the measure', () => {
204+
const before = handWrittenBytes();
205+
const longer = { ...CAPABILITY_ROWS, ai: `${CAPABILITY_ROWS.ai} and more` };
206+
expect(Object.values(longer).join('').length).toBeGreaterThan(Object.values(CAPABILITY_ROWS).join('').length);
207+
expect(before).toBe(handWrittenBytes()); // pure: the same tree measures the same
208+
});
209+
});
210+
211+
describe('wiring — the generator emits the page at the shared path through the guard', () => {
212+
const src = fs.readFileSync(GENERATOR, 'utf-8');
213+
214+
it('imports the catalog module and calls the guard before emit', () => {
215+
expect(src).toContain("from './lib/platform-catalog'");
216+
expect(src).toContain('catalogProblems()');
217+
expect(src).toContain('renderPlatformCatalog()');
218+
expect(src.indexOf('catalogProblems()')).toBeLessThan(src.indexOf('renderPlatformCatalog()'));
219+
});
220+
221+
it('emits at PLATFORM_CATALOG_PATH and manages only that file in the folder', () => {
222+
expect(src).toContain('PLATFORM_CATALOG_PATH');
223+
expect(PLATFORM_CATALOG_PATH).toBe('skills/objectstack-project/references/platform-catalog.md');
224+
expect(src).toMatch(/manageDir\(path\.dirname\(catalogAbs\), \(abs\) => path\.resolve\(abs\) === catalogAbs\)/);
225+
});
226+
227+
it('fails the run on catalog problems rather than skipping the page', () => {
228+
expect(src).toContain("hand-written rows disagree with packages/spec/src");
229+
});
230+
});

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,11 @@ export const CEILINGS = new Map([
11111111
// headroom, ceiling +204, pinned AT the measurement. Standing ruling (2026-10-27,
11121112
// tap A, verbatim and untranslated): 「A:先削重复,余额按实测提高」; recognised path per
11131113
// ruling record 6513306068.
1114-
['skills/objectstack-data/rules/field-types.md', 3553],
1114+
// 3553 -> 3541 (2026-11-19): the `homeAmount` literal returned to the currency
1115+
// block and the time-zone / country sentence landed, paid by four same-file
1116+
// restatement cuts that over-paid by 12 tokens; the row is lowered to the
1117+
// measurement so the headroom is banked, not spent later. Shrink-only.
1118+
['skills/objectstack-data/rules/field-types.md', 3541],
11151119
['skills/objectstack-data/rules/indexing.md', 3241],
11161120
// 1590 -> 1909 (#32364, 2026-11-11): § Sealing (`seal`) teaches `lifecycle.seal`
11171121
// (+1574 B). PAID DOWN FIRST by three same-file restatements (-296 B): the ❌
@@ -2058,7 +2062,25 @@ export const CEILINGS = new Map([
20582062
// 10011). The PR that adds the row is Tier H and lands only on an authorized
20592063
// approval, which is the pricing act the header reserves to the maintainer.
20602064
// ceil(($(wc -c < skills/objectstack-project/SKILL.md) - 20) / 4) == ceil(11603 / 4)
2061-
['skills/objectstack-project/SKILL.md', 2901],
2065+
// 2901 -> 2990 (2026-11-19): §0 gains its third question — check the generated
2066+
// platform catalog before adding an object, a field or a flow; use what the
2067+
// platform ships; a missing capability a second app would copy is a platform
2068+
// card, built meanwhile under a `PLATFORM-CANDIDATE` marker — and §5 step 4
2069+
// sweeps those markers beside the `PLATFORM-GAP` tests. The SCOPE is the
2070+
// card's — the maintainer graded it 「立卡 p1」 (2026-11-19) after the skills
2071+
// platform-first analysis; no ruling orders the wording, and none is cited
2072+
// for it. The AUTHORITY for the raise is the standing path alone, on its own
2073+
// form: PAID DOWN FIRST by two same-file cuts, 142 bytes — §2's "Unsure
2074+
// whether a check exists? Inject the defect and run the command: if it fails,
2075+
// the platform checks it." (its technique survives in §2's retire sentence;
2076+
// the aside for an author unsure a check exists does not) and §0's "and read
2077+
// it from there afterwards" (restated by the same sentence's "Record the
2078+
// answer ... once") — then the measured remainder: `wc -c` = 11978 bytes,
2079+
// stamp line 20 -> ceil(11958 / 4) = 2990 tokens, zero headroom, ceiling +89,
2080+
// pinned AT the measurement. Raise path: the standing ruling (2026-10-27,
2081+
// verbatim and untranslated) 「A:先削重复,余额按实测提高」, recognised per
2082+
// ruling record 6513306068.
2083+
['skills/objectstack-project/SKILL.md', 2990],
20622084
]);
20632085

20642086
/**
@@ -2860,6 +2882,7 @@ function selfTest() {
28602882
'skills/objectstack-formula/references/_index.md',
28612883
'skills/objectstack-i18n/references/_index.md',
28622884
'skills/objectstack-platform/references/_index.md',
2885+
'skills/objectstack-project/references/platform-catalog.md',
28632886
'skills/objectstack-query/references/_index.md',
28642887
'skills/objectstack-ui/references/_index.md',
28652888
'skills/objectstack-ui/references/react-blocks.md',

0 commit comments

Comments
 (0)