Skip to content

Commit ebcb2de

Browse files
committed
Merge claude/area-A2-31908-p4b2 into claude/area-A2-31908-p4b3
The base branch moved to 5ef334e (P4b2 round 2, its merge of origin/main at 412fbf7, and its docs and changeset commits). That merge brings in os migrate audit-side-copies, the fourth ledger-copy rewrite, which the contract test now lists. Three files changed on both sides and merged without conflict: the CLI contract test, audit-seal-sealer.test.ts and the plugin-audit barrel. Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq Co-authored-by: Claude <noreply@anthropic.com>
2 parents 6acfe29 + 5ef334e commit ebcb2de

462 files changed

Lines changed: 21160 additions & 1586 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/data-objectstack': patch
3+
---
4+
5+
refactor(data-objectstack)!: retire the test-only `clearSharedDiscoveryCache` from the package entry
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/data-objectstack#clearSharedDiscoveryCache) the retired operand is a test-only function that empties the adapter's in-memory per-origin discovery cache; nothing in the workspace or in hotcrm calls it outside tests, and no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `clearSharedDiscoveryCache` from `@object-ui/data-objectstack`. It reset module state between tests, and no code outside a test called it, in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected. Nothing fetches or renders differently.
13+
14+
The per-origin discovery cache moves verbatim into the package's own module `sharedDiscovery.ts`. `ObjectStackAdapter.connect()` still reads through it, and `getSharedDiscovery` stays exported from the entry unchanged. Only the reset helper stops being published, the same way the package roots already keep `resetRuntimeConfigForTesting`, `resetInflightGetsForTesting` and `__clearRecordEditableCache` off their barrels. The workspace's own tests import it from the module.
15+
16+
What leaves, and what to write instead:
17+
18+
- FROM `clearSharedDiscoveryCache` TO no replacement. The helper was test-only; a host test that needs a fresh discovery read gives each case its own `baseUrl`, or stubs the fetch its adapter makes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/plugin-audit': patch
3+
'@objectstack/rest': patch
4+
---
5+
6+
feat(plugin-audit, rest): a query of an opted-in saved dataset writes one `dataset_query` row in `sys_audit_log` (#31797)
7+
8+
Clause-②: yes (widening) — a new `sys_audit_log.action` value, `dataset_query`, with its writer; a new `AuditPlugin` option, `datasetQueryAudit` (`datasets`, `maxBatchSize`, `flushIntervalMs`); a new `recordDatasetQuery` member on the `audit` service slot; and new exports from `@objectstack/plugin-audit` (`createDatasetQueryAuditWriter`, `buildDatasetQueryAuditRow`, `DATASET_QUERY_AUDIT_ACTION` and their types). `createReadAuditBatcher` takes an optional event type parameter and an optional `overflowMessage`, both defaulting to what it did before. No door answers differently: with no dataset named, nothing is recorded or buffered.
9+
Metadata-protocol: none
10+
Skills-docs: none — no file under `skills/**` teaches the audit ledger's actions or `AuditPlugin`'s options; `content/docs/permissions/record-view-auditing.mdx` gains a "Dataset queries" section.
11+
12+
**What a deployment gets.** Name saved datasets in `new AuditPlugin({ datasetQueryAudit: { datasets: [...] } })` and each query of one through `POST /analytics/dataset/query`, or through each query of its batch door, writes one run-level row: the caller (`user_id`, `actor`, `tenant_id`), the dataset's base object in `object_name`, and in `metadata` the dataset name, the package holding it (`dataset_package`, `null` for the environment's own definition; a name in `datasets` covers every holder of that name), `preview: true` when a draft definition was read, the dimensions and measures selected, the filtered field names and operators (never the values), the row count and the outcome. A report or dashboard is composed in the browser, so the row names the dataset, not a report.
13+
14+
**The rules.** Off by default and opted in per saved dataset; an inline definition (the Studio preview) writes no row. A request the door refuses before the read writes no row; a query that fails after the read started writes one row with outcome `failed`, the HTTP status and the error's machine code, never the error's text. Rows are written in batches off the request path, stamped with the query's instant, and a lost batch is reported at `error` once per cause.

‎.changeset/31908-p4b2-bounded-checkpoints.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fix(plugin-audit)!: the audit sealer seals a window into checkpoints of at most
66

77
Clause-②: yes (narrowing) — narrowed: `os audit verify` reports a row id that two checkpoints list as the new chain fault `listed_twice` and fails the run, where the 18.4.0 verifier accepted it, and the 18.4.0 sealer could write such a chain when two of its late sealings overlapped. Widened: the checkpoint's signed body gains two optional fields, `part_index` and `final_part`; `sys_audit_checkpoint` gains two nullable columns for them; and the exported `AuditChainFaultKind` union gains `listed_twice`.
88
Metadata-protocol: none
9+
Skills-docs: follow-up owed — skills/objectstack-data/evals/objects-fields-relationships.json, skills/objectstack-data/rules/lifecycle.md — both still teach that the sealer signs each `created_at` hour into one checkpoint per organization, where this change cuts a window into checkpoints of at most 10,000 rows each (the eval's graded `expected_output`, and `lifecycle.md` § Sealing); the card also carries their older stale claim that no verifier exists, which `os audit verify` already contradicts. `skills/**` is changed only on a `domain:skills` PR, so this one does not edit them; `content/docs/data-modeling/objects.mdx` and `content/docs/deployment/cli.mdx` gain the parts, the new fault and what a removed checkpoint shows in this change.
910

1011
<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed or renamed: the moved answer is a verify verdict over stored audit checkpoints, which no metadata author writes. Nothing stored is rewritten and no tolerance or repair is shipped, so a chain sealed by 18.4.0 with overlapping late sealers now reports listed_twice. -->
1112

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/core': patch
3+
---
4+
5+
fix(core): a release artifact entry wrapped correctly whose content is refused ends its refusal on that content refusal, not on advice about the wrapper or about glob patterns
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`resolveArtifactPackageEntries` (ADR-0130 D4) refuses a `packages[]` entry as `INVALID_ARTIFACT_PACKAGE_ENTRY` / `422` and quotes the entry's parse issues. It used to append the same two pieces of advice to every such refusal: wrap an inlined body as `{ manifest: { … } }`, and the body holds definitions, not the authoring manifest's glob patterns. So an entry wrapped correctly whose record page places no component, whose `manifest.id` is invalid or whose body carries an undeclared key pointed its author at the wrapper and at globs, away from the one thing to fix.
11+
12+
The advice now follows the issue it answers. The wrapper advice is given when the entry itself is not an object or carries keys beside `manifest` / `source` (an inlined body), or when its `manifest` is missing or not an object. The assembled-body advice is given when `manifest.objects` or `manifest.datasources` (or an element of either) holds a string. Any other refusal ends on the quoted issues and, when issues are withheld, their count. A quoted issue that already ends on a period is no longer followed by a second one. The error code, the status, the leading sentence and the quoted issues are unchanged, and so is what is refused.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/plugin-email': patch
3+
---
4+
5+
fix(plugin-email): a template name an enabled and a disabled package hold sends what it sends when only the enabled package holds it (ADR-0150 D3)
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
While one of two packages that hold an email template name is disabled, the send (over the metadata protocol's execution list) now reads the bundle the way it reads a name one package holds: from the environment-wide list, which no longer lists a disabled package's members, its customization pair's rows or a dependent's added locales. Before, it read the enabled package's own address, which leaves out the locales its dependents add.
11+
12+
FROM → TO, with `B` disabled and `A` the one enabled holder: a send of a locale that both `A`'s customization pair (`A.custom`) and a dependent of `A` carry answered the pair's row, and now answers the same member a send answers when `B` holds nothing of the name (the dependent's locale). Every other answer is unchanged, and nothing changes while no holder of the name is disabled, or when the loader reads the registry's own list (no protocol registered).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): a stored computed field reads only its own row; the skills name the cross-record and volatile-input warnings
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The three places the published skills tell an agent to move a `formula`'s `expression` onto a stored field now say what that field may read. `objectstack-data` → Relationships → Computed column owns the sentence: a stored computed field reads only its own row; a related record's value (`record.product.unit_price`) keeps what it held at the row's last write and draws the `stored-expression-cross-record-input` warning, so it stays a `formula` (read time, not totallable) or becomes a snapshot a flow on the related object writes, and a field left stored is repaired by `os migrate stored-expressions --object OBJECT --field FIELD --changed --apply`; the clock (`now()`, `today()`, `daysFromNow()`, `daysAgo()`), the acting user, `can()` and `hasCapability()` are fixed at the write and draw `stored-expression-volatile-input`; a `formula` keeps them current, and for the clock a scheduled flow does too. The `formula` row in `rules/field-types.md` and the total-over-a-computed-value bullet in `objectstack-ui` `rules/dashboards.md` point to it. The dashboards bullet also stops saying existing rows have no backfill: rows a publish did not fill are filled by `os migrate stored-expressions --apply`. Both rules are warnings, not refusals; no schema or runtime change.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/types': patch
3+
'@objectstack/rest': patch
4+
---
5+
6+
fix(types, rest): a package-scoped refusal's `details.candidates` is answered only when every element is a holder
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
`packageScopedRefusalCandidates` (`@objectstack/types`), the one recogniser every door reads for a package-scoped refusal's `details.candidates`, answered the refusal's list as `readonly unknown[]` without looking at its elements, and the rest door cast that to core's `PackageScopedHolder[]`. The recogniser now checks each element against the four holder kinds (`package` with a string `packageId`, `environment`, `platform`, `residual` with a string `ownerId`) and answers the list typed as those holders, so the rest door assigns it without a cast. Every holder core's `PackageScopedNameRefusedError` carries passes, so every answer a framework producer can cause is unchanged.
12+
13+
One corner moves, for a refusal no framework producer throws: a `409 RESOURCE_CONFLICT` of the refusal's shape whose `refusal.candidates` holds an element that is not a holder. FROM `details.candidates` echoing the list as thrown TO no `details.candidates` member, the answer the recogniser already gave a `candidates` that is not an array. It moves on every door that reads the recogniser alike (the `/data` doors, a batch row's error, the `/meta` reads, the resolver's doors), so they keep agreeing. Status, `code` and the sentence are unchanged.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the `notify` selectors say when `org:members` reaches nobody, and show the computed `owner_of:` form
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`objectstack-automation` § `notify` said `org:members` reaches every member of the run's organization, else that of the record the notification is about, and was silent on a run with neither. There the resolver warns in the server log and returns nobody while the node still succeeds: under the `single` posture, a `schedule` flow that declares no start-node `organization` and has no record hits it (under `group` the notification write itself is refused and the node fails). The line now says so, matching `content/docs/automation/flows.mdx`, and says the warning for an unrecognised `org:` value is a server-log one too. The `owner_of:OBJECT:ID` line now shows the form a flow needs, an envelope that builds the string from a computed id (`source: "'owner_of:crm_case:' + record.case_id"`). Paid for in the same file, no ceiling moved: the `NotifyConfigSchema` `strictObject` clause that restated "an undeclared key is a named parse error", three ADR asides, and the pointer that sends side effects to an object hook, which the skill's own description and objectstack-data already carry. No schema or runtime change.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@objectstack/cli': patch
3+
'@objectstack/plugin-audit': patch
4+
---
5+
6+
feat(cli): `os migrate audit-side-copies` runs the at-rest side-copy rewrite on the live audit tables and the archive
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
**Run `os migrate audit-side-copies` once after upgrading from 18.4.0 or earlier, a dry run first:**
12+
13+
```bash
14+
os migrate audit-side-copies # dry run: counts per table and store, writes no row
15+
os migrate audit-side-copies --object sys_audit_log # only one copy table (repeatable)
16+
os migrate audit-side-copies --apply # remove the columns (prompts; --yes skips the prompt)
17+
os migrate audit-side-copies --apply --yes --json # CI / scripts
18+
```
19+
20+
The audit writer no longer copies a side-copy column (another record's field values, today an approval request's `payload_json`) into `sys_audit_log` (`new_value`, `old_value`) or `sys_activity` (both halves of `metadata`). Copies written before that still carry it. Until they are rewritten, the read-time redaction drops the column and the query guard treats a query naming it as reaching every object, so the command is cleanup, not a gate.
21+
22+
- **The command.** It drives `@objectstack/plugin-audit`'s `migrateSideCopies` (the live `sys_audit_log` and `sys_activity` rows) and `migrateArchivedSideCopies` (the archive datasource `sys_audit_log` archives to). It is a dry run by default and writes only with `--apply`. Its flags are `os migrate audit-key-material`'s (`--database-url`, `--apply`, `--yes`, `--force`, `--json`) plus `--object`, which takes `sys_audit_log` or `sys_activity` and narrows the run, hot and archive, to the tables it names. Any other name is refused with `OBJECT_NOT_FOUND`, exit 1, before anything is read. The report gives, per copy table, the copies read and the copies rewritten (or to rewrite), for the hot tables and for the archive each, and never prints a value. It is idempotent: a second `--apply` rewrites nothing. A failed read or write, a sealed row it had to refuse, or an archive it could not reach exits 1, as for its twins.
23+
- **The rewrite's name (`@objectstack/plugin-audit`).** A sealed row the rewrite amends (ADR-0154 D7) now records `rewritten_by: 'os migrate audit-side-copies'`, the command that rewrote it, as `audit-mail-bodies`, `audit-key-material` and `audit-metadata-bodies` record theirs. It recorded `side-copy-migration` before, a name no release shipped; a row amended under it on a pre-release build keeps it.

0 commit comments

Comments
 (0)