Skip to content

Commit 9baa1e1

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-fsl9rk
2 parents 7d0d12c + 9dacccf commit 9baa1e1

51 files changed

Lines changed: 3349 additions & 255 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/25873-report-export.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/plugin-report': patch
3+
---
4+
5+
feat(plugin-report): the report page offers CSV / XLSX export of the table it draws (`exportOptions`)
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`ReportSchema.exportOptions` (`{ formats?, includeHeaders?, fileNamePrefix? }`) was accepted but read by nothing, so a report table could not be downloaded. The report page now reads it:
11+
12+
- **The control.** A non-joined report draws an Export control above its body once its table has rows, offering the declared formats in order: absent means CSV and XLSX, `formats: []` draws no control.
13+
- **What is exported.** The table as drawn: the grouped table or the matrix cross-tab, its header row (dimension and measure labels as shown), its rows in the order shown and the server totals it draws. The file carries whatever the table's own query carried (the report's `runtimeFilter` and, where declared, its period); nothing is re-queried or re-aggregated. `includeHeaders: false` drops the header row.
14+
- **Who may export.** Not a report key: the control is offered only when the viewer's effective API operations on the dataset's base object include `export` (`ObjectPermission.allowExport`, the predicate the list toolbar uses). An absent operation set (no permissions provider, an unrestricted object) keeps it, as on the list.
15+
- **The files.** Both are written in the browser. The CSV is the drawn text (UTF-8 with a byte-order mark, RFC 4180 quoting; a data cell opening with a formula character is prefixed with a tab). The XLSX writes measure cells as numbers; ExcelJS is imported only when an XLSX is asked for. The file is named `fileNamePrefix`, else the report label, plus a local timestamp (the list export's file name builder).
16+
17+
`@object-ui/plugin-report` now depends on `@object-ui/permissions` and `exceljs`.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql)!: the in-process engine refuses an empty projection, as every published declaration of a read's projection does (#27008)
6+
7+
Clause-②: no (narrowing) — `ObjectQL.find` / `findOne` refuse `fields: []`, and an `expand` entry's `fields: []` at any depth, which they read before as every column. Nothing is widened.
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export or type changes: EngineQueryOptionsSchema.fields already declares the refusal, and the engine now enforces it at its entry. There is nothing for a migration to rewrite and no tombstone. -->
11+
12+
**BREAKING** accept-set narrowing at the in-process read entry (`@objectstack/objectql`).
13+
14+
- **Before.** The HTTP doors refuse `select: []` with `400 VALIDATION_ERROR`, and `EngineQueryOptionsSchema.fields` declares the same refusal, but `engine.find(object, { fields: [] })` and `findOne` never parsed their options with that schema. The empty list reached the driver, which serves it as no projection: every column came back, owner, organization and audit columns included, and the caller was not told. An `expand: { rel: { fields: [] } }` entry expanded every column of the related record the same way.
15+
- **Now.** Both entries refuse an empty projection before any driver read: the top-level `fields`, and every `expand` entry's `fields` at any depth. The error carries `status: 400` and `code: 'VALIDATION_ERROR'`, the answer the HTTP doors give, so `mapDataError` serves an in-process caller and a REST caller alike. Its words are the declaration's own (`Name at least one field`), read off `EngineQueryOptionsSchema.fields`. A system-context read is refused too: the rule is about the shape, not the caller.
16+
- **Unchanged.** An absent or `null` `fields` still reads every column. A non-empty projection projects as before, including the tolerance for an unknown plain column.
17+
- **Who sees it.** A plugin, hook, flow or other in-process caller that passed an empty projection, by mistake or by building one that came out empty. No in-repo caller does.
18+
19+
**The remedy.** Leave `fields` out to read every column, or name the columns to read.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/components': patch
4+
'@object-ui/plugin-detail': patch
5+
'@object-ui/i18n': patch
6+
---
7+
8+
feat(app-shell,plugin-detail,components,i18n): the record page's timeline and related columns are each reader's switches, per object, toggled from the crumb row
9+
10+
Clause-②: no
11+
Metadata-protocol: none
12+
13+
Whether the record page shows its timeline column and its related column is now the reader's own choice, per object, kept in the browser. It is not metadata: no key, no spec change.
14+
15+
- **Defaults derived from the object.** A reader who never chose gets the timeline on for a "worked" object and off otherwise, and the related column on. An object is worked when `stageField` names a field, when a field's options declare a lifecycle `kind` (unless `stageField: false`), or when it sets `enable.files: true` — only what the object declares of itself. Being another object's `master_detail` parent does not count: a container that owns child rows (a price book, a campaign) is not a worked record. `recordTimelineDefaultReason` and `recordPageColumnDefaults` in `@object-ui/plugin-detail` say which.
16+
- **A switched-off column frees its room.** With the timeline off, a wide page draws details | related, and the timeline's blocks (the composer and History) become an Activity card at the foot of the related column. With the related column off, it stays behind the rail toggle. `recordPageArrangementFor` is the rule, and `RecordPageColumns` takes the reader's `switches`. Below the column widths the page is tabbed as before, the switches are kept for when it widens, and `?tab=` is unchanged.
17+
- **Panel toggles.** `PanelToggles` in `@object-ui/components` is a group of icon toggles with `aria-pressed`, a tinted pressed state, and a tooltip naming the shortcut. The record page draws it on its crumb row, right side, only in a column tier. It is not drawn in the drawer or split pane.
18+
- **Shortcuts.** `⌘⇧.` / `Ctrl+Shift+.` toggles the timeline and `⌘⇧,` / `Ctrl+Shift+,` the related column, matched by the physical key. Not `⌘⇧T` / `⌘⇧R`: the browser keeps those (reopen closed tab, hard reload) and the page never receives them. They do nothing while a text field has focus, and the keyboard-shortcuts dialog lists them while the record page is open.
19+
- **One preference store.** `app-shell`'s `workspacePreference` module keeps every reader preference by preference and scope (`user`, or `object:OBJECT_NAME`). Each value is a small record with a version `v`. It reads live through `useSyncExternalStore`, follows other tabs, and falls back to the default with no storage. The record-open preference (`os:record-open-mode`) is now a thin alias over it and keeps its stored spelling, so a reader's earlier choice reads back unchanged.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/console': patch
3+
---
4+
5+
feat(console): a shared record shows its authored field labels, picklist labels and currency
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** The share-link page `/s/:token` labelled each row of a non-chat record with the field key humanized ("Annual Revenue") and formatted each value by its JSON shape only, so a picklist showed its stored code and a currency amount showed a plain number.
11+
- **Now.** The page reads the resolve answer's `fields` projection. Each row carries the field's authored label. A picklist value shows its authored option label and colour, one badge per value for a multi-select. A currency amount is formatted in the currency the field declares (`currencyConfig`), through the same resolution the record detail view uses; a field with no fixed currency and no tenant default still shows a plain amount.
12+
- **Lookups.** A lookup row shows its authored label and the stored record id. The page never reads the referenced record: an anonymous visitor cannot, so the target's name is not shown.
13+
- **Unchanged.** A key the projection does not describe, and an answer from a server that does not send `fields`, keep the humanized label and the JSON-shape value. Redacted fields stay absent. The page makes no request beyond the resolve call.

‎content/docs/data-modeling/queries.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ retired, read them with the operator-only
296296
them before `os migrate apply --allow-destructive` drops the column. No runtime door serves
297297
them.
298298

299+
`fields` names at least one column. An empty list (`fields: []`, `$select=`) is refused with
300+
`400 VALIDATION_ERROR` — on the data API, and by `engine.find()` / `findOne()` for an in-process
301+
caller (a plugin, a hook, a flow), the top-level `fields` and an `expand` entry's alike — rather
302+
than read as "every column". Leave `fields` out to read every column.
303+
299304
### Nested / Related Fields
300305

301306
{/* os:check */}

‎packages/lint/src/lint-liveness-properties.test.ts‎

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,26 +2295,34 @@ describe('#26146 — ledger rows below the child level are graded and counted',
22952295
//
22962296
// `report` joined TYPE_COLLECTIONS with its ledger's first warned rows:
22972297
// `dateRange` and `exportOptions` shipped `planned` + `authorWarn` until the
2298-
// Console report page read them. `dateRange` is `live` since #25873's renderer
2299-
// slice (the report page draws its chip and windows every query), so its
2300-
// warning pin turned red at that flip ON PURPOSE and is re-subjected to the
2301-
// silence. `exportOptions` is still `planned` and is authored in the SAME call:
2302-
// one ledger load, one warning, so the silence is a reading and not a lint
2303-
// that stopped loading ledgers (which also answers []).
2304-
describe('report period and export (#26548 — dateRange live, exportOptions planned until the renderer reads it)', () => {
2298+
// Console report page read them. Both are `live` since #25873's renderer
2299+
// slices (the report page draws its period chip and its Export control), so
2300+
// each warning pin turned red at its flip ON PURPOSE and both are re-subjected
2301+
// to the silence. Both keys are authored beside a property that still warns
2302+
// (`object.externalSharingModel`, `dead`) in the SAME call: one ledger load,
2303+
// one warning, so the silence is a reading and not a lint that stopped loading
2304+
// ledgers (which also answers []).
2305+
describe('report period and export (#26548 — both live, read by the report renderer)', () => {
2306+
const LIT = { objects: [{ name: 'widget', externalSharingModel: 'read' }] };
23052307
const report = (extra: Record<string, unknown> = {}) => ({
23062308
reports: [{ name: 'pipeline', label: 'Pipeline', type: 'summary', dataset: 'sales', rows: ['stage'], values: ['revenue'], ...extra }],
23072309
});
23082310

2309-
it('warns on exportOptions only, at the report, with the row\'s author hint; dateRange is silent', () => {
2310-
const findings = lintLivenessProperties(report({ dateRange: { dimension: 'close_date' }, exportOptions: { formats: ['csv'] } }));
2311-
const planned = findings.filter((f) => f.rule === 'liveness-planned-property');
2312-
expect(planned.map((f) => f.message.match(/`(dateRange|exportOptions)`/)?.[1]).sort()).toEqual(['exportOptions']);
2313-
for (const f of planned) {
2314-
expect(f.where).toContain("report 'pipeline'");
2315-
expect(f.hint).toMatch(/^Keep it, but nothing reads it yet: the Console report page draws no /);
2311+
it('is silent on an authored `dateRange` and `exportOptions` — both rows are `live`, cite the renderer, and carry no author warning', () => {
2312+
const findings = lintLivenessProperties({ ...LIT, ...report({ dateRange: { dimension: 'close_date' }, exportOptions: { formats: ['csv'] } }) });
2313+
expect(ruleOf(findings, 'externalSharingModel')).toBe(LIVENESS_DEAD_PROPERTY);
2314+
expect(findings.filter((f) => /`(dateRange|exportOptions)`/.test(f.message))).toEqual([]);
2315+
const props = JSON.parse(readFileSync(join(shippedLedgerDir(), 'report.json'), 'utf8')).props;
2316+
// Anti-vacuity: each row is the shape this silence pin exists for.
2317+
for (const [key, evidence] of [
2318+
['dateRange', 'ui/packages/plugin-report/src/ReportDateRange.tsx#reportTimeWindow'],
2319+
['exportOptions', 'ui/packages/plugin-report/src/ReportExport.tsx#ReportExportControl'],
2320+
] as const) {
2321+
expect(props[key].status).toBe('live');
2322+
expect(props[key]).not.toHaveProperty('authorWarn');
2323+
expect(props[key]).not.toHaveProperty('authorHint');
2324+
expect(props[key].evidence).toContain(evidence);
23162325
}
2317-
expect(findings.filter((f) => /`dateRange`/.test(f.message))).toEqual([]);
23182326
});
23192327

23202328
it('CONTROL — a report declaring neither key draws no warning', () => {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#25467 cut 31] The by-name item read's disabled-package face, from
5+
* `ObjectStackProtocolImplementation`, moved out of `protocol.ts` whole:
6+
* `readMetaItemFace`, the one body behind `getMetaItem` and
7+
* `getMetaItemForExecution`. It refuses an object of a disabled package,
8+
* withholds any other item of one, and otherwise answers what `readMetaItem`
9+
* answers.
10+
*
11+
* A MOVE, not a redesign. The function below is the body of the
12+
* `ObjectStackProtocolImplementation` method of the same name as it stood,
13+
* re-indented one level and otherwise unedited.
14+
*
15+
* ## How the moved body reaches the class
16+
*
17+
* The shape #23050 set for `rest-server.ts` (its `data-action-routes.ts`
18+
* header carries the full reasoning), as `protocol-batch-data.ts` applies it.
19+
* The class keeps the method — the published `dist/*.d.ts` lists its name,
20+
* docblock and declared signature — and its body is one literal of exactly
21+
* the {@link MetaItemFaceHost} members it reads, plus a `.call`. The `engine`
22+
* field is handed over as a getter, so the read finds it as it stands at call
23+
* time; the call to `readMetaItem` is handed over as a closure, so it still
24+
* reaches the class method. Every caller keeps calling the class method.
25+
*
26+
* The disabled-package helpers it reads are `protocol.ts`'s own, and are
27+
* imported from there. Nothing re-exports this module, so the published
28+
* surface does not move.
29+
*/
30+
31+
import type { ObjectStackProtocolImplementation } from './protocol.js';
32+
import {
33+
isItemOfDisabledPackage,
34+
isObjectOfDisabledPackage,
35+
noPendingDraftError,
36+
objectPackageDisabledError,
37+
} from './protocol.js';
38+
39+
/**
40+
* The `ObjectStackProtocolImplementation` members the function below reads —
41+
* every one of them, and no other; the function's `this` is the `Pick` of
42+
* them. Each is typed AS the class member (an indexed access on the class),
43+
* so a change to a member's signature on the class is a change here too.
44+
*/
45+
export interface MetaItemFaceHost {
46+
readonly engine: ObjectStackProtocolImplementation['engine'];
47+
readonly readMetaItem: ObjectStackProtocolImplementation['readMetaItem'];
48+
}
49+
50+
/** The body of `ObjectStackProtocolImplementation#readMetaItemFace`; the method's docblock there is its contract. */
51+
export async function readMetaItemFace(
52+
this: Pick<MetaItemFaceHost, 'engine' | 'readMetaItem'>,
53+
request: {
54+
type: string, name: string, packageId?: string, state?: 'active' | 'draft', previewDrafts?: boolean,
55+
member?: string,
56+
},
57+
face: 'served' | 'execution',
58+
) {
59+
if (request.type === 'object' && isObjectOfDisabledPackage(this.engine?.registry, request.name)) {
60+
throw objectPackageDisabledError(request.name);
61+
}
62+
const answer = await this.readMetaItem(request, { face });
63+
if (request.type === 'object' || request.type === 'package'
64+
|| !isItemOfDisabledPackage(this.engine?.registry, answer?.item)) {
65+
return answer;
66+
}
67+
if (request.state === 'draft') throw noPendingDraftError(request.type, request.name);
68+
const { item: _withheld, registration: _servedOnly, ...envelope } = answer as typeof answer & { registration?: unknown };
69+
return { ...envelope, item: undefined };
70+
}

‎packages/metadata-protocol/src/protocol.ts‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ import { isDeclaredCodeDatasource, isHostCodeDatasource } from './protocol-code-
425425
import { legacyOrganizationRowsOf, withoutLegacyOrganizationRows } from './protocol-legacy-organization-rows.js';
426426
// [#25467 cut 30] The object-extender fold onto a MetadataService object body.
427427
import { foldObjectExtendersFromRegistry } from './protocol-object-extender-fold.js';
428+
// [#25467 cut 31] The disabled-package face of the by-name item read.
429+
import { readMetaItemFace } from './protocol-meta-item-face.js';
428430

429431
/**
430432
* Canonical Zod schema per metadata type lives in
@@ -677,7 +679,7 @@ export function isItemOfDisabledPackage(registry: any, item: unknown): boolean {
677679
* finds no draft row and the read of a disabled package's draft, so the two
678680
* answers are byte-identical.
679681
*/
680-
function noPendingDraftError(type: string, name: string): Error & { code: 'NO_DRAFT'; status: 404 } {
682+
export function noPendingDraftError(type: string, name: string): Error & { code: 'NO_DRAFT'; status: 404 } {
681683
const err = new Error(`No pending draft exists for ${type}/${name}.`) as Error & { code: 'NO_DRAFT'; status: 404 };
682684
err.code = 'NO_DRAFT';
683685
err.status = 404;
@@ -10703,17 +10705,13 @@ export class ObjectStackProtocolImplementation implements
1070310705
type: string, name: string, packageId?: string, state?: 'active' | 'draft', previewDrafts?: boolean,
1070410706
member?: string,
1070510707
}, face: 'served' | 'execution') {
10706-
if (request.type === 'object' && isObjectOfDisabledPackage(this.engine?.registry, request.name)) {
10707-
throw objectPackageDisabledError(request.name);
10708-
}
10709-
const answer = await this.readMetaItem(request, { face });
10710-
if (request.type === 'object' || request.type === 'package'
10711-
|| !isItemOfDisabledPackage(this.engine?.registry, answer?.item)) {
10712-
return answer;
10713-
}
10714-
if (request.state === 'draft') throw noPendingDraftError(request.type, request.name);
10715-
const { item: _withheld, registration: _servedOnly, ...envelope } = answer as typeof answer & { registration?: unknown };
10716-
return { ...envelope, item: undefined };
10708+
// [#25467 cut 31] The body moved to `protocol-meta-item-face.ts` (see `MetaItemFaceHost`).
10709+
const readEngine = () => this.engine;
10710+
const host: ThisParameterType<typeof readMetaItemFace> = {
10711+
get engine() { return readEngine(); },
10712+
readMetaItem: (...a) => this.readMetaItem(...a),
10713+
};
10714+
return readMetaItemFace.call(host, request, face);
1071710715
}
1071810716

1071910717
/**

0 commit comments

Comments
 (0)