Repository navigation
Add metamodel interfaces for ObjectQL/ObjectUI contract - #1
Merged
Merged
Conversation
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Metamodel interfaces for backend and frontend
Add metamodel interfaces for ObjectQL/ObjectUI contract
Jan 18, 2026
huangyiirene
approved these changes
Jan 18, 2026
huangyiirene
marked this pull request as ready for review
January 18, 2026 09:09
hotlong
added a commit
that referenced
this pull request
May 20, 2026
Closes gap #1 from the production-readiness review: the client-side ObjectForm / inline-grid masker (shipped earlier) was only a UX layer — a hand-crafted POST or direct ObjectQL call could still target any field. This commit closes the loop by enforcing field-level write permissions in the SecurityPlugin middleware. Behavior: on every insert/update, after the existing CRUD check and before the tenant/owner auto-injection, the middleware now scans the caller's payload against the merged field permissions for the target object. If the payload references any field the caller is not permitted to edit, the engine throws PermissionDeniedError (HTTP 403) with the offending field names exposed via details.forbiddenFields. Design choices: - **Fail-closed via throw, not silent strip.** Silent strip hides the boundary from honest clients (partial-save confusion: 'why didn't my change save?') AND gives probing clients no signal that the field exists. Throwing makes the boundary observable in both directions — legitimate UIs get an actionable error; probing clients learn nothing they could not already infer. - **Allow-list semantics.** Only fields explicitly enumerated in a permission set's 'fields' map are constrained. Fields without a rule pass through untouched. - **Bulk inserts checked row-by-row.** Arrays are scanned in full; a single offender in any row rejects the entire batch atomically. - **Runs BEFORE auto-injection.** The tenant/owner auto-fill (org_id, owner_id) is system-supplied from ExecutionContext, not from the caller's payload, so it is not subject to the user's edit permissions even when the user has no rule for those fields. - **System operations bypass entirely.** ExecutionContext.isSystem short-circuits the whole security middleware including this check. API additions: - FieldMasker.detectForbiddenWrites(data, fieldPermissions): string[] — exported helper for adapters that want to perform the check out-of-band (e.g., strip-then-warn instead of fail-closed). Documentation: - content/docs/guides/security.mdx — new 'Server-side enforcement (fail-closed)' subsection under Field-Level Security with the 403 response shape, the why-throw-vs-strip rationale, allow-list semantics, and the bulk/system bypass rules. - .changeset/security-fls-write-enforcement.md — minor bump. Tests: 7 unit tests for FieldMasker.detectForbiddenWrites + 8 integration tests via the existing security middleware harness covering insert/update/bulk/system-bypass/no-rule passthrough. 53 plugin-security tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xuyushun441-sys
pushed a commit
that referenced
this pull request
May 22, 2026
Vendor-neutral observability primitives, extracted as a standalone
package so deployment-target code (cloud, self-hosted, ...) can depend
on the contracts without pulling in the whole runtime.
Owns:
- Contracts: MetricsRegistry, ErrorReporter, MetricSample, CapturedError
(Logger is re-exported from @objectstack/spec/contracts).
- Semantic conventions (SEMCONV): canonical Prometheus-style metric
names emitted by the framework, plus the back-compat RUNTIME_METRICS
alias.
- Metric exporters: Noop, InMemory (with totalCounter/histogramValues/
lastGauge helpers), Console, and OtlpHttp (buffered JSON exporter,
flush()-on-demand so it works on Workers as well as Node).
- Error reporters: Noop, InMemory, Console (structured JSON to stderr).
- Loggers: Noop, Console, Json (production-ready structured logging
that satisfies the existing @objectstack/spec Logger contract).
Backwards compatibility:
- @objectstack/runtime now depends on @objectstack/observability and
its src/observability/{metrics,error-reporter}.ts files are thin
re-export shims, so existing internal imports (and the public
runtime/index.ts surface) are unchanged.
Tests: 34 new tests covering all exporters; @objectstack/runtime test
suite still passes (the 2 pre-existing app-plugin.test.ts failures
around i18n service warnings are not affected by this change — they
were already failing on main).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xuyushun441-sys
pushed a commit
that referenced
this pull request
May 22, 2026
Introduces an opt-in path in ObjectStackProtocolImplementation.saveMetaItem that writes overlay metadata through SysMetadataRepository.put instead of the raw engine, so writes append to the change-log and emit HMR seq events. Behavioural changes (all behind options.useRepositoryWritePath / OBJECTSTACK_USE_REPOSITORY_WRITE_PATH=1): - saveMetaItem request gained optional parentVersion (If-Match) and actor fields. ConflictError -> 409 metadata_conflict. - Plural type aliases (views, dashboards, ...) normalized to singular before the repo's overlay-allowlist gate (rubber-duck #5). - Object-registry mutation moved AFTER successful put() so a conflict does not leave the in-memory registry stale (rubber-duck #3 invariant test added). Repo/test-fake fixes uncovered by rubber-duck review: - SysMetadataRepository.put/delete now update/delete by row id because the engine's strict .update requires id or multi:true (rubber-duck #1). - sys_metadata.checksum column widened from 64 -> 71 chars to hold the sha256: prefix produced by hashSpec() (rubber-duck #2). - Three test fake engines extended to support both overlay-tuple and id-based where lookups. 333/333 objectql tests pass. Deferred to PR-10d.4: REST plumbing for parentVersion/actor (rubber-duck #6), race-window retry for omitted parentVersion (rubber-duck #4), default flag flip + legacy path removal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xuyushun441-sys
pushed a commit
that referenced
this pull request
May 23, 2026
Walking through Studio as a low-code developer surfaced a fundamental gap: it is a beautiful metadata BROWSER but offers no authoring affordances. The #1 reflex of every Airtable / Power Apps user — add a field — has no entry point in our UI. This change adds two authoring touchpoints to the Object Hub > Fields panel that respect Prime Directive #6 (no temporary workarounds) and stay true to metadata-as-code: 1. + Add field button A primary CTA in the toolbar opens a guided dialog (AddFieldDialog) with a type picker (18 supported field types, each with icon + one-line semantics), a derived snake_case machine-name preview, and a live snippet preview. Two actions: • Copy snippet — pastes a defineField-style literal into the clipboard, ready to drop into the fields: { … } block. • Open .object.ts in VS Code — vscode:// deep-link via the existing vscode-objectstack extension. Filesystem writes from the browser are intentionally avoided. When the runtime overlay write-path matures (ADR-0005), the dialog can swap the snippet flow for a real persist call without changing its contract. 2. Click any field row to open a detail drawer Rows are now cursor-pointer and trigger a side Sheet (FieldDetailDrawer) showing the full normalised field spec — all properties, options enumerated, references, formula, validation — plus the same VS Code deep-link and a per-field Copy snippet that emits just this field's literal. The drawer is read-only; users who want to edit follow the VS Code link. The previous behaviour (clicking a row did nothing) was the single biggest dead-end during the persona walkthrough. The drawer is the minimum viable acknowledgement that a field is an interactive object, not a static row of text. Plumbing changes - ObjectSchemaInspector preserves every property of the field spec (spread over the cherry-picked subset) so the drawer has access to schema properties beyond the table columns. - Added a ChevronRight column on the right edge of every row, group-hover translate-x for the same drill-in affordance used on MetadataListPage compact rows. - CopyButton stops propagation so the row click does not fire when copying the field name. Build / tests pnpm --filter @objectstack/studio build — clean. pnpm --filter @objectstack/studio test — 69/69 tests pass; same 2 pre-existing @object-ui/core/dist/evaluator/ExpressionEvaluator module resolution failures in playground-plugins / plugin-system suites, unrelated to this work. Files - apps/studio/src/components/FieldDetailDrawer.tsx (new, ~160 lines) - apps/studio/src/components/AddFieldDialog.tsx (new, ~280 lines) - apps/studio/src/components/ObjectSchemaInspector.tsx · Imports FieldDetailDrawer, AddFieldDialog, Plus, ChevronRight · State for selectedField + addOpen · Preserves full field spec via spread in fieldEntries · Toolbar: + Add field primary CTA · TableRow: cursor-pointer, onClick → setSelectedField · New chevron column on right; colSpan bumped to 7 · Drawer + dialog mounted at end of component · CopyButton stops click propagation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced May 25, 2026
Closed
Closed
xuyushun441-sys
added a commit
that referenced
this pull request
May 31, 2026
…nector-rest (ADR-0018) (#1416) Promote `connector_action` to a built-in baseline node — the generic-dispatch counterpart to `http_request`: where http_request calls any raw URL, connector_action invokes any registered connector's declared action. - engine: connector registry (registerConnector / unregisterConnector / resolveConnectorAction / getRegisteredConnectors) + ConnectorActionHandler / ConnectorActionContext / RegisteredConnector types. registerConnector validates via ConnectorSchema and asserts every declared action has a handler. - builtin/connector-nodes.ts: connector_action executor (source:'builtin', category:'io', all three paradigms), wired into installBuiltinNodes() — the core plugin now seeds 11 baseline node types. Missing connector fails the step (not flow registration) with a clear error. - packages/connectors/connector-rest (@objectstack/connector-rest): the reference concrete connector. createRestConnector + ConnectorRestPlugin, `request` action, static auth (none/api-key/basic/bearer), no OAuth2 refresh (enterprise tier). - New packages/connectors/ workspace category (alongside plugins/services/adapters). - ADR-0018 §Addendum: records the decision, resolves Open-question #1, supersedes M2's "connector_action dropped from baseline". Tests: service-automation 87/87, connector-rest 10/10 (incl. end-to-end kernel boot: both plugins -> connector_action flow -> REST handler). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
This was referenced Nov 23, 2026
247257110
pushed a commit
to 247257110/objectstack
that referenced
this pull request
Nov 23, 2026
…rite inside its transaction triggers a flow (objectstack-ai#36533) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JpRoUZGqtwqMU5k7b4C58D)_ Fixes objectstack-ai#36490 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:AI 助手(以及界面上的按钮)第一次运行一个在事务里写数据的脚本动作时,不再卡住 30 秒后报服务器错误,第一次就能成功;用户无需重试。 - 为什么做:属于 MCP 写入能力(AI 通过动作办事)这条主线;差旅报销的每日评测连续两天发现"第一次调用失败、原样重试成功",AI 因此会重试或绕路直写,曾留下重复报销单。 - 出错会怎样:改动只影响沙箱脚本里开启的事务;若有问题,表现是该类动作的写入与预期不一致,撤回本次合并即可恢复原状。 - 要你做什么:无。 ## What changes Root cause, measured on the published 18.6.0 server with the `travel_expense` fixture (`--template docs/qa/scenarios/builds/travel_expense.json`, unmanaged install, an employee persona over `/api/v1/mcp`): - The first `run_action demotravel_file_expense_claim` (with or without `objectName`) took 30.3 s and answered `INTERNAL_ERROR` 500; the next two identical calls answered `ok` in under a second. Server log of the first call: `exceeded wall-clock ceiling of 30000ms while awaiting host calls`. - The action body writes inside `ctx.api.transaction(...)`. That runs on `ScopedContext`'s begin/commit/rollback trio, whose handle is threaded explicitly and was never published to the engine's ambient transaction store (a declared limit on `ObjectQL.beginTransaction`). - The first claim line's roll-up updated the claim, which fired the record-triggered flows on `demotravel_expense_claim`. The flow run's setup (`resolveRunContext` → the automation plugin's tenant currency resolver → `resolveLocalizationContext`) read `sys_platform_setting` / `sys_setting` through the engine with no handle. On SQLite's single-connection pool that read waited for the connection the body's transaction held, until the sandbox wall clock rolled the transaction back. The read then completed and was cached, so the retry passed. A stack trace taken on that read is in the Verification section. - So neither PM hypothesis held as stated: not a cold sandbox (the body's writes ran in about 1 s) and not a registration race (the action was found and admitted on every call). It is an ADR-0034 D1 violation: an internal read issued while a transaction is open did not run on the transaction's connection. The fix (`packages/objectql/src/engine-middleware-and-context.ts`): `executeWithMiddleware` now runs an operation whose context carries an OPEN trio handle with that handle published in the ambient store for the operation's duration. The entry has `runOpenedUnit`'s shape (the trio's scope for the same-origin gate, its commit queue for `async` after-hooks) and is emptied when the operation settles. Not published for a run detached from the handle, nor over a store that already carries a transaction. `unit-detach.ts` gains a getter for the trio's commit queue. No contract change: no error code, no schema key, no public export. ## Tests - `packages/objectql/src/engine-ambient-transaction.test.ts`, new top-level describe: an after-hook read with no handle runs on the trio's transaction; nothing is published between operations or after the commit; a nested `transaction()` inside the operation joins (one begin). - `packages/runtime/src/sandbox/action-body-transaction-rollup-child.integration.test.ts`, new case in the existing harness: a real better-sqlite3 `SqlDriver`, the real QuickJS action body through the `/actions` door, the travel-expense shape, plus an `afterUpdate` hook on the parent that reads through the engine with no handle (the flow setup's read). It must answer 200 inside the 10 s bound with the lines and roll-up landed. Readings, all at head `69c95116d`: <details><summary>Published 18.6.0 host (before), first call vs retries</summary> `os dev` blank host on the published 18.6.0 CLI, the fixture installed unmanaged, an employee persona over `/api/v1/mcp`, three `run_action demotravel_file_expense_claim` calls (first two without `objectName`, third with it): ``` 16:09:17 run_action objectstack-ai#1 30356ms isError=true INTERNAL_ERROR ... timed out: it exceeded its 30000 ms time limit while waiting on platform calls 16:09:18 run_action objectstack-ai#2 672ms isError=false 16:09:18 run_action objectstack-ai#3 717ms isError=false ``` The same shape twice more (30237 ms, 30300 ms first call). Server log of the first call: `exceeded wall-clock ceiling of 30000ms while awaiting host calls (after N pump iterations)`. A stack trace taken on the stalled read: `resolveRunContext` (service-automation) to the tenant currency resolver to `resolveLocalizationContext` (core) to an engine `find` on the settings objects with no transaction handle. The same host with this fix's shape patched into its objectql dist: first call `ok` in 1321 ms (first call without `objectName`) and 1095 ms (first call with it). </details> <details><summary>This branch, booted host (examples/app-todo on the built tree)</summary> Fix in dist: ``` run_action objectstack-ai#1 439ms isError=false (no objectName; answer carries "objectName": "demotravel_expense_claim") run_action objectstack-ai#2 590ms isError=false run_action objectstack-ai#3 514ms isError=false ``` A second boot: 292 / 425 / 497 ms, all ok. Fix removed from the objectql dist (main's behaviour), same boot and script: ``` run_action objectstack-ai#1 30293ms isError=true INTERNAL_ERROR Action 'demotravel_file_expense_claim' timed out: it exceeded its 30000 ms time limit while waiting on platform calls run_action objectstack-ai#2 287ms isError=false run_action objectstack-ai#3 304ms isError=false ``` The dist was restored afterwards and `cmp` matched the backed-up built files byte for byte. </details> <details><summary>Tests, ablation and restore</summary> - `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-ambient-transaction.test.ts`: 21 passed. - `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/sandbox/action-body-transaction-rollup-child.integration.test.ts`: 3 passed, 2 skipped (the skips are the file's existing live-Postgres cases, which need OS_TEST_POSTGRES_URL). - `pnpm --filter @objectstack/objectql test`: Test Files 629 passed (629), Tests 14293 passed (14293). - `pnpm --filter @objectstack/objectql typecheck` exit 0; `pnpm --filter @objectstack/runtime typecheck` exit 0. Ablation (`await publishTrioHandleFor(this.txStore, ctx.context?.transaction, chain);` replaced by `await chain();` through `scripts/ablation-replace.mjs`; anchor count 0 after the mutation; objectql rebuilt; `ablation-dist-preflight.mjs --absent` exit 0): - unit file: 2 failed of 21 (the after-hook read case and the nested-join case). - integration file: the new case failed at 30068 ms with `500 INTERNAL_ERROR ... Action 'rux_file' timed out: it exceeded its 30000 ms time limit while waiting on platform calls`. Restore: `git checkout HEAD -- FILE`, `git diff HEAD` 0 lines, blob `36188a75a8f3` equal to the HEAD blob, objectql rebuilt, the integration file green again. </details> <details><summary>Gates</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `69c95116d`: 66 families, all run locally, all exit 0. `--ran` reconciliation: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN. Five dist-reading families (`check:dts-closure`, `check:lean-entry-closure`, `check:sourcemap-no-sources-content`, `check:type-check-debt`, `check:dual-build-cjs-loads`) first answered exit 3 (no build yet) and were rerun after the build closure, exit 0. `node scripts/check-nul-bytes.mjs` exit 0. `node scripts/check-platform-checklist.mjs --changed-from origin/main` exit 0 (no anchored file in the change set). Repo-wide scans and `test:repo` are left to CI. </details> ## Acceptance notes - The card's day-3 `404 RESOURCE_NOT_FOUND` on a listed action did not reproduce: on 18.6.0 and with the fix, a call with `objectName` and one without both resolved and ran. Day 4 (same server) had no 404 either. - `objectName` absent resolves the same way `list_actions` names the action (measured: answered `"objectName": "demotravel_expense_claim"`). - On main the committed fixture `docs/qa/scenarios/builds/travel_expense.json` no longer installs: `install-local` answers 422 `INVALID_METADATA` (`objects.demotravel_expense_claim.validations[0] [state-machine-no-initial-states]`, the same on `demotravel_approval_step`). The main-tree readings above use the fixture with its three `state_machine` validations removed; nothing else changed. Reported to the seat, not changed here. - Seen while measuring, not changed here: on a fresh `os dev` blank host from 18.6.0, every audited write logged `Audit write FAILED on sys_audit_log ... no such table`. Not measured on main. ## Verification Read first: 1. `packages/objectql/src/engine-middleware-and-context.ts`, `publishTrioHandleFor` (the risk: which handles are published and when the entry is emptied). 2. `packages/runtime/src/sandbox/action-body-transaction-rollup-child.integration.test.ts`, the new case. 3. `packages/objectql/src/unit-detach.ts`, `trioCommitQueueOf`. Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/sandbox/action-body-transaction-rollup-child.integration.test.ts` shows every case passing, the new one in about 1 s. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Nov 23, 2026
Closed
Open
Eval run · skill-evals objectstack-ui × 2 arms × 1 rep · 58570d80 · 2026-11-26 · #36535 round
#37633
Closed
Merged
This was referenced Nov 30, 2026
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…d load would drop (objectstack-ai#37156) repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Fixes objectstack-ai#35653 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up objectstack-ai#37158 — skills/objectstack-data/references/seeds.md (its sentence "`os validate` does not run them on seed rows" becomes false with this change; `skills/**` is out of this domain:devx claim) ## 维护者速读 - 用户能看到什么变化:写应用的人运行校验或构建命令时,如果某条初始化数据会被该对象自己的校验规则拒收,或者唯一标识留空,命令会直接失败并指出是哪条数据、哪条规则;以前要等到启动后看日志才发现数据被丢掉。 - 为什么做:属于“构建与校验提前报错”这一组改进,替写初始化数据的应用作者解决“构建通过、启动时数据悄悄丢失”的问题;同时并入了“唯一标识留空只在加载时拒收”那张卡。 - 出错会怎样:原本能通过校验的配置现在可能被拒(这是有意收紧);判不准的组合只计数提示、不拒收,加载时的拒收照旧兜底,撤回本改动即可恢复原状。 - 要你做什么:这是一项声明过的收紧(破坏性变更),需要你批准或直接合并,席位不能自己落地。 ## What changes `os validate` and `os build` now judge every seed record before the load does and refuse the config (exit 1) when the seed load would drop a record: - **A record its object's own validation rule refuses.** The walk is `judgeSeedRowRefusals` (`@objectstack/lint`); the verdict is the write path's own evaluator, `evaluateValidationRules` (`@objectstack/objectql`), injected by the two CLI doors (lint cannot import the runtime). Each rule is judged on its own, so the finding names the refusing rule. Only active, error-severity rules that judge inserts are run; `state_machine` is skipped, as the seed write skips it. - **A keyed record with a blank key field** (the folded row): no value, `null` or `''` in a field of the dataset's `externalId`, reported in the exact sentence the seed loader refuses it with (a CLI test holds the two equal against the real loader). The object's own organization column is left to the load, which stamps it: the column `resolveTenantFieldName` (`@objectstack/core`, injected by the doors like the evaluator) walls the object by, so a declared `tenancy.tenantField` the object has, else `organization_id`. - A (record, rule) pair is judged only when the record's own literal values decide it. A rule that reads something the load decides (a reference hop, a roll-up / formula / autonumber field, a default, a platform-injected column, an expression or `seedFile` value, a `beforeInsert` hook's write, an `update` dataset's stored row, a non-`record` root) is counted in one dim note and never refused, so a refusal here is a record the load refuses. - Human output, one line per refusal (the heading counts records): `✗ data[0].records[1]: Seed record objectstack-ai#1 of 'xt_payment' is refused by its validation rule 'amount_positive': A payment amount must be positive.` `--json` carries the refusals under `errors` (`os validate`) or `issues` (`os build`), each with `rule`, `location`, `object`, `recordIndex`, and `validationRule` or `field`. - ADR-0087: the narrowing registers the upgrade-guide entry `seed-record-refused-before-load` (`packages/spec/src/migrations/entries/semantic/18.seed-record-refused-before-load.ts`); the changeset carries `registered seed-record-refused-before-load`. The load-time half of the blank key is the existing entry `seed-key-blank-record-refused`. - Changeset: `@objectstack/cli`, `@objectstack/lint`, `@objectstack/spec` minor (fixed group), a `feat(cli)!:` headline, a **BREAKING** paragraph with its FROM and TO, both declaration lines and `Skills-docs: follow-up objectstack-ai#37158`. Files to read first, by risk: 1. `packages/lint/src/seed-row-refusals.ts` — `fieldKnown` / `ruleReads`: the judged-vs-not-judged boundary. A pair wrongly judged is a false refusal at build; the walk errs toward not judging. 2. `packages/cli/src/commands/validate.ts` step 3d-quater and `packages/cli/src/commands/compile.ts` step 4a-0-bis — the two door call sites (same call, same exit behaviour). 3. `packages/spec/src/migrations/entries/semantic/18.seed-record-refused-before-load.ts` — the upgrade-guide text an upgrading author reads. ## Tests - `packages/lint/src/seed-row-refusals-35653.test.ts` (18 tests): the walk with a recording evaluator double — refusal naming, one rule per call with field-level predicates stripped, a non-`VALIDATION_FAILED` throw propagates, every not-judged reason counted and not handed to the evaluator, what the load skips is skipped uncounted, blank key (single, composite, expression and organization column left to the load, and an object walled by its own `tenancy.tenantField`). - `packages/cli/test/seed-row-refusals-35653.test.ts`: the real evaluator through the real stack parse — a refused record named by rule, a passing control, a roll-up rule not judged although the evaluator handed the raw record would refuse it, a fail-closed rule reported; the blank-key sentence equal to the real `SeedLoaderService` dry run's, and a dataset keyed on a declared `tenancy.tenantField` refused by neither the walk nor the real loader on the record that leaves it to the stamp. - `packages/cli/test/seed-row-refusals-35653-doors.test.ts` (integration tier, spawns the CLI): `os validate --json` and `os build --json` both exit 1 with the two findings. ## Acceptance notes - "Names the seed file": a config-loaded stack carries no per-dataset source path, so a finding names the dataset by its position in the stack (`data[0]`, `packages[1].manifest.data[0]`), its object, the record index and the rule. This is the same location convention the existing seed-value and seed-file findings use. - The published skill `skills/objectstack-data/references/seeds.md` says "`os validate` does not run them on seed rows"; this PR makes that false. Out of this claim's surface (`skills/**`), carried by objectstack-ai#37158 (release-coupled: lands before the release that ships this narrowing). - Not judged by design (counted, left to the load): rules reading beyond the record's literal values, `update` datasets, objects with a `beforeInsert` hook, date/datetime and other non-literal field types. Silence is not a promise the load admits the record. - Contract review is owed before the queue (declared narrowing, `Metadata-protocol: narrowed`), with the dogfood battery at the final head (below). ## Verification Two-minute check: in any app with a validation rule, add a seed record that breaks it and run `os validate`; expect exit 1 and a line `✗ data[N].records[M]: Seed record #M of 'OBJECT' is refused by its validation rule 'RULE_NAME': RULE_MESSAGE`. Restore the record; expect exit 0. All readings below are at head `84156fae352` (after merging `origin/main` 49c8e0f as 61386cf) unless named. <details><summary>Package tests and typecheck</summary> - `pnpm --filter @objectstack/lint test`: Test Files 234 passed (234), Tests 9614 passed (9614); `pnpm --filter @objectstack/lint typecheck`: exit 0 (taken at `72ae1b5e17a`; no lint file changed since). - `pnpm --filter @objectstack/cli typecheck` exit 0, then `vitest run --project unit`: Test Files 444 passed (444), Tests 6332 passed (6332), then `vitest run --project integration test/seed-row-refusals-35653-doors.test.ts src/commands/migrate/plan.boot-parity.integration.test.ts`: Test Files 2 passed (2), Tests 5 passed (5), all one lock command joined by `&&`. - `pnpm --filter @objectstack/spec exec vitest run src/migrations`: Test Files 5 passed (5), Tests 201 passed (201). </details> <details><summary>Ablations</summary> - Tenant-column guard, at `72ae1b5e17a`: `node scripts/ablation-replace.mjs --file packages/lint/src/seed-row-refusals.ts --anchor '(obj ? input.resolveTenantFieldName(obj) : null) ?? DEFAULT_ORGANIZATION_COLUMN' --replacement "'organization_id' /* ablated: tenant column */" -- pnpm --filter @objectstack/lint exec vitest run src/seed-row-refusals-35653.test.ts`: the mutation landed (anchor 1 to 0, blob `d81ee3626f86` to `d74da4d3cdc3`), 1 failed / 18 passed of 19, and the one red is the new `tenancy.tenantField` pin; restored, blob equal to HEAD and `git diff HEAD` empty. A first attempt with the bare replacement `DEFAULT_ORGANIZATION_COLUMN` was refused by the tool before any test ran (the replacement text already occurs in the file, so its count could not rise), and it reads as no run. - Evaluator call, at `cb30582ea3b` (earlier round): 4 failed / 14 passed of 18 with the call removed; restored to HEAD. </details> <details><summary>Dogfood battery (declared narrowing)</summary> At `84156fae352639cca0513422887ffb4e54ca90e0`, after `turbo run build --filter=@objectstack/dogfood^...`, as its own lock command `bash scripts/pm/os-verify-lock.sh -c 'pnpm --filter @objectstack/dogfood test'`: `VERDICT command-exit 0`, Test Files 487 passed, 3 skipped (490), Tests 4128 passed, 68 skipped (4196), no failures. </details> <details><summary>Derived gate families</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `84156fae352`: 96 families, all run at that head; `--ran`: 96 accounted for, 95 run, 1 NOT-MEASURED. Among the 95: `check-adr-0087-registration` (`[BREAKING+bang+clause-②-narrowing+metadata-protocol-narrowed] registered seed-record-refused-before-load (new here)`), `check:type-check-debt` (`--re-measure: OK`), `check:upgrade-guide`, `check:spec-changes`, `check:api-surface` unchanged. The derived `vitest run test/migrate-meta-engine-guidance.test.ts` lost its lock turn in the sweep (exit 99) and was rerun under the lock: Tests 3 passed (3). NOT MEASURED locally: `check:dual-build-cjs-loads` (PREREQUISITE NOT MET, packages outside this diff's build closure have no `dist/`); CI runs it as a step of `Build Core`. </details> <details><summary>Test Core (9/10) red on cb30582</summary> The host-config case of `packages/cli/src/commands/migrate/plan.boot-parity.integration.test.ts` (line 145, a pending `create_table` for `sys_activity`, job 138857802200) did not reproduce after the merge: green in CI at `72ae1b5e17a` (Test Core (9/10), 3 tests) and locally at `84156fae352` (above). The diff touches neither `os serve`, `os migrate plan`, the audit plugin nor `sys_activity`. No root cause is established from one red; the same log has the audit plugin reporting `sys_activity` provisioned during the boot, so a provisioning race in the provision-and-exit boot is a hypothesis, not a finding. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…bjectstack-ai#37392) <!-- claude-projects-attribution: {"github_login":"huangyiirene"} --> _Requested by **Irene** · [project thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xCiTztFxYhmas2BLwizdmUo)_ Fixes objectstack-ai#36431 repo:objectstack#2 · huangyiirene · session_01J8VVAkQeShvvgjVb5MsbLn Clause-②: no (narrowing) Metadata-protocol: narrowed Skills-docs: none — no skill teaches declaring one job name in two packages of a composition; the refusal names every enabled job of the name and prescribes the fix ## 维护者速读 - 用户能看到什么变化:把多个包组合成一个应用时,如果两个包(或包外的顶层部分)都启用了同名的定时任务,现在在组合、校验和构建时就直接报错并点名两处,不再等到启动后两个任务都悄悄不跑。 - 为什么做:属于“多包组合与安装”这条线;启动时的任务调度和本地安装早就拒绝同名任务,只有组合这一步放行,三处判断不一致,导致定时任务无声丢失。 - 出错会怎样:最坏是某个以前能组合成功的多包应用现在被拒,需要作者给其中一个任务改名或把它停用;改动只在组合检查,可整体撤回。 - 要你做什么:无 ## What changes - **Composition reads jobs the way the boot's binder does** (`packages/spec/src/stack.zod.ts`). A new reading, `composedJobDeclarations`, lists every job a composed artifact declares and its holder, input by input. A package body's jobs belong to that body. The residual's jobs are the top-level jobs beyond the bodies' flattened copies, counted by number and never by content: a top-level job that is a body's job object is matched to it first, then by count. That is the same reading as the binder's `jobNameCollisions`. - **New refusal** `collectComposedJobNameErrors`: a job name ENABLED in two or more holders (two package bodies, or a body and the residual) is refused with `STACK_CROSS_REFERENCE_INVALID` (422). The message names every enabled job of that name and marks a residual job `(the top level, outside every package body)`. Example: `Job 'crm_nightly' is declared enabled twice across the packages of one composed artifact: 'com.example.sales' (stack #0) jobs[0] and 'com.example.billing' (stack objectstack-ai#1) jobs[0]. The runtime schedules an artifact's jobs by their bare name, whichever package declares them, and the job scheduler refuses a name two enabled jobs share, so none of them runs. Rename one of them, or disable one (enabled: false).` - **One reading for the residual door too**: the residual's own duplicate-entry door now takes its `jobs` from `composedJobDeclarations`. The old by-NAME claim (`residualEntryPredicate`) read a residual job that shares a body job's name as that body's copy, and that was the gap. The "Known gap" docblock is replaced. - **Unchanged**: a disabled twin composes, because a disabled job is scheduled by nothing. A body job's own flattened copy is not a second job. Distinct names compose. A flat composition keeps its one-package finding. - **Binder stays as the backstop** (`packages/runtime/src/app-artifact-handlers.ts`, docblock text only): composition now refuses the same set the binder refuses, so the binder's refusal is for artifacts no composition built (hand-written, or built before this change). - ADR-0087 semantic entry `compose-stacks-job-name-across-packages-refused`, and a changeset (`minor` on `@objectstack/spec`, BREAKING, FROM → TO). - **Tests that built an enabled two-holder pair through `composeStacks`** now hand-build the artifact, which is the backstop case. Every refusal assertion is kept. Files: `packages/runtime/src/app-artifact-handlers.job-pull.test.ts` (a `handBuilt` helper, with a pin holding it equal to a real composition where one still composes) and `packages/cloud-connection/src/marketplace-install-local-jobs.test.ts`. The census CONTROL in `stack-compose-duplicate-entry-census.test.ts` drops its `jobs` row, and the two-body CONTROL in `stack-residual-extension-jobs.test.ts` now gives each body its own job name (both pinned the old behaviour by design). The file surface was extended by claim addendum 7178059000. Read first (by risk): 1. `packages/spec/src/stack.zod.ts`: `composedJobDeclarations` (the nested-input branch: identity match, then count) and `collectComposedJobNameErrors` (the two-holder condition). 2. `packages/runtime/src/app-artifact-handlers.job-pull.test.ts`: `handBuilt` and its equality pin. 3. `packages/spec/src/stack-composed-job-name-across-holders.test.ts`. Two-minute check: `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/stack-composed-job-name-across-holders.test.ts` should show 20 passed. ## Tests All local readings below were taken at head `c3c7bfcb`, unless a line says otherwise. The patch round for the contract review's S1/N1 (record 7180533824) moved the head to `545757a9`; readings retaken there are marked `at 545757a`. New file `packages/spec/src/stack-composed-job-name-across-holders.test.ts` (20 tests). Refused, each asserting `code` + `status` + the named origins: - two bodies; - one job object reached through two bodies, through a body and the residual, and twice inside one holder (each counted per place it is reached, as the binder binds each copy; added in the S1 patch round); - two bodies of a nested artifact; - three holders; - body + residual; - residual before body; - a residual beside a nested artifact under `first` / `last`; - a residual beside a nested artifact that dropped its copy. CONTROLs that compose: - a body's copy alone; - a nested copy composed again; - a nested artifact read back through JSON (copies counted by number); - disabled twins on each side (body/body, body/residual); - distinct names; - the flat pair keeps the one-package finding. details: test and ablation readings - spec `pnpm --filter @objectstack/spec test` at 545757a: Test Files 897 passed (897), Tests 28461 passed, 1 todo (at c3c7bfc: 896 / 28435) - runtime `pnpm --filter @objectstack/runtime test`: Test Files 649 passed (649), Tests 12028 passed, 25 skipped; cloud-connection `pnpm --filter @objectstack/cloud-connection test`: Test Files 94 passed, Tests 1359 passed - typecheck: spec, runtime and cloud-connection exit 0 (runtime test-typecheck OK; it needed `@objectstack/driver-turso` built first) - cli unit, the composeStacks-with-jobs files plus migrate-meta-engine-guidance: 5 files, 34 passed - metadata owner-stamp-residual-build-boot 27/27 and objectql manifest-service-residual-namespace-name 33/33 (read at 44f206b) - Ablations, each a mutation landed through `scripts/ablation-replace.mjs` and restored (blob equal to HEAD, `git diff HEAD` empty): - (A) the `collectComposedJobNameErrors` call removed: 8 failed / 8 passed; - (B) the copy-count fallback off: 1 failed, the JSON-reloaded nested case; - (C) the enabled-only filter off: the 4 disabled-twin CONTROLs fail. ## Acceptance notes - H1 (the binder's reading): composition refuses exactly the cross-holder names that the binder (`jobNameCollisions`) and the install door (`collectJobNameCollisions`) refuse: enabled only, by name, the residual by count beyond the copies. A pair inside ONE holder stays that holder's own door's finding. That door counts a disabled twin too, which is wider than the binder (existing behaviour, unchanged). - H2: spec cannot import runtime, so there is no shared helper. The binder keeps its own copy of the reading as the backstop, and its docblock now says so. - Finding for the seat to file. class: a (reproducible defect). reach: read from code plus a composeStacks probe; not driven through a public door. evidence: `resolveArtifactCollections` (`packages/runtime/src/artifact-collections.ts`, `claimedIdentities` keys an item `name:X`) skips a body's job whose name the artifact's top level already carries. For a hand-built artifact whose top level holds a residual job X but no flattened copy of the body's job X (for example a nested `preserve` artifact that dropped its copies, then composed under `last` beside a residual input), the binder binds only the residual's job, refuses nothing, and the body's job is silently never scheduled. `composeStacks` now refuses that shape when both jobs are enabled, so only artifacts no composition built reach it. Dedupe words: resolveArtifactCollections job name claim, residual job shadows body job, binder silent drop. - The ADR-0087 entry `stack-residual-extension-registered-and-jobs-judged` still records the old known gap in its reason text. The new entry supersedes it, and the old one is left as shipped. ## Verification details: local gates - `node scripts/pm/dispatch-gates.mjs --commands` at c3c7bfc: 97 derived commands, all run. 96 exit 0. `pnpm check:dual-build-cjs-loads` exit 3 (PREREQUISITE NOT MET: it needs every package's dist, e.g. studio and client-react): NOT MEASURED locally, left to CI. `check-plugin-teardown-shape --self-test` exit 0 after fetching its pinned commit into the shallow clone. - `--ran` reconciliation: 97 derived, 97 run, 0 NOT-MEASURED, 0 UNRUN (runner-declared). - `pnpm --filter @objectstack/spec check:generated`: all 14 generated artifacts up to date (no public export changed). - `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD` ✓; `node scripts/pm/overlap-check.mjs`: VERDICT clean. - Full dogfood battery on 545757a: VERDICT command-exit 0; Test Files 487 passed, 3 skipped (490); Tests 4128 passed, 68 skipped (4196); no failures. - Full dogfood battery on c3c7bfc: `pnpm --filter @objectstack/dogfood test` under the lock: VERDICT command-exit 0; Test Files 487 passed, 3 skipped (490); Tests 4128 passed, 68 skipped (4196); no failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01J8VVAkQeShvvgjVb5MsbLn <!-- signed: repo:objectstack#2 · huangyiirene · session_01J8VVAkQeShvvgjVb5MsbLn --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…bjectstack-ai#37841) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuNTptyd1j97p7dHXZLEeH2g)_ Fixes objectstack-ai#37796 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:照我们技能包写应用的 AI 助手,以后在代理的模型配置里只写模型名,不再写“提供方”这一项;想用哪家提供方,到部署的 AI 设置里打开。 - 为什么做:“提供方”这一项今天已经退役,写了会被平台拒收,而对外发布的技能页还在教它;这是那次退役欠下的技能页跟进。 - 出错会怎样:只改教学文字和一道评测题,运行时不变;最坏是 AI 助手照旧文字给出过时写法,把文字改回即可撤回。 - 要你做什么:这是对外发布的技能包,需要你批准后才能合并。 ## What changes - **`skills/objectstack-ai/SKILL.md`, Model Configuration.** The `provider` row leaves the agent model table. The paragraph above the table now says the `model` block names a model and never a provider: the deployment's AI settings choose the provider and match the model name among the providers turned on, and a written `provider` is a parse error whose fix is to delete the key (retired in protocol 19). The `model`, `temperature` and `maxTokens` / `topP` rows are untouched. - **The schema citation in the same paragraph** moves from `packages/spec/src/ai/agent.zod.ts:37-45` to `:87-95`. PR objectstack-ai#37783 added 50 lines above the key list, so the old range pointed into a comment block. `:87` is the `provider` tombstone and `:95` is `topP`. - **`skills/objectstack-ai/evals/skills-tools-knowledge.json`, case 2.** The prompt is unchanged: a copilot that should use Anthropic at temperature 0.3 with a 2000-token cap. The expected answer now writes no provider key, puts sampling under `model`, names the model in the free-string `model` or leaves it to the host's default, and sends the choice of Anthropic to the deployment's AI settings. `must_contain` goes from `provider`, `anthropic`, `temperature`, `maxTokens` to `temperature`, `maxTokens`, `deployment`. `must_not_contain` goes from empty to the written line `provider: 'anthropic',`. - **`.changeset/37796-skills-agent-model-provider-retired.md`**: one `@objectstack/skills` patch. - **`.changeset/37711-skills-agent-model-optional.md`**: a DELIBERATE CORRECTION, declared below. ## Why PR objectstack-ai#37783 (merge `f07d63a5`) retired an agent's `model.provider`. The published skill still listed the key with its enum, and eval case 2 graded an answer as correct only when it wrote `provider`. An AI that follows the skill would write a key the platform now refuses. The Model Registry's own provider list (`ModelProviderSchema`) is a live key and this PR does not describe it. Its only mention in the bundle was inside the removed row. ## DELIBERATE CORRECTION `Check Changeset` is red on purpose: this PR edits a pending release note it did not add, `.changeset/37711-skills-agent-model-optional.md` (from PR objectstack-ai#37765). That note ships in the same release as this change, and two of its sentences would be false on release day. Title, before: > docs(skills): an agent's model name and provider are optional Title, after: > docs(skills): an agent's model name is optional Body, before: > `skills/objectstack-ai/SKILL.md` (Model Configuration) now teaches that `model.model` is optional, and that an agent without one runs on the host's default model for the environment, and that `model.provider` is optional with no default (the deployment's choice) instead of defaulting to `openai`. The inline enum list is unchanged, and the schema citation now points at `packages/spec/src/ai/agent.zod.ts:37-45`. The `objectstack-ai` eval case on sampling settings accepts an omitted `model` and states the provider has no default. Published prose only: it teaches the optional `model` / `provider` already on main since objectstack-ai#37697. Body, after: > `skills/objectstack-ai/SKILL.md` (Model Configuration) now teaches that `model.model` is optional, and that an agent without one runs on the host's default model for the environment. It no longer says `model.provider` defaults to `openai`; the key itself leaves the page in the same release (see the changeset on the skill no longer teaching `model.provider`). The `objectstack-ai` eval case on sampling settings accepts an omitted `model`. Published prose only: it teaches the optional `model` already on main since objectstack-ai#37697. The note's last sentence (the token budget) is unchanged. The precedent is PR objectstack-ai#37783 itself, which corrected `.changeset/37686-agent-model-name-optional.md` the same way. ## Tests ### Skill eval run (recorded) `pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-ai --repeats 3 --concurrency 4`, on head `fb8b3f20`. 12 cases, 2 arms, 3 repeats: 72 of 72 turns ran in 8 min, none out of the denominator. Subscription login, no API key, CLI 2.1.332, the login's default model and effort. | case | with-skill | no-skill | |:--|--:|--:| | **case 2 (this PR)** | **3/3** | **0/3** | | bundle, all 12 cases | 30/36 (83%) | 1/36 (3%) | Case 2, read answer by answer: all three with-skill answers put `temperature` and `maxTokens` under `model`, write no provider key, and send Anthropic to the deployment's AI settings. All three no-skill answers write `provider: 'anthropic',` inside the `model` block, which is the refused spelling. <details> <summary>Per-case table, round 2 (head fb8b3f2)</summary> | case | with-skill | no-skill | with-skill missed | with-skill carried forbidden | |:--|--:|--:|:--|:--| | objectstack-ai#1 | 3/3 | 1/3 | | | | objectstack-ai#2 | 3/3 | 0/3 | | | | objectstack-ai#3 | 3/3 | 0/3 | | | | objectstack-ai#4 | 3/3 | 0/3 | | | | objectstack-ai#5 | 2/3 | 0/3 | `aiExposed` | | | objectstack-ai#6 | 1/3 | 0/3 | `signed-in session` `refused` | | | objectstack-ai#7 | 0/3 | 0/3 | `do not retry` | | | objectstack-ai#8 | 3/3 | 0/3 | | | | objectstack-ai#9 | 3/3 | 0/3 | | | | objectstack-ai#10 | 3/3 | 0/3 | | | | objectstack-ai#11 | 3/3 | 0/3 | | | | objectstack-ai#12 | 3/3 | 0/3 | | | </details> <details> <summary>Round 1 (head 789e0c7) and why the forbidden token changed</summary> The first commit graded case 2 with `must_not_contain: ["provider:"]`. Round 1 scored it 1/3 with-skill. The two failing answers were correct: each wrote no provider key and named the retired spelling only to warn against it ("writing `provider: 'anthropic'` now fails to parse"). A bare `provider:` graded that warning as a failure. The second commit narrows the token to the object-literal line `provider: 'anthropic',` (with its trailing comma), which a warning in prose does not carry and every no-skill answer in round 2 does. The three round 1 with-skill answers pass under the final tokens when read by hand. Round 1's no-skill arm is not a clean baseline for case 2. The turns inherited this container's project-memory variables, and all three no-skill answers quoted the team's notes on the retirement. Round 2 was started with `CLAUDE_COWORK_MEMORY_PATH_OVERRIDE` and `CLAUDE_MEMORY_STORES` unset, and no case 2 answer mentions memory. </details> Cases 5, 6 and 7 are not touched by this PR. Their with-skill misses are literal-phrase misses in both rounds and are listed under Acceptance notes. ### Local gates, on head `fb8b3f20` `node scripts/pm/dispatch-gates.mjs --commands` derived 49 families for this diff. `--ran` reconciliation: 49 derived, 48 run, 1 NOT-MEASURED, 0 unrun. - 47 exit 0, among them `check-skills-token-ratchet` (and its self-test), `check:skill-identifier-liveness`, `check:skill-links`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:pm-skill-id-lint`, `check:doc-authoring`, `check:nul-bytes`, `check:published-files` and `@objectstack/spec` `check:skill-docs`. - `node scripts/check-empty-changeset.mjs --base origin/main` exit 1: the DELIBERATE CORRECTION above. It names `.changeset/37711-skills-agent-model-optional.md` and nothing else. - `pnpm check:dual-build-cjs-loads` exit 3, NOT MEASURED: it needs a full `pnpm build`, and this container built only the scenario runner's closure. CI runs it. - Outside the derived set, also exit 0: `@objectstack/spec` `check:skill-refs` and `check:skill-served-sections`. ### Size readings (`skills/**`) | reading | before | after | |:--|--:|--:| | `skills/objectstack-ai/SKILL.md`, lines | 485 | 487 | | `skills/objectstack-ai/SKILL.md`, tokens | 6801 | 6801 (ceiling 6801, no row moved) | | all `skills/*/SKILL.md`, lines | 4960 | 4962 | | `evals/skills-tools-knowledge.json`, tokens (measured, not ratcheted) | 3359 | 3411 | | bundle total, tokens | 301302 | 301354 | The new sentences in `SKILL.md` are paid for by the deleted row. The bundle total grows by the eval fixture alone. ## Acceptance notes - The branch is the harness-assigned `claude/project-thread-2rm2nh`, not `claude/issue-37796-…`. - The skill's `description` still lists "configuring an LLM provider" among its triggers. Left as is: a user who asks that is now told where the provider is chosen. Changing it would move when the skill loads, which this card does not ask for. - `SKILL.md:457` cites `packages/spec/src/ai/agent.zod.ts:234, :251` for the `agent.tools` / `agent.knowledge` tombstones. Those lines did not hold the tombstones before PR objectstack-ai#37783 either, so this PR leaves the citation alone. Noted, not filed. - Eval cases 6 and 7 miss literal phrases (`signed-in session`, `refused`, `do not retry`) on the with-skill arm in both rounds, case 7 in all six turns. That reads as a grading-token question on those cases, not as something this diff moved. Noted for the seat. - The eval runner passes its whole environment to each turn, so a round started inside a project container carries that project's memory into both arms. Noted for the seat with the round 1 records as evidence. ## Verification Read first, by risk: 1. `skills/objectstack-ai/SKILL.md`, the hunk under `## Model Configuration`: three new sentences that ship to every customer install. 2. `skills/objectstack-ai/evals/skills-tools-knowledge.json`, case 2: the token lists. 3. `.changeset/37711-skills-agent-model-optional.md`: the corrected note. Two-minute check: `sed -n '84,96p' packages/spec/src/ai/agent.zod.ts` shows `provider: retiredKey(...)` at `:87` and `topP` at `:95`, the range the skill now cites, and `node scripts/check-skills-token-ratchet.mjs` prints `skills/objectstack-ai/SKILL.md is 6801 tokens (ceiling 6801; headroom 0)`. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No schema change.) - [x] 2. Every name I added uses the casing for its kind. (No name added.) - [ ] 3. No formatter ran. `pnpm lint` is read from CI on this prose-only diff. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` is not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [ ] The *Before Submitting* list in CONTRIBUTING.md: lint and the test jobs are read from CI; the rest is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUjtV7ahUH66wxpMk7)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUjtV7ahUH66wxpMk7 --------- Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…iles become routers (objectstack-ai#38347) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuUejT99q3PMj1DD6eNBk5Kd)_ Part of objectstack-ai#34770 Clause-②: no Metadata-protocol: none Supersedes draft PR objectstack-ai#36158: the same change, resumed from `claude/issue-34770-skill-router-budget@937e2f1` on a new branch after seat 4's lane went vacant, with `main` merged in and the three eval cases of ruling 7176941587 Q1 B added. objectstack-ai#36158 can be closed with a pointer here; nothing on its branch is missing from this one. `Part of`, not `Fixes`: rulings 7128031203 and 7168461386 keep the first line at `Part of objectstack-ai#34770` until the catalog-size line of the card's Done-when is met, and this PR does not meet it (the catalog descriptions are not touched here). ## 维护者速读 - 用户能看到什么变化:用户无感。发给 AI 的两份技能说明(数据建模、自动化)的入口文件从约 27 KB、28 KB 缩到 9 KB、10.7 KB:入口只留开工前四项检查、会悄悄出错的坑、和「写什么去读哪个文件」的路由表,其余原文搬进同包的参考文件,教的内容不变。 - 为什么做:入口文件每次都整份装进 AI 的上下文,越长越贵、越容易漏读;缩成路由后,AI 只在需要时才读细节。 - 出错会怎样:只动教 AI 的文字和三道评测题的判分词,没有产品行为变化。风险是 AI 少读一段后答错;为此前后各跑了一轮评测,逐题对照(见 Tests)。可整笔撤回。 - 要你做的:座位复核后请审批人批准(`skills/**` 属 Tier H)。本 PR 合并后,云端仓库要按 #36934 把十一处托管章节的指向跟着改。 ## Rulings this executes - **7128031203** (①A ②A ④A): land as is, the hosted repoint is cloud's (#36934); a before and an after eval round, parity = the after round's failing set is the before round's or a subset, a flipped case is re-run once and the second reading counts; a ceiling row raised because text MOVED is accepted at the measured bytes with zero headroom when the sum of ceilings does not rise. - **7168461386** (A): six flow-shape facts go back into the automation entry, and that one row rises by exactly the bytes restored. - **7176941587** (Q1 B, Q2 A, Q3 A): three eval cases are relaxed first, then both rounds are run; the 187 bytes of entry wording stay; `triggers#6` is the eval seat's and is not touched here. ## What changes **Two entry files become routers.** `skills/objectstack-data/SKILL.md` 26,860 → 8,983 bytes (472 → 167 lines), `skills/objectstack-automation/SKILL.md` 28,206 → 10,703 bytes (480 → 215 lines). Each keeps four first checks, the traps that parse and then fail at run time, and a table that says which file to open for what is being written. No rule's teaching changes; the text moved, and the changeset lists section by section where it went and which anchors no longer exist in the entry files. **Eight files receive the moved text**: `objectstack-data/references/examples-objects.md`, `rules/field-types.md`, `rules/relationships.md`, `rules/security.md`, `rules/validation.md`; `objectstack-automation/references/examples-flows.md`, `references/integration-recipes.md`, and a re-pointed link in `references/state-machines-and-approvals.md`. **One correction** (unchanged from objectstack-ai#36158): the multi-value lookup note showed a `{record.tags.0}` token "in flow values", which a flow value slot refuses; it now shows the CEL spelling `record.tags[0]`. **New in this round, over `937e2f14`:** 1. **`main` merged** (through `600197a6ae`; a merge commit, not a rebase). Two things `main` changed in the entry files while objectstack-ai#36158 was open were mapped onto the relocated text instead of being lost with the old sections: - objectstack-ai#37551's option-label wording. The automation entry's item 4 of § Valid-but-silently-wrong keeps the rule and both outcomes (refused at publish where the options are inline, else no row matches or the run fails); `references/examples-flows.md` carries `main`'s sentence verbatim. - objectstack-ai#37551's `actionLayout` sentence of § Object Extension Model, now in `references/examples-objects.md`, verbatim. - A scan of every line `main` removed from the two entry files found no stale copy left in a receiving file. 2. **Three eval cases accept the spellings the bundles teach** (ruling 7176941587 Q1 B): - `objectstack-automation/evals/flows-triggers-approvals.json` case 1: `must_not_contain` `values:` → `values: {` (the key form a node carries; a prose heading also spells the bare word). - `objectstack-data/evals/hooks-security-seeds-datasources.json` case 7: `hooks: {` leaves `must_contain` for one any-of group `hooks: {` / `"hooks": {` / `.refusals.CREDIT_LIMIT` (the nested literal, its JSON spelling, or the dotted key `references/data-hooks.md` teaches). - `objectstack-data/evals/objects-fields-relationships.json` case 10: `type: 'boolean'` leaves `must_contain` for one any-of group `type: 'boolean'` / `Field.boolean(`. 3. **Ratchet rows re-measured on the merged tree**, since objectstack-ai#37747 made a row equal its measurement exactly (see Verification). 4. **The changeset** follows the merged tree's sizes and names the three eval cases. 5. **Three nits of contract review 7240993637** (head `edcd7df4ad`, one commit over the reviewed `3b62b5e9b0`): - `skills/objectstack-project/SKILL.md` line 187 pointed at objectstack-data, "Schema evolution", a heading the router moved. It now names `rules/field-types.md` § Changing a field that has data. That file sat at its ceiling, so the longer pointer is paid in the same file by five function-word cuts that lose no fact; its row stays 2990. - `scripts/check-skills-token-ratchet.mjs` loses one formula comment line the merge left in the `rules/security.md` history block. - The changeset says what the `Skill Boundaries` table listed (the neighbouring skills) and names the re-pointed objectstack-project line. ## Acceptance notes Decided by the thread (small, no shipped behaviour): - `"hooks": {` is a third member of case 7's any-of group. The ruling names the dotted key; the JSON spelling of the same nested literal is the form a `.json` translation file carries, and refusing it would fail a correct answer on quote marks. - `references/state-machines-and-approvals.md` measured 2 tokens over `main`'s row after the merge (the re-pointed link is 9 bytes longer). It is paid inside the file ("In a packaged flow, see below" → "A packaged flow: below") instead of raising a row no ruling covers. - The before round ran on `main` `600197a6ae` plus only the three eval-case edits (skill text byte-identical to `main`), so both rounds grade with the same token lists. Without that the three relaxed cases would differ between the rounds for a reason that is not the router. Not done, and why: - **objectstack-ai#36718's flow-shape harness is NOT re-run** (a merge condition of ruling 7128031203). It was scratch in the vacated container and is not in the repository. It was run to 0 on `937e2f14` (report 7170977110); this round adds no flow example over that head, only the two sentences above, both `main`'s own words. NOT MEASURED on this head. - The catalog-size line of Done-when: outside this PR, hence `Part of`. - `triggers#6` (ruling Q3 A): the eval seat's. ## Tests Skill evals, the command line of objectstack-ai#37235 unchanged for both rounds, run in the thread's cloud container (subscription login, no API key): ``` pnpm --filter @objectstack/scenarios skill-evals --skills objectstack-data,objectstack-automation --repeats 1 --model <as objectstack-ai#37235> --effort medium --concurrency 4 ``` | round | tree | turns | with-skill | objectstack-automation | objectstack-data | no-skill | trigger cases | |:--|:--|--:|--:|--:|--:|--:|--:| | before | `main` `600197a6ae` + the three eval-case edits (`304a4c5375`, local only) | 206/206 | 75/96 | 24/29 | 51/67 | 2/96 | 14/14 | | after, first reading | head `3b62b5e9b0` | 206/206 | 77/96 | 23/29 | 54/67 | 2/96 | 13/14 | | after, with the second readings | head `3b62b5e9b0` | +7 | **80/96** | 24/29 | 56/67 | | 14/14 | **Parity under ruling 7128031203 ②A holds: the after round's failing set is a strict subset of the before round's.** - **Failed in both rounds (16):** automation `flows-triggers-approvals` objectstack-ai#5, objectstack-ai#11, objectstack-ai#14, objectstack-ai#16, `integrations-declared` objectstack-ai#1; data `hooks-security-seeds-datasources` objectstack-ai#3, objectstack-ai#6, objectstack-ai#8, objectstack-ai#16, objectstack-ai#19, objectstack-ai#34, objectstack-ai#38; data `objects-fields-relationships` objectstack-ai#2, objectstack-ai#8, objectstack-ai#22, objectstack-ai#24. - **Failed before, pass after (5):** data `hooks-security-seeds-datasources` objectstack-ai#5, objectstack-ai#14, objectstack-ai#15, objectstack-ai#24; `objects-fields-relationships` objectstack-ai#10. - **Passed before, failed on the after round's first reading (4), each re-run once as the rule says, and each passed its second reading:** automation `flows-triggers-approvals` objectstack-ai#7 (the first answer carried the forbidden `current_user.positions`), data `hooks-security-seeds-datasources` objectstack-ai#25 (missed `default datasource`), `objects-fields-relationships` objectstack-ai#11 (missed `type: 'select'`), and trigger case `objectstack-data/triggers#6` (the bundle was read when it should have been left alone; the case of ruling Q3 A, which this PR does not change). Re-run with the same flags plus `--case` for those four keys: 7 of 7 turns, all four pass. - The three relaxed cases: `flows-triggers-approvals` objectstack-ai#1 and `hooks-security-seeds-datasources` objectstack-ai#7 pass in both rounds; `objects-fields-relationships` objectstack-ai#10 failed before on `label: '是否完成'`, not on the relaxed token, and passes after. One repetition per case is the round the card and objectstack-ai#37235 fix; at that depth a single case moves between readings for no reason of the text (four did here, in the unfavourable direction, and reverted). The five that moved the favourable way were not re-read: the rule re-reads a flip that would break parity, and a gain is not claimed from one reading. Read the result as "not lower", not as "five cases better". Both rounds were read on `3b62b5e9b0`. The commit after it (`edcd7df4ad`) changes no file of the two evaluated bundles (one line of objectstack-project, a script comment, the changeset), so the rounds were not run again. Records (round.json, every turn's record, both summaries): `skill-evals-before-304a4c53.tgz`, `skill-evals-after-3b62b5e9.tgz`, `skill-evals-after-reread-3b62b5e9.tgz` in the project's shared files, folder `34770/`. No unit test changes: the diff is skill text, three eval fixtures, ratchet rows and a changeset. The one test that names the ratchet script, `packages/spec/scripts/platform-catalog.test.ts`, ran apart from the gate list (see Verification). ## Verification Eleven skill files, measured on the head `edcd7df4ad` against `main` (`ceil((utf8 bytes − the SKILL.md version stamp line) / 4)`, the ratchet's own arithmetic): | file | lines | bytes | ratchet row | |:--|--:|--:|--:| | `objectstack-data/SKILL.md` | 472 → 167 | 26,860 → 8,983 | 6709 → 2239 | | `objectstack-data/references/examples-objects.md` | 192 → 305 | 6,892 → 14,441 | 1723 → 3611 | | `objectstack-data/rules/field-types.md` | 273 → 318 | 14,160 → 16,799 | 3540 → 4200 | | `objectstack-data/rules/relationships.md` | 384 → 393 | 16,714 → 17,274 | 4179 → 4319 | | `objectstack-data/rules/security.md` | 349 → 388 | 17,335 → 19,290 | 4334 → 4823 | | `objectstack-data/rules/validation.md` | 329 → 392 | 11,031 → 13,861 | 2758 → 3466 | | `objectstack-automation/SKILL.md` | 480 → 215 | 28,206 → 10,703 | 7045 → 2669 | | `objectstack-automation/references/examples-flows.md` | 145 → 432 | 6,170 → 25,729 | 1543 → 6433 | | `objectstack-automation/references/integration-recipes.md` | 186 → 212 | 10,379 → 12,222 | 2595 → 3056 | | `objectstack-automation/references/state-machines-and-approvals.md` | 388 → 388 | 23,706 → 23,708 | 5927 → 5927 | | **ten files of the move** | 3,198 → 3,210 | 161,453 → 163,010 | 40,353 → 40,743 | | `objectstack-project/SKILL.md` (the re-pointed line) | 214 → 214 | 11,985 → 11,987 | 2990 → 2990 | - **What an AI loads first**: the two entry files together 55,066 → 19,686 bytes (13,754 → 4,908 tokens), 64% smaller. - **Whole pack**: authored (ratcheted) 200,068 → 200,458 tokens (+390); bundle total 304,380 → 304,770. The pack does not shrink: the text moved inside it. - **Ruling ④A accounting**: every raised row equals its measured bytes, zero headroom (the gate is exact since objectstack-ai#37747, so a row above or below its file is red). Of the +390, +430 is the automation entry's own row (the pure router measured 2239; ruling 7168461386 A restores six flow-shape facts and ruling 7176941587 Q2 A keeps 187 bytes, 2239 → 2670, then 2669 after the merge). Set that authorised row aside and the moves sum to −40: the sum of ceilings does not rise. <details><summary>Gates run locally on the head</summary> Derived with `node scripts/pm/dispatch-gates.mjs --commands` on `3b62b5e9b0`, each command run and its exit code recorded, then reconciled with `--ran`: **69 derived, 68 run (each exit 0), 1 NOT-MEASURED, 0 unrun.** On head `edcd7df4ad` (the three nits) the 16 gates that read the changed files were run again, each exit 0: the fourteen skill gates (`check-skills-token-ratchet` and its self-test, `check:skill-docs`, `check:skill-refs`, `check:skill-served-sections`, `check:skill-links`, `check:skill-identifier-liveness`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:doc-authoring`, `check:nul-bytes`, `check:pm-skill-id-lint`, `check:skill-examples`, `check:doc-formula-expressions`) and the two changeset gates. The other gates were not re-run on it. A trial merge with `origin/main` `c6a1328dfe` (which moved the ratchet script and `skills/objectstack-ai/SKILL.md` meanwhile) has no conflict and the ratchet is green on the merged tree (200,510 / 200,510); the trial was discarded and `main` is not merged again. - NOT MEASURED: `pnpm check:dual-build-cjs-loads` exited 3 (prerequisite not met: it needs every package's `dist`, a whole `pnpm build`). Long builds go to GitHub under this project's standing rule, so CI is the reading for it; the diff touches no package source. - `pnpm check:skill-examples` needed `pnpm --filter '@objectstack/client-react...' --filter '@objectstack/lint...' build` first; then exit 0, 351 prose examples type-check across 3 surfaces. - Outside the derived list, run apart: `pnpm --filter @objectstack/spec exec vitest run scripts/platform-catalog.test.ts` (the one test that names the ratchet script), 21 of 21. - `node scripts/pm/overlap-check.mjs` before the first push: clean against `origin/main` and the two open PRs that share a file (objectstack-ai#38224, objectstack-ai#38192). Exit 0, all 68: `node scripts/check-adr-0087-registration.mjs --base origin/main` · `node scripts/check-adr-0087-registration.mjs --self-test` · `node scripts/check-changeset-no-major.mjs --base origin/main` · `node scripts/check-closing-keyword-parity.mjs` · `node scripts/check-closing-keyword-parity.mjs --self-test` · `node scripts/check-comment-mask-corpus.mjs` · `node scripts/check-declaration-mirrors.mjs` · `node scripts/check-declaration-mirrors.mjs --self-test` · `node scripts/check-doc-route-spelling.mjs --advisory` · `node scripts/check-doc-route-spelling.mjs --self-test` · `node scripts/check-dts-emitted.mjs --self-test` · `node scripts/check-empty-changeset.mjs --base origin/main` · `node scripts/check-empty-changeset.mjs --self-test` · `node scripts/check-self-test-wired.mjs` · `node scripts/check-self-test-wired.mjs --self-test` · `node scripts/check-self-test-workflow-commands.mjs` · `node scripts/check-self-test-workflow-commands.mjs --self-test` · `node scripts/check-skills-token-ratchet.mjs` · `node scripts/check-skills-token-ratchet.mjs --self-test` · `node scripts/check-whole-set-label-write.mjs` · `node scripts/check-whole-set-label-write.mjs --self-test` · `node scripts/ci/assert-turbo-remote-cache.mjs --self-test` · `node scripts/ci/plan-test-core-shards.mjs --self-test` · `node scripts/ci/prune-turbo-cache.mjs --self-test` · `node scripts/ci/snapshot-next.mjs --self-test` · `node scripts/pm/bare-root-worklist.mjs --self-test` · `node scripts/pm/check-governed-queue-guard.mjs --self-test` · `node scripts/pm/release-rehearsal-clone.mjs --self-test` · `node scripts/release-pending-publish.mjs --self-test` · `--filter @objectstack/lint run check:doc-formula-expressions` · `--filter @objectstack/spec run check:skill-docs` · `--filter @objectstack/spec run check:skill-refs` · `--filter @objectstack/spec run check:skill-served-sections` · `check:adr-anchors` · `check:agent-test-spelling` · `check:bash32-floor` · `check:changeset-gate-self-tests` · `check:ci-filter-parity` · `check:cli-command-ids` · `check:closed-ceremony-text` · `check:corpus-claim-drift` · `check:cross-package-test-inputs` · `check:doc-authoring` · `check:driver-memory-census` · `check:dts-closure` · `check:entry-guard` · `check:gitlink-declared` · `check:lean-entry-closure` · `check:merge-driver` · `check:nul-bytes` · `check:parse-guard` · `check:pm-dispatch-gates` · `check:pm-expected-skips` · `check:pm-governed-merges` · `check:pm-skill-id-lint` · `check:pnpm-filter-targets` · `check:pnpm-flag-spellings` · `check:published-files` · `check:ratchet-remedy-authority` · `check:refd-timer-probe` · `check:role-word` · `check:scripts-symbol-anchors` · `check:skill-compatibility` · `check:skill-frame-sync` · `check:skill-identifier-liveness` · `check:skill-links` · `check:sourcemap-no-sources-content` · `check:watch-hint-literal` </details> **Writer**: all `skills/**` text was written by the card thread itself, a session at `CONTRACT_REVIEW_TIER` per the claim (7240213191). Every assistant turn of the session's transcript was served at the tier (210 of 210 when counted against the constant in `scripts/pm/dispatch-gates.mjs`); `verify-review-tier.mjs` itself refuses the transcript because the session once ran a read-only sub-agent to read the rulebook, so that count is the thread's reading, not the script's PASS. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUTzGxLiCQYi8Wvn3K)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUTzGxLiCQYi8Wvn3K <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgUTzGxLiCQYi8Wvn3K --> --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defines the type system shared between backend (ObjectQL) parser and frontend (ObjectUI) renderer.
Core Interfaces
FieldType- 16 data types covering text, numeric, date/time, lookup, selection, and special fields (file, image, json)ObjectField- Field metadata with validation rules, constraints, lookup configuration, and display propertiesObjectEntity- Complete entity definition including fields array, keys, UI hints, audit/soft-delete flags, and search configurationObjectView- View configuration supporting 10 presentation types (list, form, detail, card, kanban, calendar, chart, map, timeline, custom) with columns, filters, sorting, and layoutsUsage Example
Implementation Notes
metadatafields without core schema changesisFieldType()for runtime validationOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.