Skip to content

Commit 57d7b96

Browse files
ci: a v18 → v19 source-upgrade gate — a committed 18.6.0 project and database walked through migrate, validate, build, the protocol switch, --stored and boot, plus a helper-built wiring (#39150)
Fixes #39009 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:这是一道新的持续集成检查,每次有人改动升级工具、转换条目、存储行转换、校验与构建命令或项目模板时(以及每晚),都会拿一个按 18.6.0 真实用户形状搭好的项目和它的数据库,完整走一遍升级到 19 的流程,并逐项报告结果。 - 属于 19.0.0 正式版跟踪卡里"重点解决 18 升 19 的升级"这一部分:之前五个升级缺陷都通过了各自的单元测试,只靠人工验收才发现,这道检查把那次人工验收变成每次都自动跑。 - 这道检查不是必过项,出错只会让它自己变红,不挡任何合并;它等待的最后一张修复卡(迁移工具点名权限集自带的隐藏字段行)已经合入,现在全部检查项都通过,没有预期中的红项,可整体撤回。 - 本改动涉及工作流目录,且改动行数超过人工审阅线,需要你亲手合并;其余无。 ## What changes A new, **non-required** workflow, `Upgrade Source Gate` (`.github/workflows/upgrade-source-gate.yml`), walks the v18 → v19 source upgrade a real 18.x user takes, against this checkout's packed tarballs, with no model key. Its `paths:` name the upgrade tooling, the conversions and the field axis the walk asserts, each by the step that reads it; the nightly run covers the rest of the platform the walk installs and boots: - `os migrate meta` / `apply` / `protocol`, the source writer and the schema migration (`packages/cli/**/migrate*`, `packages/cli/src/utils/authored-source-*`, `packages/cli/src/utils/schema-migrate.ts`); - `os validate` / `os build` and the protocol-range check (`packages/cli/src/commands/{validate,build,compile}.ts`, `packages/cli/src/utils/protocol-version-gap.ts`), and the dry run's own-field-row list T2 reads (`packages/cli/src/utils/own-field-row-narrowing.ts`); - the runtime field axis B5 and B6 exercise (`packages/plugins/plugin-security/src/{permission-evaluator,field-masker,security-plugin-authz-middleware}.ts`, `packages/core/src/security/effective-object-permissions.ts`); - the ADR-0087 conversion table and the chain that replays it (`packages/spec/src/conversions/**`, `packages/spec/src/**/migrations/**`); - the stored-row conversion (`packages/metadata-protocol/src/stored-migration.ts`, `packages/metadata-protocol/src/protocol-stored-*`); - the template (`packages/cli/src/commands/init.ts`, `packages/create-objectstack/**`); - how the walk installs this checkout (`scripts/publish-smoke-pack.mjs`, `.github/actions/setup-workspace/**`); - the gate's own files. It also runs nightly at 04:41 UTC and on `workflow_dispatch`. It is in no required-checks list. Everything else lives in `packages/qa/upgrade-source/`: | Path | What | |---|---| | `fixture-18.6.0/` | An 18.6.0 project shaped like a user's. Scaffolded with `npx create-objectstack@18.6.0 crm18 --skip-skills`, its metadata written with that install's `os generate` and then edited. It holds the blank template's `objectstack.config.ts` with the `exportsOf(…)` wiring unchanged; `crm18_account`, and `crm18_contact` with a master-detail and a lookup to it; list views with `list.bulkActions`; three actions; `crm18_auditor` (View All + Modify All on contacts, plus its own `crm18_contact.salary` row with `readable: false`, the #38924 shape); `crm18_member` (a field row hiding account notes); a validation rule, a record-triggered flow, a dataset, a dashboard; and a committed `access-matrix.json`. `os validate` and `os build` are green on 18.6.0. The object files are `src/objects/{account,contact,note}.ts`, not `*.object.ts`: two platform-objects sweeps import every `*.object.ts` under `packages/`, and `os migrate meta` never reads a file name. | | `fixture-db-18.6.0/` | The SQLite database the **published 18.6.0 CLI** wrote for that project, dumped to deterministic SQL text (the 18.0 upgrade-harness fixture's form). Beside it, `manifest.json` (people, records with their seeded values, the stored view, what 18.6.0 served) and `provenance.json` (the exact command, versions and sha256s; the run checks them). | | `generate-fixture-db.mjs` | The generator behind the database, as the provenance's exact command. It installs the fixture from the npm registry at 18.6.0, runs `os start` from that install, and populates over HTTP. One step is a Studio-style view save (GET, drop a column, PUT), which stores an overlay row still carrying `bulkActions` (the #38923 shape). | | `helper-wiring/` | The second wiring: the same sources behind `composeStacks([createCrmStack(…)])`, the HotCRM shape. It is an overlay laid over a copy of the fixture; its `package.json` is the fixture's under another name, so the type-check coverage walk reads it as a project of its own. | | `run.mjs` | The walk and its 30 assertions, plus `--self-test` (43 cases in 13 pinned batteries, with the verdict handshake). | `scripts/pm/dispatch-gates.self-test.mjs` gains one named row in its census of `no-check-families` declarations: this workflow's, the twelfth. **The walk.** - **P1:** `database.sql` and `manifest.json` hash to what `provenance.json` records. - **Template wiring (T1–T11).** Install from tarballs (T1 scans every name in `overrides.json`, as `scaffold-e2e.yml` does). Run the dry run: T11 requires both dry runs to exit 0 with a JSON report, and T2 requires its `ownFieldRowNarrowing` list to name `crm18_auditor`'s `crm18_contact.salary` row, read-and-edit on 18 → hidden on 19, and the human report to name the same row. T10 pins the dry run's `applied` set: 12 changes by conversion id and path. Then `--write`, a re-run, the `engines.protocol` range in source, `os validate`, and `os build` under a drift rule: every access-matrix drift line must be a View All Fields gain the migration made. - **Data (D1–D4).** `os migrate apply --yes`; `os migrate protocol --to 19 --apply --yes` (the boot names this switch for an 18 database). D3: `--stored` exits 1 with `clean: false` and the view row `servedInvalid` at `list.bulkActions`, pending rewrite. D4: `--stored --apply --yes` rewrites that row. - **Boot (B1–B8).** `os start` on the migrated database. The three people sign in with their 18 passwords. Every seeded record reads back with every seeded value. The stored view is served valid, with its stored columns. The auditor reads every contact but no salary, while the owner reads every salary. The auditor's salary edit is refused `403 PERMISSION_DENIED` (the ruled 19 field axis, #34365). The member reads no account notes, while the owner reads them all. The validation rule still answers `400 VALIDATION_FAILED`. - **Helper wiring (H1–H6).** H1: `--write` writes, or names with the call that built it, every mechanical change and the range. H2: it exits non-zero exactly when it left one by hand. H3–H5: once the named edits are applied, a re-run reports `applied: 0`, and validate and build pass. H6 pins the 15-change `applied` set. **How a red is read.** An assertion that waits on a card (`waitsOn`) counts as an expected red only when two things hold. The red must be the failure that card describes; a step that broke another way, such as a dry run exiting non-zero, flags its red unexpected. And the card must read `open` on the GitHub API in this run. Anything else prints as **UNEXPECTED**. A waiting assertion that passes is a **STALE** entry and keeps the run red until its `waitsOn` is dropped. Each red prints `::error::`, and the step summary is a table of all 30. ## Expected red on current `origin/main` (§C list) None. T2 runs and passes since #39160 (`7f72b4945f`): the dry run's `ownFieldRowNarrowing` names the auditor's own `crm18_contact.salary` row beside Modify All, `protocol18: read-and-edit`, `protocol19: hidden`. No assertion carries a `waitsOn`. On the merge preview of `3abccf0574`, all 30 pass and the job concludes `success`. A negative control against tarballs packed before #39160 reds T2: `the --json report carries no ownFieldRowNarrowing list`. ## Tests - `node packages/qa/upgrade-source/run.mjs --self-test`: `✓ upgrade-source run.mjs self-test: 43 cases in 13 batteries pass.` The workflow runs it first. - The whole walk, on this PR's `Upgrade Source Gate` run. The report on #39009 quotes it. ## Acceptance notes - **Helper-built wiring (ruled A).** On `composeStacks([createCrmStack(…)])`, `--write` writes 0 of 15 and exits 1. Every site is listed `[helper]`, naming `composeStacks(…)`: the honest refusal #38879 delivered. So H1–H6 assert "every change named with its builder, an honest exit, green once the named edits are applied, the set pinned", not "all written". - **Object file names (ruled A).** Explained in the fixture's README. A dot-directory is not an option: `check-affected-docs` pins that no tracked `.ts` under `packages/**` lives in one. - **D2 (ruled kept).** `os start` refuses an 18 database with no `adr-0159-form-type-switch` record, and names `os migrate protocol --to 19 --apply --yes`. - **The 18.6.0 auth flow seen while generating.** After the first sign-up, self-registration is invite-only. The administrator creates users through `/auth/admin/create-user`, and each must change their password before any read. Sign-ins are rate-limited, so both scripts wait out a 429. - **Fixed boot values.** `OS_AUTH_SECRET` and `OS_SECRET_KEY` are published, non-secret values (the key is derived at run time), so any runner can open what 18.6.0 sealed. - **Size.** The diff is 3,124 changed lines (`database.sql` is 590 of them, `run.mjs` 947), over the 3,000-line human-merge line. It is one PR on purpose, and Tier H already. ## Verification Files to read first, by risk: 1. `packages/qa/upgrade-source/run.mjs`: `ASSERTIONS`, `EXPECTED_APPLIED`, `verdict()` and `walk()`. 2. `.github/workflows/upgrade-source-gate.yml`: the `paths:` list, and the absence from any required list. 3. `packages/qa/upgrade-source/fixture-db-18.6.0/provenance.json`, with `generate-fixture-db.mjs`. Two-minute check: `node packages/qa/upgrade-source/run.mjs --self-test` prints `✓ … 43 cases in 13 batteries pass.` For the walk, this PR's `Upgrade Source Gate` run summary shows all 30 assertions PASS and `Verdict: GREEN.` Governed surface: `.github/workflows/**` makes this Tier H, and the maintainer merges it. The workflow does not run named local check families and declares so in its header (`dispatch-gates: no-check-families`), as `scaffold-e2e.yml` does. No published package changes, so the PR is labelled `skip-changeset`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 <!-- signed: repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent eb8895f commit 57d7b96

43 files changed

Lines changed: 3122 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Upgrade-source gate — the v18 → v19 SOURCE upgrade, walked the way a real
2+
# 18.x user walks it, against this checkout's packed tarballs, with no model key.
3+
#
4+
# Every upgrade-path defect found on the GA path passed its own unit tests and
5+
# was caught only by a hand-run acceptance: the migration tool's tests use
6+
# stacks written as literals, while a user's project is the template's
7+
# `exportsOf(…)` wiring over barrels, with a database an 18.x install wrote.
8+
# The two neighbouring gates cover other ground: `scaffold-e2e.yml` builds and
9+
# boots a NEW scaffold, and `upgrade-harness-optin.yml` boots an 18.0 DATABASE
10+
# on main; neither runs the source migration.
11+
#
12+
# The job and its assertions live in `packages/qa/upgrade-source/run.mjs`
13+
# (header: what is walked, and how an assertion that waits on an open card is
14+
# reported); the committed 18.6.0 project and the database the PUBLISHED 18.6.0
15+
# CLI wrote for it sit beside it, with their provenance. The install step is
16+
# scaffold-e2e.yml's: this checkout's publishable packages packed with
17+
# `scripts/publish-smoke-pack.mjs`, and the project's `@objectstack/*` pins
18+
# moved to that version and resolved through the project's own pnpm overrides.
19+
#
20+
# NOT a required check, and green: no assertion waits on an open card. A red
21+
# reads UNEXPECTED unless its `waitsOn` card is open and the red is that card's
22+
# own failure (run.mjs header). It joins the required set only by a later,
23+
# deliberate edit of `scripts/check-required-contexts.mjs`.
24+
#
25+
# Every step below is part of an install/build/migrate/boot pipeline, not a
26+
# named local verification script a dev pre-runs with `pnpm check:x` — there is
27+
# no check family here to discover, deliberately (the scaffold-e2e.yml shape):
28+
# dispatch-gates: no-check-families -- steps are an e2e pipeline, not named local checks
29+
30+
name: Upgrade Source Gate
31+
32+
on:
33+
pull_request:
34+
# Every input the walk runs through, by the step that reads it. A step's
35+
# code missing here lets a PR change what the walk asserts without the walk
36+
# running on it.
37+
paths:
38+
# `os migrate meta` (--write, --stored), `os migrate apply`, `os migrate
39+
# protocol`, the source writer, and the schema migration they share.
40+
- 'packages/cli/**/migrate*'
41+
- 'packages/cli/**/migrate*/**'
42+
- 'packages/cli/src/utils/authored-source-*'
43+
- 'packages/cli/src/utils/schema-migrate.ts'
44+
# `os validate` / `os build`, and the protocol-range check both run.
45+
- 'packages/cli/src/commands/validate.ts'
46+
- 'packages/cli/src/commands/build.ts'
47+
- 'packages/cli/src/commands/compile.ts'
48+
- 'packages/cli/src/utils/protocol-version-gap.ts'
49+
# T2: the dry run's own-field-row list (`ownFieldRowNarrowing`).
50+
- 'packages/cli/src/utils/own-field-row-narrowing.ts'
51+
# The ADR-0087 conversion table (its entries, `conversions/entries/NN/*`)
52+
# and the migration chain and registry that replay it.
53+
- 'packages/spec/src/conversions/**'
54+
- 'packages/spec/src/**/migrations/**'
55+
# The stored-row conversion `--stored` and the boot apply to sys_metadata.
56+
- 'packages/metadata-protocol/src/stored-migration.ts'
57+
- 'packages/metadata-protocol/src/protocol-stored-*'
58+
# B5 and B6: the runtime field axis the boot's reads and writes go through
59+
# (the set's own field row against viewAllFields / Modify All).
60+
- 'packages/plugins/plugin-security/src/permission-evaluator.ts'
61+
- 'packages/plugins/plugin-security/src/field-masker.ts'
62+
- 'packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts'
63+
- 'packages/core/src/security/effective-object-permissions.ts'
64+
# The template a user's project starts from.
65+
- 'packages/cli/src/commands/init.ts'
66+
- 'packages/create-objectstack/**'
67+
# How the walk installs this checkout: the packer and the workspace setup.
68+
- 'scripts/publish-smoke-pack.mjs'
69+
- '.github/actions/setup-workspace/**'
70+
# The gate itself.
71+
- 'packages/qa/upgrade-source/**'
72+
- '.github/workflows/upgrade-source-gate.yml'
73+
schedule:
74+
- cron: '41 4 * * *'
75+
workflow_dispatch:
76+
77+
permissions:
78+
contents: read
79+
80+
# A newer run for the same pull request supersedes this one; the schedule and
81+
# dispatch runs share a group keyed on their own event and wait for each other
82+
# (scaffold-e2e.yml's shape).
83+
concurrency:
84+
group: upgrade-source-gate-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.after || github.ref }}
85+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
86+
87+
jobs:
88+
upgrade-source:
89+
name: v18 → v19 source upgrade
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 45
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v7
95+
96+
- name: Setup workspace
97+
uses: ./.github/actions/setup-workspace
98+
99+
- name: Setup turbo cache
100+
uses: actions/cache@v6
101+
with:
102+
path: .turbo/cache
103+
key: ${{ runner.os }}-turbo-${{ github.job }}-${{ github.sha }}
104+
restore-keys: |
105+
${{ runner.os }}-turbo-${{ github.job }}-
106+
${{ runner.os }}-turbo-
107+
108+
# The runner's pure judgements, on fixtures, before anything is built.
109+
- name: Self-test the runner
110+
run: node packages/qa/upgrade-source/run.mjs --self-test
111+
112+
# The build set is read off the fixture's own package.json, never a hand
113+
# list: each `@objectstack/*` dependency it declares, with turbo's
114+
# `^build` bringing that package's workspace dependencies along.
115+
- name: Build the framework the fixture depends on
116+
run: |
117+
FILTERS=$(node -p '
118+
const pkg = require("./packages/qa/upgrade-source/fixture-18.6.0/package.json");
119+
const names = [pkg.dependencies, pkg.devDependencies]
120+
.flatMap((deps) => Object.keys(deps ?? {}))
121+
.filter((name) => name.startsWith("@objectstack/"));
122+
if (names.length === 0) throw new Error("the fixture declares no @objectstack/* dependency");
123+
names.map((name) => "--filter=" + name).join(" ");
124+
')
125+
echo "turbo run build $FILTERS"
126+
# shellcheck disable=SC2086 # FILTERS is a word list on purpose.
127+
pnpm exec turbo run build $FILTERS
128+
129+
- name: Pack this checkout's publishable packages
130+
run: node scripts/publish-smoke-pack.mjs "$RUNNER_TEMP/tarballs"
131+
132+
# Template wiring (migrate meta --write, re-run, range, validate, build),
133+
# the 18.6.0 database (migrate apply, the protocol-19 switch, --stored),
134+
# the boot and its reads, then the helper-built wiring. The summary lists
135+
# every assertion, and names the card each red waits on.
136+
# GITHUB_TOKEN reads (only) the state of each card an expected red waits
137+
# on: a red is excused only while its card reads open.
138+
- name: Walk the v18 → v19 upgrade
139+
env:
140+
GITHUB_TOKEN: ${{ github.token }}
141+
run: node packages/qa/upgrade-source/run.mjs --tarballs "$RUNNER_TEMP/tarballs" --work "$RUNNER_TEMP/upgrade-source"
142+
143+
- name: Upload the walk's logs
144+
if: always()
145+
uses: actions/upload-artifact@v7
146+
with:
147+
name: upgrade-source-logs
148+
path: |
149+
${{ runner.temp }}/upgrade-source/logs
150+
${{ runner.temp }}/upgrade-source/results.json
151+
if-no-files-found: ignore
152+
retention-days: 14
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Upgrade-source gate (v18 → v19)
2+
3+
The source-upgrade path a real 18.x user takes, walked end to end against this
4+
checkout by `.github/workflows/upgrade-source-gate.yml`. No model key is used
5+
anywhere.
6+
7+
| Path | What it is |
8+
|---|---|
9+
| `fixture-18.6.0/` | An 18.6.0 project shaped like a user's (see below). Never edited to suit 19: it is the "before". |
10+
| `fixture-db-18.6.0/` | The SQLite database the **published** 18.6.0 CLI wrote for that project, as SQL text, with `manifest.json` (what was put in it, and what 18.6.0 served) and `provenance.json` (the command, the versions, the hashes). |
11+
| `generate-fixture-db.mjs` | The generator behind `fixture-db-18.6.0/`. Run it again rather than editing its output. |
12+
| `helper-wiring/` | The second wiring: the same sources behind `composeStacks(createCrmStack(…))`, the shape a larger app (HotCRM) takes. It is an overlay laid over a copy of the fixture (its `package.json` is the fixture's under another name). |
13+
| `run.mjs` | The walk and its assertions (`--self-test` covers its pure judgements). The header lists every step. |
14+
15+
## Why here, and why the object files are not named `*.object.ts`
16+
17+
The fixture's `.ts` files are 18.6.0 sources, and this checkout's 19 spec
18+
refuses them (`view.list.bulkActions`), which is the point. So nothing in this
19+
repository may type-check or import them:
20+
21+
- `packages/` is outside the root type-check program (`tsconfig.json` excludes
22+
it), and this directory has no `package.json`, so it is not a workspace member.
23+
`fixture-18.6.0/` and `helper-wiring/` each carry a `package.json` (the
24+
helper's is the fixture's under another name): the type-check coverage walk
25+
skips a directory with one as another project's, which is what each of them is.
26+
- Two `platform-objects` sweeps import every `*.object.ts` under `packages/` as
27+
code this repository ships; only the scaffolding templates are excluded, by
28+
name. So the fixture's object files are `src/objects/account.ts`, `contact.ts`
29+
and `note.ts`, and the barrel imports them by those names. `os migrate meta`
30+
never reads a file name: the wiring and every metadata shape are as 18.6.0
31+
wrote them. ⛔ Do not use a dot-directory instead: `check-affected-docs` pins
32+
that no tracked `.ts` under `packages/**` lives in one.
33+
34+
`fixture-18.6.0/package.json` pins `18.6.0`, and the runner moves those pins to
35+
the checkout's version, as a user's upgrade does.
36+
37+
## The fixture
38+
39+
It was scaffolded with `npx create-objectstack@18.6.0 crm18 --skip-skills`, and
40+
its metadata was written with that install's own `os generate` and then edited
41+
by hand. `os validate` and `os build` pass on 18.6.0. It holds:
42+
43+
- the blank template's `objectstack.config.ts`, with its `exportsOf(…)` wiring unchanged;
44+
- `crm18_account`, and `crm18_contact` with a master-detail and a lookup to it;
45+
- list views carrying `list.bulkActions`, and three actions;
46+
- `crm18_auditor`: View All and Modify All on contacts, plus its own row hiding `crm18_contact.salary`;
47+
- `crm18_member`, with a field row hiding the account notes;
48+
- a validation rule, a record-triggered flow, a dataset and a dashboard;
49+
- a committed `access-matrix.json` (written by 18.6.0's `os build --update-access-matrix`).
50+
51+
The sample `note` object from the template stays, because a user's project
52+
usually still has it. The template's Dockerfile, docs and starter test are left
53+
out: the gate does not use them.
54+
55+
## The database
56+
57+
`node packages/qa/upgrade-source/generate-fixture-db.mjs` (needs the npm
58+
registry, pnpm and Node 22.13 or later) does the following:
59+
60+
1. Installs the fixture from the registry at its 18.6.0 pins.
61+
2. Builds it and boots it with that install's own `os start` on a new SQLite file.
62+
3. Signs up the owner. On 18.6.0 self-registration then closes, so the owner
63+
creates the member and the auditor, and each sets their own password.
64+
4. Assigns the two permission sets and creates three accounts and four contacts.
65+
5. Saves the contact list view the way Studio does: GET, drop a column, PUT. The
66+
save is stored as an overlay row that still carries `bulkActions`.
67+
6. Records what 18.6.0 served for the reads the gate asserts on 19, then stops
68+
the server and dumps the database.
69+
70+
`OS_AUTH_SECRET` and `OS_SECRET_KEY` are fixed, published values (see
71+
`FIXTURE_ENV`). They protect nothing; they let any runner open what 18.6.0
72+
sealed.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
.objectstack/
4+
*.log
5+
.DS_Store
6+
.env
7+
.env.*
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"version": 1,
3+
"entries": [
4+
{
5+
"permissionSet": "crm18_auditor",
6+
"object": "crm18_account",
7+
"create": false,
8+
"read": true,
9+
"edit": false,
10+
"delete": false,
11+
"viewAllRecords": true,
12+
"modifyAllRecords": false,
13+
"sharingModel": "private"
14+
},
15+
{
16+
"permissionSet": "crm18_auditor",
17+
"object": "crm18_contact",
18+
"create": false,
19+
"read": true,
20+
"edit": true,
21+
"delete": true,
22+
"viewAllRecords": true,
23+
"modifyAllRecords": true,
24+
"sharingModel": "private"
25+
},
26+
{
27+
"permissionSet": "crm18_member",
28+
"object": "crm18_account",
29+
"create": false,
30+
"read": true,
31+
"edit": false,
32+
"delete": false,
33+
"viewAllRecords": false,
34+
"modifyAllRecords": false,
35+
"readScope": "org",
36+
"sharingModel": "private"
37+
},
38+
{
39+
"permissionSet": "crm18_member",
40+
"object": "crm18_contact",
41+
"create": true,
42+
"read": true,
43+
"edit": true,
44+
"delete": false,
45+
"viewAllRecords": false,
46+
"modifyAllRecords": false,
47+
"readScope": "own",
48+
"sharingModel": "private"
49+
}
50+
]
51+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { defineStack } from '@objectstack/spec';
2+
import { ConnectorRestPlugin } from '@objectstack/connector-rest';
3+
import { ConnectorOpenApiPlugin } from '@objectstack/connector-openapi';
4+
import { ConnectorMcpPlugin } from '@objectstack/connector-mcp';
5+
import * as objects from './src/objects';
6+
import * as views from './src/views';
7+
import * as actions from './src/actions';
8+
import * as flows from './src/flows';
9+
import * as dashboards from './src/dashboards';
10+
import * as apps from './src/apps';
11+
import * as skills from './src/skills';
12+
import * as picklists from './src/picklists';
13+
import * as permissions from './src/security';
14+
import * as datasets from './src/datasets';
15+
16+
// Every value a barrel exports, as the list a stack key takes: typed by what
17+
// the barrel exports, and an empty list while it exports nothing yet.
18+
const exportsOf = <M extends object>(barrel: M): M[keyof M][] => Object.values(barrel);
19+
20+
// This file is a MODULE, and the whole module is the stack: the default
21+
// export below is the base, and every NAMED export is merged onto it as a
22+
// top-level stack key under its own name. A helper exported from here is
23+
// therefore read as a stack key and the build refuses it — keep helpers in a
24+
// sibling module and import them. Only names the stack schema declares
25+
// (onEnable, functions, the collections) belong here as named exports.
26+
export default defineStack({
27+
manifest: {
28+
id: 'com.example.crm18',
29+
namespace: 'crm18',
30+
version: '0.1.0',
31+
type: 'app',
32+
name: 'Crm18',
33+
// Protocol compatibility range: the metadata-protocol major this app is
34+
// authored against. The runtime checks it before it loads anything, so a
35+
// runtime outside the range refuses this app at the boundary with the exact
36+
// migration command instead of crashing later. Scaffolding stamped it to
37+
// match the ObjectStack version you installed — change it when you
38+
// deliberately move to a new protocol major, not to silence a mismatch.
39+
// Guide: https://objectstack.ai/docs/upgrading
40+
engines: { protocol: '^18' },
41+
},
42+
43+
// `automation` backs flow execution and materializes any declarative
44+
// `connectors:` entry into a live, dispatchable connector at boot. The
45+
// connector executors below register their provider factories with it —
46+
// without `automation` loaded they have nowhere to register and boot fails,
47+
// so keep this capability whenever `plugins:` lists a connector.
48+
//
49+
// `triggers` fires a flow that starts on a record change, the kind
50+
// `objectstack generate flow NAME` writes: without it this config stops
51+
// loading once it holds such a flow. It can go if this project will never
52+
// hold one.
53+
requires: ['automation', 'triggers'],
54+
55+
// Generic connector executors, default-present so you can add a `connectors:`
56+
// entry naming `provider: 'rest' | 'openapi' | 'mcp'` and have it materialize
57+
// with zero host code. Zero-arg = contribute the provider factory only. Brand
58+
// connectors (Slack, …) stay marketplace/opt-in.
59+
// Security: a declarative `mcp` stdio transport spawns a local process from
60+
// metadata, so it is denied by default — opt in per host with
61+
// `new ConnectorMcpPlugin({ declarativeStdio: ['<trusted-command>'] })`.
62+
// Authoring guide: https://objectstack.ai/docs/automation/connectors
63+
plugins: [
64+
new ConnectorRestPlugin(),
65+
new ConnectorOpenApiPlugin(),
66+
new ConnectorMcpPlugin(),
67+
],
68+
69+
// Every directory `objectstack generate` writes into is wired here: its
70+
// index.ts exports what the directory holds, and each list below hands
71+
// those exports to the stack. `objectstack generate view NAME` adds a file
72+
// and one export line, and the view is part of this stack with no edit to
73+
// this file. A directory that is not wired here is never loaded, and
74+
// `objectstack validate` neither counts nor checks what it holds.
75+
objects: exportsOf(objects),
76+
views: exportsOf(views),
77+
actions: exportsOf(actions),
78+
flows: exportsOf(flows),
79+
dashboards: exportsOf(dashboards),
80+
apps: exportsOf(apps),
81+
skills: exportsOf(skills),
82+
picklists: exportsOf(picklists),
83+
permissions: exportsOf(permissions),
84+
datasets: exportsOf(datasets),
85+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://schemas.objectstack.dev/template-manifest.json",
3+
"namespace": "crm18",
4+
"displayName": "Crm18",
5+
"readmePath": "README.md"
6+
}

0 commit comments

Comments
 (0)