Skip to content

Commit 18600c3

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-esfn9k
2 parents 61f2a99 + c1f311f commit 18600c3

95 files changed

Lines changed: 5172 additions & 1522 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(console): administrators of a production deployment that keeps its data on its own disk see a standing notice on the home page and System Overview
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- **`@object-ui/app-shell`.** The home page and Setup's System Overview open with a notice, for workspace administrators the server also admits, when the deployment reports what it keeps on its own disk (`GET /api/settings/deployment/notice`): the database file, the generated sign-in secret and the data key file, each in business terms with its path and variable, then the lower-severity lines for local uploads and no email service. "Copy the settings" puts the variables to set on the clipboard, each with the value it takes (the file to carry the current value over from). "Hide" records the acknowledgement on the server's audit log and keeps the notice hidden for that administrator in that browser until the findings change; System Overview then keeps one small line with "Show again". No dialog; a member's browser never asks.
12+
- **`@object-ui/i18n`.** A new `deploymentNotice` block (18 keys) in all ten packs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/cli': patch
3+
'@objectstack/service-settings': patch
4+
---
5+
6+
fix(cli): the official image refuses to start on a disk it would lose; every other production `os start` says what it keeps there, and administrators see it in the Console
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- **`@objectstack/cli` (the official image).** With `OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED=true`, which the official image now sets in its `ENV`, `os start` exits 1 unless `OS_DATABASE_URL`, `OS_AUTH_SECRET` and `OS_SECRET_KEY` are all set explicitly (their legacy names count, and so do `--database` / `--auth-secret` and a database the project config declares). It names the missing ones before it writes a database file or a secret, and says how a deployment already running on generated values carries them over: the files in the container's home, and which of them the container holds. An explicit `OS_DATABASE_URL=file:/path/on/a/volume/app.db` passes. A value of the switch that is not `true`/`false`/`1`/`0` is refused rather than read as off. **Upgrading an image deployment that ran on its defaults:** read `auth-secret` and `dev-crypto-key` (and `data/objectstack.db`) out of the old container's `/home/node/.objectstack` and set them before you start the new one.
12+
- **`@objectstack/cli` (every other `os start`).** Unchanged: it keeps booting. In production mode, when it keeps its database, its sign-in secret or its data key on its own disk because nobody set them, it prints a block naming each file and the variable that moves it off that disk, and hands the same facts to the server process on the internal `OS_INTERNAL_DEPLOYMENT_FINDINGS` channel.
13+
- **`@objectstack/service-settings`.** Two routes behind the settings door, for callers holding `manage_platform_settings`: `GET /api/settings/deployment/notice` answers what this production deployment keeps on its own disk (the database file, the generated sign-in secret, the data key file) plus two lower-severity lines (uploads on the local disk; no email service that delivers), and `POST /api/settings/deployment/notice/hide` records an administrator's acknowledgement of exactly what they read as a `config_change` row on `sys_audit_log`. A member is refused `403`, the state is not on the public auth config, a hide is refused `409` where no audit log is mounted or the notice changed since it was read, and outside production mode the notice is empty. No package export is added.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/runtime': patch
3+
'@objectstack/cli': patch
4+
'@object-ui/data-objectstack': patch
5+
---
6+
7+
fix(runtime,cli): the dispatcher's `/meta` permission refusal applies a deployment's `errors.permission_denied` override; `os package install` says which env variables count as credentials
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
- `@objectstack/runtime`: the `HttpDispatcher` meta read gate now hands the request's i18n service lookup, as `RestServer` does, so an `errors.permission_denied` override reads the same on both doors. Without an i18n service, or when it fails, the built-in sentence is served and the refusal stays a 403.
13+
- `@objectstack/cli`: the `--token` conflict refusal of `os package install` now says that `OS_RUNTIME_EMAIL`/`OS_RUNTIME_PASSWORD` count as `--email`/`--password`.
14+
- `@object-ui/data-objectstack`: the README and a doc comment quote the current refusal sentence. No behaviour change.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/service-settings': patch
3+
---
4+
5+
feat(service-settings): the namespace read lists what is stored beneath a field an `OS_*` variable pins, so Setup can tell whether "clear the saved value" has anything to clear
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
- **Now.** `getNamespace()`, the read `GET /api/settings/:namespace` serves, answers a key whose `OS_*` override is in force with the same `value`, `source: 'env'`, `locked: true` and `lockedReason` as before, and its `cascadeChain` now lists, below the `env` entry, the entries the key's read carries with no override in force: the stored rows the caller's cascade draws on (`global`, `tenant`, `user`, each with its own lock), then `default`. The `env` entry stays first and is still the only one flagged `effective`. An entry at the key's declared scope with a non-null value is the value a clear (`null`, accepted through a pin since the ADR-0007 D6 amendment) removes; after that clear the entry reads `null`.
11+
- **Secrets.** A secret key's entries beneath a pin carry the read mask when a value is stored and `null` when none is, in process too; the stored secret is never decrypted for them, so a key pinned because its stored secret no longer decrypts still reads.
12+
- **Unchanged.** `get()` and `getMany()` still answer an override in force from the env alone, without reading the store: they are the reads request paths call. An override whose value coerces to `null` keeps its single `env` entry, because any non-null entry listed below it would read as the effective one.
13+
- **Cost.** A pinned key joins the namespace read's existing grouped row load, so the read costs one more load only when every key of a group is pinned.

‎content/docs/deployment/self-hosting.mdx‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ workable default:
3434
| Variable | Why it must be set |
3535
|:---|:---|
3636
| `OS_DATABASE_URL` | Without it, data lands in a SQLite file under the ObjectStack home directory (`~/.objectstack`, or `<cwd>/.objectstack` next to a project config) — fine for one box, wrong for containers. Use `postgres://…`, `mysql://…`, `mongodb://…`, `libsql://…`, or a mounted `file:…` path (`postgres://…`'s driver is an **optional** package too — `npm install pg`, or the boot fails loudly rather than degrading to SQLite; `libsql://` / Turso is inferred, but its driver is an **optional** package — `npm install @objectstack/driver-turso`, or the boot fails loudly rather than degrading to SQLite; see [Drivers](/docs/data-modeling/drivers)). `mysql://…` is a supported deployment target that carries three dialect caveats — two of them integrity guarantees MySQL cannot enforce at the database — see [Drivers → MySQL dialect caveats](/docs/data-modeling/drivers#mysql-dialect-caveats) before choosing it; its driver is likewise an **optional** package — `npm install mysql2`, or the boot fails loudly rather than degrading to SQLite. `mongodb://…` is **single-tenant only**: the MongoDB driver has no row-level tenant isolation and refuses to boot unless the tenancy posture is `single` — see [Drivers → Multi-tenancy](/docs/data-modeling/drivers#multi-tenancy-not-supported). |
37-
| `OS_AUTH_SECRET` | Session secret for the auth plugin (`AUTH_SECRET` is the legacy alias). Without it, `/api/v1/auth/*` is **silently skipped** — the server runs unauthenticated. |
37+
| `OS_AUTH_SECRET` | Session secret for the auth plugin (`AUTH_SECRET` is the legacy alias). Without it, `os start` generates one and keeps it in `auth-secret` under the ObjectStack home directory, reused on restart: lose that file (a replaced container) and everyone is signed out. |
3838
| `OS_SECRET_KEY` | 32-byte master key encrypting every stored secret (`openssl rand -hex 32`). On a container's ephemeral filesystem the auto-minted key is **lost on restart**, making previously-encrypted secrets undecryptable. |
3939
| `OS_PORT` | `os start` **fails loudly** if the port is busy (it never auto-shifts like `os dev`). Pin it and keep your reverse-proxy upstream in sync. |
4040

@@ -45,6 +45,40 @@ OS_AUTH_SECRET=$(openssl rand -hex 32)
4545
OS_SECRET_KEY=$(openssl rand -hex 32)
4646
```
4747

48+
### When the three are not set
49+
50+
**The official image refuses to start** unless `OS_DATABASE_URL`,
51+
`OS_AUTH_SECRET` and `OS_SECRET_KEY` are all set explicitly. It exits naming
52+
the ones that are missing, before it writes a database file or a secret: a
53+
container's disk is the part that gets replaced, so booting on it would lose
54+
the data, sign everyone out and leave every saved credential unreadable. The
55+
image turns the check on with `OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED=true` in
56+
its `ENV`.
57+
58+
- An explicit `OS_DATABASE_URL=file:/path/on/a/volume/app.db` passes: SQLite on
59+
a mounted volume stays a choice ([below](#docker-compose-with-postgres)).
60+
- **Already running on values the image generated?** Carry them over before you
61+
set new ones, or the saved credentials stop decrypting and every session
62+
ends. They are files in the old container's home, `/home/node/.objectstack`
63+
(`docker exec <container> cat <file>`, or read them from its volume):
64+
`OS_AUTH_SECRET` is the contents of `auth-secret`, `OS_SECRET_KEY` the
65+
contents of `dev-crypto-key`, and the data is `data/objectstack.db`
66+
(`OS_DATABASE_URL=file:…` on a kept volume, or migrate it to your database).
67+
The refusal prints these paths and says which of them the container holds.
68+
69+
**Every other `os start` keeps booting.** In production mode, when it keeps any
70+
of the three on its own disk, it prints a warning block naming each file and the
71+
variable that moves it off that disk. Administrators also see it in the Console:
72+
a standing notice on the home page and at the top of Setup's System Overview,
73+
listing the same files with a button that copies the variables to set, plus two
74+
lower-severity lines when uploads are stored on the local disk or no email
75+
service is set up. Members never see it, and it is not on the public auth
76+
config (it is read from `GET /api/settings/deployment/notice`, which needs
77+
`manage_platform_settings`). An administrator can hide it: the hide is written
78+
to the audit log as a `config_change` (and refused where no audit log is
79+
mounted), it lasts for that administrator in that browser until the findings
80+
change, and System Overview keeps one small line saying the notice is hidden.
81+
4882
The full catalog is in
4983
[Environment Variables](/docs/deployment/environment-variables).
5084

@@ -252,7 +286,9 @@ curl -fsS http://localhost:8080/api/v1/health
252286

253287
Prefer SQLite on a single small host? Skip the `db` service, mount a volume,
254288
and point `OS_DATABASE_URL` at it: `file:/srv/data/app.db` (with
255-
`- appdata:/srv/data` on the app service). See
289+
`- appdata:/srv/data` on the app service). Set it explicitly even then: the
290+
official image refuses to start on its default database file, which lives in
291+
the container layer ([When the three are not set](#when-the-three-are-not-set)). See
256292
[Drivers](/docs/data-modeling/drivers) for when to reach for which database.
257293

258294
## Health checks & orchestration

‎content/docs/protocol/kernel/config-resolution.mdx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,19 @@ OS_ALLOWED_ORIGINS=["a","b","c"] # default is array/object → JSON.parse
262262

263263
If the raw value cannot be parsed for the expected type, the raw string is used.
264264

265+
**What is stored beneath a pin is listed by the namespace read.** An override in
266+
force answers `source: 'env'`, `locked: true`, and `get()` / `getMany()` build
267+
that answer from the env alone, without reading the store. `getNamespace()` — the
268+
read `GET /api/settings/:namespace` serves to the Setup page — also lists, below
269+
the `env` entry of `cascadeChain`, the entries the key's read would carry with no
270+
override in force: its stored rows, then the default. The `env` entry stays the
271+
effective one. An entry at the key's declared scope with a non-null value is the
272+
value a clear (`null`) removes, so the page can tell whether "clear the saved
273+
value" has anything to clear. A secret's entries beneath the pin carry the read
274+
mask or `null`, never its value. An override whose value coerces to `null` keeps
275+
its single `env` entry, since any non-null entry below it would read as the
276+
effective one.
277+
265278
**A value outside a declared option table is ignored, not repaired.** When the
266279
specifier declares `options` and the env value matches none of them, the env
267280
layer contributes nothing at all — no value and no `cascadeChain` entry — and

‎docker/Dockerfile‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,18 @@ WORKDIR /srv/app
104104
RUN chown node:node /srv/app
105105
USER node
106106

107+
# OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED makes `os start` refuse to boot unless
108+
# OS_DATABASE_URL, OS_AUTH_SECRET and OS_SECRET_KEY are set explicitly, naming
109+
# the missing ones. A container's disk is what gets replaced: without them the
110+
# data would be a SQLite file in the container layer and both secrets would be
111+
# generated there, all lost with the container. An explicit
112+
# OS_DATABASE_URL=file:/path/on/a/volume/app.db passes, so SQLite on a mounted
113+
# volume stays a choice. Outside this image `os start` keeps booting and prints
114+
# a warning block instead (packages/cli/src/commands/start.ts).
107115
ENV NODE_ENV=production \
108116
OS_ARTIFACT_PATH=/srv/app/objectstack.json \
109-
OS_PORT=8080
117+
OS_PORT=8080 \
118+
OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED=true
110119
EXPOSE 8080
111120

112121
# Liveness: /api/v1/health. For orchestrated readiness use /api/v1/ready.
@@ -115,5 +124,6 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=15s \
115124
CMD node -e "fetch('http://localhost:'+(process.env.OS_PORT||8080)+'/api/v1/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"
116125

117126
# OS_DATABASE_URL, OS_AUTH_SECRET, and OS_SECRET_KEY are injected at runtime —
118-
# never bake them into an image.
127+
# never bake them into an image. Without them `os start` refuses to boot (see
128+
# OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED above).
119129
CMD ["os", "start"]

‎docker/README.md‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,26 @@ package set or on a version range.
8787
## What the image presets
8888

8989
- `OS_ARTIFACT_PATH=/srv/app/objectstack.json`, `OS_PORT=8080`,
90-
`NODE_ENV=production`
90+
`NODE_ENV=production`, `OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED=true`
9191
- Runs as the non-root `node` user
9292
- `HEALTHCHECK` on `/api/v1/health` (liveness); use `/api/v1/ready` as the
9393
readiness probe in orchestrators
9494

9595
**You must inject at runtime:** `OS_DATABASE_URL`, `OS_AUTH_SECRET`,
96-
`OS_SECRET_KEY` — never bake them into an image. Full variable catalog and
97-
reverse-proxy / multi-node guidance:
98-
[Self-Hosted Deployment](https://objectstack.ai/docs/deployment/self-hosting).
96+
`OS_SECRET_KEY` — never bake them into an image. **The image refuses to start
97+
without all three** (`OS_DEPLOYMENT_DURABILITY_CHECK_ENABLED=true`): it exits
98+
naming the missing ones, because without them the data would be a SQLite file in
99+
the container layer and both secrets would be generated there, all lost when the
100+
container is replaced. An explicit `OS_DATABASE_URL=file:/path/on/a/volume/app.db`
101+
passes, so SQLite on a mounted volume still works.
102+
103+
Upgrading a container that ran on values the image generated? Carry them over
104+
first, from the old container's `/home/node/.objectstack`: `OS_AUTH_SECRET` is
105+
the contents of `auth-secret`, `OS_SECRET_KEY` the contents of `dev-crypto-key`,
106+
and the data is `data/objectstack.db`. The refusal prints these paths.
107+
108+
Full variable catalog and reverse-proxy / multi-node guidance:
109+
[Self-Hosted Deployment](https://objectstack.ai/docs/deployment/self-hosting#when-the-three-are-not-set).
99110

100111
## Local build of this image
101112

‎docs/qa/scenarios/README.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ question's computed truth; a card that does not load is red in CI.
3636
| 5 | `run.operations`, `run.guardrails`, `run.agentActions?` | At least two writes, each acting as a persona and declaring its `outcome`; the five guardrail checks; optionally the agent-callable business actions. |
3737
| 6 | `iterate` | A one-sentence change request plus the `expectDelta` it should add to `expect`. |
3838

39-
Besides the layers a card carries `id` (its basename), `title`, `provenance` (where the
39+
Besides the layers a card carries `id` (its basename), `code`, `title`, `provenance` (where the
4040
scenario comes from) and, when a question uses a time window, `asOf`: the fixed "today"
41-
(`YYYY-MM-DD`) windows are computed against.
41+
(`YYYY-MM-DD`) windows are computed against. `code` is the app code: 2–8 lowercase letters,
42+
unique across the library. The app lives in the namespace `demo` + code (`democrm`) wherever
43+
it is built, scored or exported, and every item it declares carries that prefix.
4244

4345
**Counts.** The default band is 8–10 questions and 4–6 operations. A card below 8 questions
4446
or 4 operations states why in `run.countsReason`, or it is refused.
@@ -153,7 +155,7 @@ meet this floor:
153155

154156
## Adding a card
155157

156-
1. Write `<id>.json` here; `id` equals the basename.
158+
1. Write `<id>.json` here; `id` equals the basename, and `code` is one no other card uses.
157159
2. Keep it generic — a scenario anyone could write from the domain alone.
158160
3. Run `pnpm --filter @objectstack/scenarios test`: a refusal names the file and the field
159161
path. Then pin the card's hand-worked truths, per persona too, in its own
@@ -164,5 +166,5 @@ meet this floor:
164166

165167
`pnpm --filter @objectstack/scenarios run-scenarios` builds, runs and iterates every card here with a local
166168
Claude Code session, and writes one run record per card. Grading uses `@objectstack/scenarios/score`; no
167-
API-billed model is used. The runner reads a card's object names relative to the built package's namespace
168-
(`account` → `<namespace>_account`). Flags and modes: [the package README](../../../packages/qa/scenarios/README.md#running-the-cards--objectstackscenariosrunner).
169+
API-billed model is used. The runner reads a card's names relative to the card's namespace
170+
(`account` → `democrm_account`), and a build that names any item without the prefix fails its Build half. Flags and modes: [the package README](../../../packages/qa/scenarios/README.md#running-the-cards--objectstackscenariosrunner).

0 commit comments

Comments
 (0)