Skip to content

Commit 0c86f9c

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-35735-filter-flag-and-comparand-edges
2 parents 8471b60 + 65fddc8 commit 0c86f9c

72 files changed

Lines changed: 2853 additions & 77 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/service-storage': patch
3+
---
4+
5+
fix(service-storage): translate the built-in `storage_attachment_member` permission set
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The permission set this service contributes to every member's baseline ("Attachments: read and attach (every member)") now ships its label and description in every locale the platform's other built-in sets ship (zh-CN, ja-JP, es-ES, zh-Hant, ar, fr, pt-BR, ru, de, ko). Setup's permission-set lists in a translated Console no longer show it as the one English row. What the set grants, and when it is contributed, is unchanged.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/platform-objects': minor
3+
'@objectstack/spec': patch
4+
'@objectstack/cli': patch
5+
'@objectstack/objectql': patch
6+
'@object-ui/plugin-form': patch
7+
---
8+
9+
feat: working calendars in Setup — `sys_work_calendar` and `sys_work_calendar_exception` (ADR-0157, part two of two)
10+
11+
Clause-②: yes (widening)
12+
Metadata-protocol: added
13+
14+
Not released alone; pair #35641/#35642. The first half, #35641 (the calendar service and its arithmetic), is merged; this half ships in the same release as it, with the working-day formula functions (#35356) and the approval escalation's working-time clock (#35357), ADR-0157 D4.
15+
16+
- **Two platform objects** (`@objectstack/platform-objects`). `sys_work_calendar` holds a calendar's `code` (unique per organization, snake_case), `name`, required IANA `timezone`, `is_default` (one per organization), the required `maintained_from` .. `maintained_through` span its holidays are entered for, and one period column per weekday (`monday_periods` … `sunday_periods`, `HH:mm-HH:mm` periods separated by commas, blank for a day off). `sys_work_calendar_exception` holds dated overrides: `calendar`, `date`, `kind` (`off`, no periods; `on`, that date's full periods), `periods` and `note`, one row per calendar and date. Both are organization data an administrator keeps, audited, like `sys_exchange_rate`; a package may seed rows under the existing seed contract and name a calendar by code. Their names join the platform object name list (`@objectstack/spec`).
17+
- **Setup.** Two entries under Exchange Rates: Working Calendars (with a Needs Maintenance list of every calendar whose maintained span ends within 60 days) and Calendar Exceptions, whose list page imports a year of holidays from a file; the `calendar` column names a calendar by its code or name. Labels and help text ship in all eleven locales.
18+
- **Time zone on create** (`@object-ui/plugin-form`, ADR-0157 D7). A create form opens a required time-zone field that declares no default (`valueDomain: 'iana_time_zone'`) on the organization's time zone, as it opens a record-currency field on the organization's currency; the user can change it. A create that leaves the calendar's `timezone` out takes the same zone on the server. An optional time-zone field, where blank means "take the parent's", is not prefilled.
19+
- **Refusal wording** (`@objectstack/objectql`). The refusal of a create that marks a calendar the default in another organization no longer assumes the writer is working in an organization.
20+
- **A calendar stays in its organization** (`@objectstack/objectql`). An update that changes the organization of a calendar or of an exception date is refused with `400 VALIDATION_FAILED` on `organization_id` (`invalid_value`), before any read and for every writer, system writes included. To have a calendar in another organization, create it there. An edit that leaves `organization_id` out or repeats the stored one is judged as before; a predicate update is judged row by row, and one matched row whose organization would change refuses it.
21+
- **An exception date names a calendar of its own organization** (`@objectstack/objectql`). On a create, and on an update that carries `calendar`, the calendar is read by id in the exception's organization; when it is not there, the write is refused with `400 VALIDATION_FAILED` on `calendar` (`invalid_value`). A calendar of another organization and an id that names no calendar get the same refusal, word for word. The import door is judged the same way, row by row.
22+
- **Organization ownership** (`@objectstack/cli`). Both objects are organization-owned; an exception reaches its organization through its calendar.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/lint': patch
3+
'@object-ui/plugin-grid': patch
4+
'@object-ui/plugin-detail': patch
5+
---
6+
7+
fix: a `percent` or `currency` formula is a KPI chip on the record header; the lint prescription names all six return types
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
A `formula` field whose `returnType` is `percent` drew percentages in its list cells, and the record header strip drew it without the figure typography a `percent` field's chip has. The strip now reads a formula's declared `returnType` before it picks its face, for the two return types the spec reads as a field type, `percent` and `currency`. Both are KPI chips on the header strip. A formula of any other return type chips as before.
13+
14+
The grid's footer formatting reads the same two return types, so a browser-computed footer over a `percent` formula reads `Sum: 75%` rather than `Sum: 0.75`, and over a `currency` formula reads as money. That is not a supported authoring shape: a `sum`, `avg`, `min` or `max` column summary over a `formula` field is refused at authoring by `list-view-summary-field-type-refused`, whatever its `returnType`, because a formula is computed on read and stored in no column, and the whole-set footer query answers `400 INVALID_FIELD`. The formatting reaches only an ungrouped, one-page footer the browser computes over a declaration `os validate` refuses. To total a formula's value, make it a stored field of its own, of the formula's `returnType` and carrying the same `expression`, which the engine computes and stores on every write, and summarise that field.
15+
16+
`os explain dimension-virtual-field-refused` told the author to make a stored copy "of the formula's `returnType` (`number`, `text`, `boolean`, `date` or `currency`)", which named no type for a `percent` formula. It now lists all six, and a test holds the list to the spec's own `returnType` enum.

‎content/docs/ui/apps.mdx‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ The Setup app's anchors:
888888
| `group_people_org` | Users, organizations, business units, teams, invitations |
889889
| `group_access_control` | Positions, permission sets, sharing rules, API keys |
890890
| `group_approvals` | Approvals inbox, requests, history, delegations |
891-
| `group_configuration` | Settings, localization, exchange rates, authentication, email, storage, AI, branding |
891+
| `group_configuration` | Settings, localization, exchange rates, working calendars, authentication, email, storage, AI, branding |
892892
| `group_diagnostics` | Sessions, notification events, audit log |
893893
| `group_integrations` | Webhooks, cloud connection |
894894
| `group_advanced` | OAuth applications |
@@ -899,6 +899,17 @@ of the row's currency, from its effective date until a later row for that curren
899899
add one row per currency with the first day of the month as the effective date; a correction is an edit to that
900900
row, and every change lands in the audit log.
901901

902+
**Working Calendars** (`sys_work_calendar`, after Exchange Rates) holds an organization's working calendars
903+
(ADR-0157): each one's working periods per weekday, in the calendar's time zone; the span its holidays are
904+
entered for (Maintained From to Maintained Through); and whether it is the default, which a calculation that
905+
names no calendar uses. The create form opens with the organization's time zone (Localization → Default
906+
timezone) in the Time Zone field. The **Needs Maintenance** list shows every calendar whose span ends within 60
907+
days, so next year's holidays are entered before they are needed. **Calendar Exceptions**
908+
(`sys_work_calendar_exception`) holds a calendar's dated overrides, one row per calendar and date: a Day Off, or
909+
a Working Day carrying that date's full periods, such as a make-up workday. Its list page imports a year of
910+
holidays from a file whose `calendar` column names the calendar by its code or name. Both pages need a grant on
911+
their object, and every change lands in the audit log.
912+
902913
Setup is for platform administration and needs `setup.access`. For
903914
project-specific administration pages, declare an app of your own.
904915

‎examples/app-showcase/e2e/bulk-capability-gate.spec.ts‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,23 @@ test('selection bar hides capability-gated inline defs from a caller without the
4444
await selectAll.waitFor({ state: 'visible', timeout: 25_000 });
4545
await selectAll.click();
4646

47-
// The bar offers the ungated defs…
47+
// The bar offers the ungated defs: it draws the first two as buttons and
48+
// the rest behind its "⋮" (`SELECTION_EXPOSED_ACTIONS`, ui plugin-grid
49+
// `SelectionPageBar.tsx`, citing #35554 「露出一到两个,其余进⋮」), where a
50+
// def is a `row-context-bulk-NAME` menu item instead of a
51+
// `bulk-action-NAME` button. All four ungated defs are read, so none of
52+
// them can drop out of the bar unnoticed.
4853
await expect(page.getByTestId('bulk-action-set_labels')).toBeVisible({ timeout: 15_000 });
4954
await expect(page.getByTestId('bulk-action-assign_team')).toBeVisible();
50-
await expect(page.getByTestId('bulk-action-reassign_account')).toBeVisible();
51-
await expect(page.getByTestId('bulk-action-reschedule')).toBeVisible();
55+
await page.getByTestId('selection-actions-more').click();
56+
await expect(page.getByTestId('row-context-bulk-reassign_account')).toBeVisible();
57+
await expect(page.getByTestId('row-context-bulk-reschedule')).toBeVisible();
5258

53-
// …and neither gated def — the ungated assertions above are what make these
54-
// two absences evidence of the GATE, not of a bar that failed to render.
55-
await expect(page.getByTestId('bulk-action-relabel_ops')).toHaveCount(0);
56-
await expect(page.getByTestId('bulk-action-purge_restricted')).toHaveCount(0);
59+
// …and neither gated def, as a button or as an item of the open "⋮" — the
60+
// ungated assertions above are what make these absences evidence of the
61+
// GATE, not of a bar or a menu that failed to render.
62+
for (const gated of ['relabel_ops', 'purge_restricted']) {
63+
await expect(page.getByTestId(`bulk-action-${gated}`)).toHaveCount(0);
64+
await expect(page.getByTestId(`row-context-bulk-${gated}`)).toHaveCount(0);
65+
}
5766
});

‎packages/cli/src/utils/organization-ownership-inventory.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,11 @@ export const ORGANIZATION_OWNERSHIP_INVENTORY: readonly InventoryEntry[] = [
855855
// organization's administrators author its own units; the platform ships no
856856
// row, and no parent row anchors a unit.
857857
{ object: 'sys_unit', census: PMAIN, fate: 'attribution', citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`, anchors: [] },
858+
// Working calendars (`@objectstack/platform-objects`, ADR-0157 D1): an
859+
// organization's administrators author its calendars, and an exception's
860+
// calendar carries the organization.
861+
{ object: 'sys_work_calendar', census: PMAIN, fate: 'attribution', citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`, anchors: [] },
862+
{ object: 'sys_work_calendar_exception', census: PMAIN, fate: 'attribution', citation: `${CENSUS_MAIN} (in reach, added since the first census); the exception's calendar carries the organization`, anchors: [parent('calendar', 'sys_work_calendar')] },
858863
// The recycle bin (`@objectstack/platform-objects`, ADR-0148, #30237): the
859864
// engine writes each entry with the organization of the record it holds,
860865
// else the deleting context's. A NULL row comes only from a delete with

‎packages/cli/test/connect-agent-both-halves-wire.pin.test.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
264264
// The Setup tree the platform admin is served BY THIS COMPOSITION: 9
265265
// authored groups less `group_approvals`, `group_integrations` and
266266
// `group_apps`, which nothing in it contributes into and the filter
267-
// collapses, plus the 24 entries `SETUP_NAV_CONTRIBUTIONS` carries,
267+
// collapses, plus the 27 entries `SETUP_NAV_CONTRIBUTIONS` carries,
268268
// plus the MCP one.
269269
// (25 until #25098 moved the unfiltered Packages entry to Studio; 24
270270
// until #30204 removed the Feature Flags entry with its namespace; 32
@@ -276,13 +276,16 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
276276
// the Packaged Actions entry, `nav_packaged_actions`, the one entry
277277
// `group_apps` held here, so that group collapses too; 31 until the
278278
// Units of Measure entry, `nav_units_of_measure`, joined Configuration
279-
// (#35488).)
279+
// (#35488); 32 until the working-calendar pair, `nav_work_calendars`
280+
// and `nav_work_calendar_exceptions`, joined it, ADR-0157.)
280281
// `nav_settings_branding` is not among them, and not because of a
281282
// tenancy wall (this harness boots none): since #24766 it is
282283
// contributed by `@objectstack/service-settings` together with the
283284
// `branding` namespace, offered only where no organization wall stands,
284285
// and this harness composes platform-objects and the MCP bundle alone.
285-
expect(allowedIds).toHaveLength(32);
286+
expect(allowedIds).toHaveLength(34);
287+
expect(allowedIds).toContain('nav_work_calendars');
288+
expect(allowedIds).toContain('nav_work_calendar_exceptions');
286289
expect(allowedIds).not.toContain('nav_packaged_actions');
287290
expect(allowedIds).toContain('nav_settings_access_policy');
288291
expect(allowedIds).toContain('nav_recycle_bin');
@@ -309,8 +312,8 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
309312
expect(withAccountHalf.statusCode).toBe(200);
310313
expect(withoutAccountHalf.statusCode).toBe(200);
311314
expect(navIds(withAccountHalf.body?.item)).toEqual(navIds(withoutAccountHalf.body?.item));
312-
// 32: the composition the count in the test above states.
313-
expect(navIds(withAccountHalf.body?.item)).toHaveLength(32);
315+
// 34: the composition the count in the test above states.
316+
expect(navIds(withAccountHalf.body?.item)).toHaveLength(34);
314317

315318
// The mechanism behind the invariance, asserted rather than assumed:
316319
// the bundle aims exactly one contribution at `setup` and one at

‎packages/cli/test/run-dev-unbuilt-workspace.e2e.test.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,11 @@ describe('run-dev.js on a workspace package with no build output', () => {
315315
// The upstream line is deliberately NOT suppressed: nothing here changes
316316
// which arguments the CLI accepts or how oclif reports, only what is said
317317
// alongside. Asserting it also proves case 1 really reached that failure
318-
// rather than dying earlier for some unrelated reason.
319-
expect(unbuilt.stderr).toContain('Error: command i18n:extract:nope.ts not found');
318+
// rather than dying earlier for some unrelated reason. The id is spelled
319+
// as typed, with the CLI's space topic separator: the `command_not_found`
320+
// hook (`src/hooks/command-not-found/point-at-help.ts`) words the refusal
321+
// that oclif still raises and prints.
322+
expect(unbuilt.stderr).toContain('Error: command i18n extract nope.ts not found');
320323
expect(unbuilt.code).toBe(2);
321324
});
322325

@@ -376,8 +379,10 @@ describe('the same probe, read by a parent that stalls (the merge-queue shape)',
376379
// so it survives only because awaiting our own write had already emptied
377380
// the buffer ahead of it. This assertion reds in the queue beside the lead
378381
// line — and a formatter that had merely failed to LOAD could not have
379-
// removed it, which is what rules that reading out.
380-
expect(stalled.stderr).toContain('Error: command i18n:extract:nope.ts not found');
382+
// removed it, which is what rules that reading out. (The words are the
383+
// `command_not_found` hook's, the id spelled as typed; the write and the
384+
// exit on top of ours are still oclif's `handle()`.)
385+
expect(stalled.stderr).toContain('Error: command i18n extract nope.ts not found');
381386
expect(stalled.code).toBe(2);
382387
});
383388
});

‎packages/lint/src/rule-explanations.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ import {
1616
FUNCTIONAL_COMPLETENESS_RULES,
1717
MAX_CUSTOMIZATION_BASE_NAMESPACE_LENGTH,
1818
} from '@objectstack/spec/kernel';
19+
import { FieldSchema } from '@objectstack/spec/data';
1920

2021
import * as indexBarrel from './index.js';
2122
import { RULE_EXPLANATIONS, explainRule } from './rule-explanations.js';
2223
import { CARRIER_ROOTS, CONSUMER_ROOTS, FIELD_NO_CONSUMERS } from './validate-field-consumers.js';
2324
import { NAMESPACE_NO_CUSTOMIZATION_PAIR } from './validate-customization-namespace.js';
25+
import { DIMENSION_VIRTUAL_FIELD_REFUSED } from './validate-dataset-measure-aggregates.js';
2426

2527
const HERE = dirname(fileURLToPath(import.meta.url));
2628

@@ -112,6 +114,18 @@ describe('rule explanations (#22161)', () => {
112114
expect(text).toContain(`to ${max} characters or fewer`);
113115
});
114116

117+
// The module imports nothing, so the formula return types the stored copy
118+
// may take are written out in the text; held here to the spec's own enum,
119+
// so a return type the spec adds cannot be missing from the prescription.
120+
it('the dimension-virtual-field-refused prescription names every formula return type', () => {
121+
const text = explainRule(DIMENSION_VIRTUAL_FIELD_REFUSED)!.paragraphs.join('\n');
122+
const listed = /of the formula's `returnType` \(([^)]*)\)/.exec(text)?.[1];
123+
expect(listed).toBeDefined();
124+
const named = [...listed!.matchAll(/`([a-z_]+)`/g)].map((m) => m[1]).sort();
125+
const members = (FieldSchema.shape.returnType.unwrap().options as readonly string[]).slice().sort();
126+
expect(named).toEqual(members);
127+
});
128+
115129
it('explainRule is an exact-id lookup: no prefix, case or prototype match', () => {
116130
expect(explainRule(FIELD_NO_CONSUMERS)?.rule).toBe(FIELD_NO_CONSUMERS);
117131
expect(explainRule('field-no-consumer')).toBeUndefined();

‎packages/lint/src/rule-explanations.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,8 +2734,9 @@ const DIMENSION_VIRTUAL_FIELD_REFUSED_EXPLANATION: RuleExplanation = {
27342734
'Before those refusals the group key reached the driver as a column that does not exist, or an ' +
27352735
'engine that aggregates in memory put every row into one null group while the answer looked served.',
27362736
'Denormalise the value: make it a stored field of its own on the object, of the formula\'s ' +
2737-
'`returnType` (`number`, `text`, `boolean`, `date` or `currency`) and carrying the same `expression`, ' +
2738-
'which the engine computes and stores on every write, and point the dimension at that stored field. ' +
2737+
'`returnType` (`number`, `text`, `boolean`, `date`, `currency` or `percent`) and carrying the same ' +
2738+
'`expression`, which the engine computes and stores on every write, and point the dimension at that ' +
2739+
'stored field. ' +
27392740
'This rule makes the same ' +
27402741
'refusal where the author is standing. A dotted path is judged on the leaf\'s own declaration.',
27412742
ANALYTICS_MEMBER_WALK,

0 commit comments

Comments
 (0)