Skip to content

Commit 1ea0196

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-8fcc2p
2 parents 5508f9f + f72f335 commit 1ea0196

446 files changed

Lines changed: 4520 additions & 1747 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: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
'@objectstack/spec': major
3+
'@object-ui/types': major
4+
'@objectstack/lint': minor
5+
'@objectstack/runtime': minor
6+
'@objectstack/platform-objects': minor
7+
'@object-ui/core': minor
8+
'@object-ui/components': minor
9+
'@object-ui/plugin-detail': minor
10+
'@object-ui/app-shell': minor
11+
'@object-ui/i18n': minor
12+
'@objectstack/cli': patch
13+
'@objectstack/cloud-connection': patch
14+
'@objectstack/objectql': patch
15+
'@objectstack/metadata-protocol': patch
16+
'@objectstack/plugin-approvals': patch
17+
'@objectstack/scenarios': patch
18+
'@objectstack/service-datasource': patch
19+
'@objectstack/service-messaging': patch
20+
'@objectstack/verify': patch
21+
'@object-ui/console': patch
22+
'@object-ui/fields': patch
23+
'@object-ui/layout': patch
24+
'@object-ui/plugin-grid': patch
25+
'@object-ui/plugin-list': patch
26+
'@object-ui/react': patch
27+
---
28+
29+
feat(spec)!: an action's `locations` say what it acts on, not the part of the page it sits in
30+
31+
**BREAKING** (19.0.0): `ACTION_LOCATIONS` is `list`, `record`, `record_page`, `record_row`, `record_related`, `record_section`. The four words that named a part of a page are retired: `list_toolbar`, `list_item`, `record_header` and `record_more`. `record` is new: the action acts on one record, so it is drawn on the record page's header and in each list row's menu. Which actions are buttons and in what order stays the object's `actionLayout`.
32+
33+
Clause-②: yes (narrowing)
34+
Metadata-protocol: narrowed
35+
Skills-docs: follow-up #37895
36+
37+
<!-- adr-0087: registered action-locations-acted-on -->
38+
39+
A replacement with a registered conversion, so `yes (narrowing)` as on main's precedents (`.changeset/pre/37086-define-metadata-form-rename.md`, `.changeset/pre/37304-knowledge-source-governed-type.md`). Narrowed: the four retired words are refused wherever a location is read. Widened in the same change: the four newly accepted values `list`, `record`, `record_page` and `record_row` at the same positions; the new `@object-ui/types` export `actionFoldedIntoMenu`; and eight new `@object-ui/i18n` Studio keys for the location labels (en, zh), which replace the eight keys of the retired words.
40+
41+
FROM → TO (each action is drawn in exactly the places it was drawn before):
42+
43+
- `locations: ['list_toolbar']` → `locations: ['list']`.
44+
- `locations: ['list_item']` → `locations: ['record_row']`.
45+
- `locations: ['record_header']` or `['record_more']` → `locations: ['record_page']`.
46+
- `record_header` or `record_more` beside `list_item` → `locations: ['record']`.
47+
- `locations: ['record_more']` without `record_header` (the action lived only in the record header's ⋯ menu) → `locations: ['record_page'], component: 'action:menu'`. The fold is the action's `component`, the key that already sends an action into an action bar's overflow menu.
48+
- A component's single `location` (`record:quick_actions`, `action:group`, `action:bar`): `list_toolbar` → `list`, `list_item` → `record_row`, `record_header` → `record_page`.
49+
50+
An old word is refused at authoring with the word to write instead. `os migrate meta --from 18 --write` rewrites sources (ADR-0087 conversion `action-locations-acted-on`, retired from the load path from day one, as every protocol-19 entry). Stored items (`applyConversionsToStoredItem`, `os migrate meta --stored`) and built artifacts replay the same conversion. It leaves a TODO, and changes nothing, where no lossless rewrite exists: a `record_more`-only action also on `list_toolbar` that does not already carry `component: 'action:menu'` (the list toolbar folds `action:menu` too); an action at `record_header` with an authored `component: 'action:menu'` (the record page header folded it into its ⋯ menu while a `record:quick_actions` bar at `record_header` drew it as a button, and `record_page` has one state for both); a component whose `location` is `record_more`; and an `action:group` at `record_header` with a `record_more`-only member. A site left as stored keeps its old word, which a protocol-19 runtime matches to no surface: that action or block is drawn nowhere until it is rewritten by hand. The protocol-19 upgrade guide carries the same step as the semantic entry `action-locations-page-parts-retired`.
51+
52+
Also in this change:
53+
54+
- `@object-ui/types`: `actionRendersAt` reads `record` as covering `record_page` and `record_row`. The new `actionFoldedIntoMenu(action)` answers whether an action is folded into the ⋯ (`component: 'action:menu'`). `arrangedHeaderActions` pins and unpins through `component` and no longer writes locations.
55+
- `@object-ui/components`: the record `page:header` routes every folded action to its ⋯ menu, and every other `record_page` action takes the inline budget, as `record_header` actions did.
56+
- `@object-ui/plugin-detail`: `record:quick_actions` defaults to `record_page` and leaves folded actions out at that location, as it left out `record_more`-only ones. The related list reads `record` as a row action.
57+
- `@object-ui/core`, `@objectstack/runtime`: the record-scoped checks (`isRecordScopedAction`, `requiresRecord`) accept `record`.
58+
- `@objectstack/lint`: the record-page header, related-list and action-layout rules read the new words.
59+
- Studio: the action inspector, the `record:quick_actions` location dropdown and the action preview offer `record` and draw the fold as "record_page · ⋯".
60+
- `@objectstack/platform-objects`, the examples and every other package: declarations and prose rewritten to the new words. The packages listed as `patch` change comments, test fixtures or authoring copy, except three that ship rewritten words: `@objectstack/plugin-approvals` and `@objectstack/service-datasource` (their declared actions' `locations`) and `@object-ui/layout` (a location literal it passes at runtime).
61+
62+
Not moved: #37895 (the `skills/**` teaching of the new words; Blocked-by this change).
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/spec': patch
4+
---
5+
6+
fix(lint)!: a knowledge source is checked for its object, its fields and the search gates that need no caller, in `os validate` and at publish
7+
8+
Clause-②: yes (narrowing)
9+
Metadata-protocol: narrowed
10+
Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md
11+
12+
<!-- adr-0087: registered knowledge-source-publish-refuses-missing-references-and-gated-objects -->
13+
14+
ADR-0161 K4, row 4.
15+
16+
**BREAKING** for the publish of a knowledge source that carries one of the four errors below: it was accepted before and is refused now (422, the finding's rule id, path, message and fix), and `os validate` / `lint` / `compile` / `build` refuse the same source. The schema is unchanged, and stored sources are not rewritten or refused at boot.
17+
18+
A new rule, `validateKnowledgeSource`, exported from `@objectstack/lint` with its five rule id constants. It runs on all three CLI commands and on the runtime publish gate for a `knowledge_source` write, with one set of rule ids and messages. Four errors: a source over a missing object has nothing to index, a missing field indexes no text for that member, and a gated object is never searched for a caller the service judges:
19+
20+
- `knowledge-source-object-unknown`: `source.object` names an object that the stack, a package of its artifact, or (at the publish gate) the host does not define. Under the package closure the publish gate states, an object outside it is worded for the closure with the remedy to declare the dependency. On the CLI, while the manifest declares a dependency the artifact does not carry, the build cannot see that package's objects, so the finding is a warning that clears when the dependency defines the object (the publish gate judges it against the closure, which holds them); with no such dependency it is an error. A platform object a known package registers is not judged when the stack does not carry it; a platform-prefixed name no known package registers is a warning.
21+
- `knowledge-source-field-unknown`: a `source.content` or `source.metadataFields` member names no field of the object, declared (the stack's own object extensions included) or addressable without a declaration (`id`, which the driver provisions, and the injected system columns `owner_id`, `created_at`, …).
22+
- `knowledge-source-object-not-searchable`: the object's API exposure does not serve `search` (`canServeApiOperation(enable, 'search')`): `enable.apiEnabled: false`, an `enable.apiMethods` list that does not grant `list` (search derives from it; `search` itself is a retired list value the parse strips), or a list that grants `list` beside `enable.searchable: false`. With no `apiMethods` list, `searchable: false` does not refuse it.
23+
- `knowledge-source-system-object-not-ai-readable`: a `sys_` object that does not declare `enable.aiReadable: true` (`isAiReadExposed`).
24+
25+
One warning, which refuses nothing:
26+
27+
- `knowledge-source-field-never-indexed`: a member names a credential-class field or a field declared `internal: true`; the index never carries either, even when named, so the member is skipped.
28+
29+
The two gates are the knowledge service's own search-time gates that need no caller, asked through the same spec predicates. The disabled-package gate and the field-queryable gate need an environment or a caller and stay at save, judged for the author. `os explain` answers each of the five ids.
30+
31+
## FROM → TO
32+
33+
- `source: { object: 'kb_artcle', … }` → `source: { object: 'kb_article', … }`, an object the stack defines. An object a dependency defines clears at publish once the package's manifest declares that dependency in `dependencies`; on the CLI it stays a warning while the artifact does not carry the dependency.
34+
- `content: ['title', 'bdy']` → `content: ['title', 'body']`.
35+
- a source over an object with `enable: { apiEnabled: false }` → serve the object (`apiEnabled: true` and, where it declares `apiMethods`, a list that includes `list`, with `searchable` not false), or index another object.
36+
- a source over `sys_audit_note` → index a business object, or declare `enable.aiReadable: true` on the system object's own definition.
37+
38+
`@objectstack/spec` adds only the upgrade-guide entry `knowledge-source-publish-refuses-missing-references-and-gated-objects`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
fix(service-knowledge): the knowledge field gate stops asking about a field named `title`; a source whose index could still hold an earlier-rule title is searched only once its index is proven built under the current recipe
6+
7+
Clause-②: yes (narrowing) — narrowed: for a caller other than the system context, a source over an object that declares a field named `title` the index may carry and the source does not serve (the display field is another field, none resolves, or the object's fields cannot be enumerated; the source lists `title` in neither `content` nor `metadataFields`) is now searched only when its adapter's `indexStatus` reports the fingerprint and the recipe hash the service computes now, and the builds that record that hash purge; otherwise the search names it in `refused` as `KNOWLEDGE_REBUILD_REQUIRED` (409), and refuses whole when it was the only source, where it was searched for any caller who may query `title`. That holds until a complete build of the source has completed: on a built-in adapter the boot pass, a source reload or the reconcile runs one, and under `buildAtBoot: false` (no boot or reload build) only the reconcile, where it runs, or `os knowledge rebuild` does. It holds for good, since no build can prove the index, for a source with `refresh.onRecordChange: false` (its builds purge nothing) and on an adapter with no `indexStatus`, no `completeBuild` or no `listDocuments`. Each hit of a proven source is then served only when the record still belongs to the source and the stored `docHash` is the one the current recipe assembles from the record as it reads now (one system read per source per search round); a hit that fails that check, or that the check cannot be made for (the read fails, no record id, no stored hash, a hash that cannot be computed, an unreadable tenancy posture), is dropped, where it was served before. Widened: saving a `knowledge_source` over such an object no longer requires the author to query `title`, which the source never indexes.
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed or renamed, and nothing stored is rewritten: the moved answer is whether a search serves a source whose index is not proven built under the current recipe. The adapter author's fix below is new code on optional IKnowledgeAdapter members, not a rewrite of anything authored or stored, and the operator's fix is a rebuild. -->
11+
12+
**BREAKING** for deployments whose knowledge sources sit over an object that declares a field named `title` the source does not serve:
13+
14+
- **Such a source is refused `KNOWLEDGE_REBUILD_REQUIRED` until a complete build under the current recipe completes.** On a built-in adapter (memory, pgvector, Turso) the boot pass, a source reload or the reconcile builds a source whose index records no recipe hash or another one, and the refusal ends when that build completes. Under `buildAtBoot: false`, which also turns off the build on reload, only the reconcile (where a job service runs it) builds it. Fix: run `os knowledge rebuild <source>`; it also ends the refusal sooner in every other case.
15+
- **A proven source serves a hit only when its stored document matches the record as it reads now.** A document written before an edit the event sync has not caught up with, or left in place by a build's purge, is dropped from the answer until it is rewritten; for a stale or missing record's own document the search starts that repair in the background, once per document until a later search finds it current, and a document under a foreign id is dropped, not repaired. Fix: none needed for a synced source; `os knowledge rebuild <source>` rewrites every document now.
16+
- **An adapter whose search hits carry no `docHash` serves no hit from such a source**, since a hit with no stored hash cannot be checked against its record and is dropped. The built-in adapters (memory, pgvector, Turso) return the stored `docHash` on every hit. Fix: return each hit's stored `docHash` from the adapter's `search` (ADR-0161 K8, item 3).
17+
- **A source with `refresh.onRecordChange: false` stays refused** to every caller but the system context: an external indexer owns its index, its builds purge nothing, so no recorded recipe hash proves it. Fix: let the service sync the source (drop `refresh.onRecordChange: false`) and rebuild it, or search it as the system context.
18+
- **On an adapter with no `indexStatus`, no `completeBuild` or no `listDocuments`, such a source stays refused**, since no build can prove what its index holds. Fix: implement all three on the adapter (`@objectstack/spec/contracts`, `IKnowledgeAdapter`), then rebuild the source.
19+
20+
The field gate (ADR-0090 D10 rule 1) kept asking whether the caller may query a declared `title` field alongside the object's display field, because a document indexed before the title became the display field carries the value of `title`. That arm is retired. A complete build under the current recipe rewrites each document it walks whose title changed (its `docHash` covers the title) and, when it purges, removes every document it did not walk; the recipe hash names the title rule (ADR-0161 K7) and was first recorded by code that already read the display field. So the search asks for that proof per source instead, and only for a source where it matters: one over an object that declares no `title` field, whose display field is `title`, whose `title` is credential-class or `internal`, or that serves `title` itself, is searched as before, with no extra read. A proven source's hits are each checked against the live record, since the proof speaks for the index as its last complete build left it and not for a document written after it. Every other arm of the gate (the display field, each `content` and `metadataFields` member, the fields `where` reads, the object-level gates) is unchanged.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/runtime': patch
3+
---
4+
5+
fix(runtime): a dispatcher door is served only by the request's own kernel
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Every dispatcher door bridge — the auth door, the comment doors, the approval action page, the webhook redeliver door, the inbound automation hook (including the engine that judges a qualified hook's address), and the personal-view, attachment and print doors — reads the services it serves with off the request's own kernel, and only there. When the request's kernel holds no such member, the door answers its typed not-available `501 NOT_IMPLEMENTED`, the same answer an empty slot already gave. On a host with one kernel nothing changes: the request's kernel is that kernel.

‎content/docs/ai/knowledge-rag.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Vectors from two embedding models are not comparable, and neither are the passag
304304
A store that keeps **generations** (pgvector and Turso) does not throw the old index away when the fingerprint changes. The rebuild fills a new generation beside it, and the switch happens only when the build is done:
305305

306306
1. **The build writes into the new generation.** The complete reindex writes every document into it. Record changes that arrive while it runs (event sync) carry the new fingerprint, so they also land in the new generation only. Nothing is written into the old one under the new model.
307-
2. **Search during the build is refused, never answered from the old index.** A search of the source answers `KNOWLEDGE_REBUILD_REQUIRED` (409) and says the source *is being rebuilt*. A search over several sources still answers from the others, and `search_knowledge` names this one in `refused`.
307+
2. **Search during the build is refused, never answered from the old index.** A search of the source answers `KNOWLEDGE_REBUILD_REQUIRED` (409) and says the source *is being rebuilt*. A search over several sources still answers from the others, and `search_knowledge` names this one in `refused`. The same code has a second cause, from the knowledge service itself: a source over an object that declares a `title` field the source does not serve is refused until its index is proven built under the current recipe ([the protocol's title rule](/docs/protocol/knowledge)).
308308
3. **At the end, the switch.** Once the walk is done, the purge runs once. Then the new generation becomes the active one, and the old one is deleted. pgvector deletes it in batches of 1,000 rows, so no long lock is held over a large source. If the deletion stops part-way, the source's next build finishes it, and the old rows are never searched meanwhile.
309309
4. **One builder per source.** pgvector takes a PostgreSQL advisory lock on the source when its build begins and holds it until the switch. A second build of the source, from another node or process, is refused `LOCK_CONFLICT` (409) and walks nothing. This is a *session* lock, so the store needs a direct or session-mode PostgreSQL connection. Behind a transaction-mode pooler (PgBouncer transaction pooling, or a hosted provider's pooled URL), the lock does not stay with the store's session. Point the store's `url` at a direct or session-mode endpoint. A release whose session no longer held the lock is logged as a warning.
310310
5. **A build that stops is resumed, not restarted.** The generation under construction is kept, with everything written into it so far. The next build under the same fingerprint takes it up, and skips every document it already holds unchanged, so only the rest is sent to the embedding provider. If the process stops, PostgreSQL frees the lock at once. If the build fails on a process that keeps running, the lock is freed after 15 minutes without a call of the build itself. Record events that keep arriving for the source do not hold it. A build under yet another fingerprint abandons the unfinished generation and deletes it, and so does a build under the active fingerprint, when the change was reverted before the new index was finished.

0 commit comments

Comments
 (0)