Skip to content

Commit 464c5e5

Browse files
committed
feat(lint,spec)!: refuse a holeless ${record.*} / ${result.*} action copy sentence
The console's runner no longer fills ${…} in an action's copy (objectui#13476, in the ui/ tree), so the one shape the doors kept a warning is now an error. Retire ACTION_COPY_DOLLAR_TRANSITION_ROOTS, dollarOnlyTokenRoots and the isTransitionalDollar warning branch; flip the pins that held the warning. Claude-Session: https://claude.ai/code/session_0148U1UfHrMrKAyJbiSs1ZYr Co-authored-by: Claude <noreply@anthropic.com>
1 parent 38050ce commit 464c5e5

13 files changed

Lines changed: 97 additions & 156 deletions

‎.changeset/25680-action-copy-refusal.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Clause-②: no (narrowing: an action's copy sentence that is blank, holes an unb
99
Metadata-protocol: narrowed
1010
Ruling-ref: `6365736632` (on #24814, the refusal half); triage `6386348015`
1111

12-
An action's person-facing copy is an ADR-0032 `template` slot over the roots the console's runner binds (#24814): `confirmText` over `record` (and `params` beside static values), `successMessage` over `result` and `record`, `errorMessage` over none. That covers a page action row (`action:button`, `action:icon`, an `action:group` / `action:menu` member), a page component's inline `properties.action`, and a registered action (`stack.actions[]`, an object's `actions[]`). `validateStackExpressions`, the rule all three doors run, judges each sentence through `closedScopeTemplateRefusal`, then compiles it as a template. Its findings were warnings. They are now errors, all but one. This supersedes the warning-only behaviour #24814 described earlier in this release line; a refused finding no longer ends with "A warning, not a refusal".
12+
An action's person-facing copy is an ADR-0032 `template` slot over the roots the console's runner binds (#24814): `confirmText` over `record` (and `params` beside static values), `successMessage` over `result` and `record`, `errorMessage` over none. That covers a page action row (`action:button`, `action:icon`, an `action:group` / `action:menu` member), a page component's inline `properties.action`, and a registered action (`stack.actions[]`, an object's `actions[]`). `validateStackExpressions`, the rule all three doors run, judges each sentence through `closedScopeTemplateRefusal`, then compiles it as a template. Its findings were warnings. They are now errors. This supersedes the warning-only behaviour #24814 described earlier in this release line; a refused finding no longer ends with "A warning, not a refusal".
1313

1414
**BREAKING — what moves for consumers.**
1515

@@ -18,15 +18,15 @@ An action's person-facing copy is an ADR-0032 `template` slot over the roots the
1818

1919
**Fix (one line).** Write the hole the finding prescribes (`Delete ${record.name}?` → `Delete {{ record.name }}?`), name a root the key binds, double a single-brace token, move logic out of the hole, or remove a blank key so the runner's default shows.
2020

21-
**Still a warning.** A `${…}` token the console's runner still fills in its transitional reading: in a sentence with no `{{ }}` hole and no other token, `${record.*}` in a `confirmText` and `${result.*}` in a `successMessage` (`ACTION_COPY_DOLLAR_TRANSITION_ROOTS`, measured at objectui `ActionRunner` at the pinned `.objectui-sha`, which fills them there). It is named with its `{{ }}` spelling and ends "A warning, not a refusal, for now". Refusing it waits for the runner to retire that reading.
21+
**The holeless `${…}` sentence too.** `${record.*}` in a `confirmText` and `${result.*}` in a `successMessage`, in a sentence with no `{{ }}` hole and no other token, is refused as well: the console's runner shows it as written. Its own entry in this release says so (#25709).
2222

2323
**Unchanged.**
2424

2525
- The parse. Each copy key accepts what it accepted, a blank string included (the slot's blank-string arm stays). The boot load and the read path judge a stored row with this parse, so a stored page or action carrying a refused sentence keeps loading and serving until it is next saved, and that save is judged. Saving as a draft is still allowed; publishing the draft is judged.
2626
- `ActionSchema.errorMessage` and `outcomeMessages` are not in this family and draw nothing.
2727
- A sentence with no finding draws nothing at any door, in any form (the bare string, the `{ dialect: 'template', source }` envelope, an inline locale map).
2828
- `OS_ALLOW_UNLINTED_METADATA_WRITES=1` still turns a refusal into a logged write.
29-
- No schema shape moves. `@objectstack/spec` adds two exports: `ACTION_COPY_DOLLAR_TRANSITION_ROOTS` (`@objectstack/spec/ui`) and `dollarOnlyTokenRoots` (`@objectstack/spec/automation`). The three copy describes now say the texts are refused.
29+
- No schema shape moves, and `@objectstack/spec` adds no export. The three copy describes now say the texts are refused.
3030
- Measured before crossing, through the built `@objectstack/lint` at `6021b5e837`: 0 in-repo producers carry such a sentence. `examples/app-crm`, `app-showcase` (23 registered `successMessage`s, 29 pages), `app-todo` (2 `confirmText`, 16 `successMessage`) and `app-multi-package`, `@objectstack/platform-objects` (12 `confirmText`, 48 `successMessage`) and `@objectstack/plugin-approvals` (9 `successMessage`) draw 0 findings, against 1 for a planted unbound hole. HotCRM at `a4b3560` declares 1 action `confirmText` and 19 action `successMessage`s; judged through the same built pass, all 20 draw 0 findings, against an error for a planted `{count}`.
3131

3232
<!-- adr-0087: not-required (no-migration-prescription) a refusal at `objectstack validate`, `compile` and the publish gate of an action copy sentence (`confirmText`, `successMessage`, a page row's `errorMessage`) that is blank, names an unbound root, carries a single-brace or raw-shown `${…}` token, or holds logic in a hole: no authorable key, spelling or stored shape moves, the parse is unchanged, and no stored row is read, rewritten or converted. A stored row whose sentence is refused keeps loading until it is next saved, and the repair is the author's rewrite of the sentence (which root a hole should name is the author's intent), which no ledger entry can derive. The other categories are closed on facts: the packages publish (not unpublished); no ADR-0087 id covers this verdict (not already-registered); and the change is a build and door verdict, not a declaration (not runtime-interface-only or type-surface-only). -->
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/lint': minor
3+
'@objectstack/spec': minor
4+
---
5+
6+
feat(lint)!: `objectstack validate`, `compile` and the publish gate refuse a holeless `${record.*}` `confirmText` and a holeless `${result.*}` `successMessage` on an action, the one action-copy finding that was still a warning (#25709)
7+
8+
Clause-②: no (narrowing: an action's `confirmText` / `successMessage` sentence with no `{{ }}` hole whose tokens are `${record.*}` / `${result.*}` is refused at `objectstack validate`, `compile` and the publish gate instead of saving with a warning)
9+
Metadata-protocol: narrowed
10+
11+
The console's action runner no longer fills `${…}` in an action's copy: a sentence with no `{{ }}` hole is shown as written, `${…}` included (objectui#13476, in the `ui/` tree). The doors kept one `${…}` shape a warning while the runner still filled it: `Delete ${record.name}?` in a `confirmText`, `Invitation sent to ${result.email}` in a `successMessage`. The person reading the dialog or toast now sees that token raw, so the doors refuse it like every other `${…}` token.
12+
13+
**BREAKING — what moves for consumers.**
14+
15+
- FROM: a warning at `objectstack validate` and `compile`, and an entry on the publish gate's `advisories` channel while the action, object or page saved. TO: an error. Both commands fail, and an active `action`, `object` or `page` write answers `422 INVALID_METADATA` with an `expression-invalid` issue located at the key. The item is not stored. The finding no longer ends with "A warning, not a refusal, for now".
16+
- `ACTION_COPY_DOLLAR_TRANSITION_ROOTS` (`@objectstack/spec/ui`) and `dollarOnlyTokenRoots` (`@objectstack/spec/automation`), which reached `main` after `@objectstack/spec@18.1.0` and were never published, are withdrawn before this release. The `confirmText` and `successMessage` describes no longer say the shape is a warning.
17+
18+
**Fix (one line).** Write the hole the finding prescribes: `Delete ${record.name}?` → `Delete {{ record.name }}?`, `Invitation sent to ${result.email}` → `Invitation sent to {{ result.email }}`.
19+
20+
**Unchanged.** The parse: each copy key accepts what it accepted, so a stored row with such a sentence keeps loading until its next save, and that save is judged. Saving as a draft is still allowed. `outcomeMessages` and `ActionSchema.errorMessage` are not in this family. `OS_ALLOW_UNLINTED_METADATA_WRITES=1` still turns a refusal into a logged write.
21+
22+
**Measured before crossing**, by walking every action-copy sentence reachable from each module's exports on this branch's base `38050ced` and through the built `@objectstack/lint`: `examples/app-crm` (2 `successMessage`, 2 `errorMessage`), `app-todo` (1 `confirmText`, 8 `successMessage`), `app-showcase` (6 `confirmText`, 24 `successMessage`), `app-multi-package` (none), `@objectstack/platform-objects` and `@objectstack/plugin-approvals` carry 0 sentences with a `${…}` token and 0 of the holeless shape, and the four example stacks draw 0 copy findings. A planted `Delete ${record.name}?` `confirmText` on each example stack draws the finding.
23+
24+
<!-- adr-0087: not-required (no-migration-prescription) a refusal at `objectstack validate`, `compile` and the publish gate of an action copy sentence with no `{{ }}` hole whose tokens are `${record.*}` (in a `confirmText`) or `${result.*}` (in a `successMessage`), which saved with a warning: no authorable key, spelling or stored shape moves, the parse is unchanged, and no stored row is read, rewritten or converted. A stored row whose sentence is refused keeps loading until it is next saved, and the repair is the author's rewrite of the sentence (which root a hole should name is the author's intent), which no ledger entry can derive. The two dropped exports never shipped in a published version. The other categories are closed on facts: the packages publish (not unpublished); no ADR-0087 id covers this verdict (not already-registered); and the change is a build and door verdict, not a declaration (not runtime-interface-only or type-surface-only). -->

‎packages/lint/src/authoring-rules.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,12 @@ export const AUTHORING_RULES: readonly AuthoringRule[] = [
761761
// written action's own `confirmText` / `successMessage` in the same pass.
762762
// #25680 makes each finding an `error`, so an action, object or page write
763763
// carrying one is refused (a narrowing no conversion carries, shipped in
764-
// 18.x as its own BREAKING minor, as #25205 did for the bulk slot). One
765-
// stays a `warning`: a `${…}` token the console's runner still fills, in a
766-
// sentence with no `{{ }}` hole. MEASURED first over the shipped corpus at
767-
// `6021b5e837`: 0 findings across examples/**, platform-objects and
768-
// plugin-approvals, against one for a planted unbound hole.
764+
// 18.x as its own BREAKING minor, as #25205 did for the bulk slot); since
765+
// #25709 that includes a `${…}` token in a sentence with no `{{ }}` hole,
766+
// which the console's runner now shows as written. MEASURED first over the
767+
// shipped corpus at `6021b5e837`: 0 findings across examples/**,
768+
// platform-objects and plugin-approvals, against one for a planted unbound
769+
// hole; #25709 re-measured 0 sentences of the holeless `${…}` shape there.
769770
surfaces: CLI_AND_RUNTIME,
770771
runtimeTypes: ['flow', 'action', 'hook', 'object', 'view', 'page'],
771772
run: (stack, ctx) =>

‎packages/lint/src/validate-action-copy-templates.test.ts‎

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
// rule `objectstack validate`, `objectstack compile` and the runtime publish
88
// gate all run — judges every sentence through the template judge's
99
// closed-scope entry, then compiles it as a template. Every finding is an
10-
// ERROR (#25680), so the publish gate refuses the write; one stays a WARNING,
11-
// a `${…}` token the console's runner still fills in a sentence with no
12-
// `{{ }}` hole (`ACTION_COPY_DOLLAR_TRANSITION_ROOTS`). So a pin here asserts
13-
// the severity per finding and, at the publish gate, which channel it rides.
10+
// ERROR (#25680), so the publish gate refuses the write — a `${…}` token in a
11+
// sentence with no `{{ }}` hole included (#25709): the console's runner shows
12+
// it as written, so no finding rides the advisory channel any more. So a pin
13+
// here asserts the severity per finding and, at the publish gate, that the
14+
// finding rides the error channel and never the advisory one.
1415
//
1516
// The gate half drives the REAL dispatch (`runRuntimeAuthoringRules`) with a
1617
// page write and an action write, because a `runtimeTypes` widening whose
@@ -56,18 +57,20 @@ describe('validateStackExpressions — a registered action\'s copy is judged as
5657
}
5758
});
5859

59-
it('names a `${…}` token the runner still fills with a WARNING prescribing its `{{ }}` hole, never `${{ … }}`', () => {
60+
it('refuses a holeless `${…}` sentence — the runner shows it as written — prescribing its `{{ }}` hole, never `${{ … }}`', () => {
6061
const [issue, ...rest] = copyIssues({ objects, actions: [invite({ successMessage: 'Invitation sent to ${result.email}' })] });
6162
expect(rest).toEqual([]);
62-
expect(issue!.severity).toBe('warning');
63+
expect(issue!.severity).toBe('error');
6364
expect(issue!.where).toBe("stack · action 'invite' successMessage");
6465
expect(issue!.message).toContain('Write `Invitation sent to ${result.email}` as `Invitation sent to {{ result.email }}`.');
6566
expect(issue!.message).not.toContain('${{');
66-
const [confirm] = copyIssues({ objects, actions: [invite({ confirmText: 'Invite ${record.name}?' })] });
67-
expect(confirm!.severity).toBe('warning');
67+
expect(issue!.message).not.toMatch(/A warning, not a refusal/);
68+
const confirms = copyIssues({ objects, actions: [invite({ confirmText: 'Invite ${record.name}?' })] });
69+
expect(confirms.map((i) => [i.where, i.severity])).toEqual([["stack · action 'invite' confirmText", 'error']]);
70+
expect(confirms[0]!.message).toContain('as `Invite {{ record.name }}?`');
6871
});
6972

70-
it('refuses a `${…}` token the runner shows raw — off its transitional roots, beside a `{{ }}` hole, or beside a `{x}`', () => {
73+
it('refuses a `${…}` token in every other shape too — off the record/result roots, beside a `{{ }}` hole, or beside a `{x}`', () => {
7174
for (const patch of [
7275
// `composeSuccessMessage` substitutes `${result.*}` alone.
7376
{ successMessage: 'Sent for ${record.name}' },
@@ -167,7 +170,7 @@ describe('validateStackExpressions — a page action row\'s copy (#24814)', () =
167170
]);
168171
expect(issues[0]!.message).toContain('as `Run {{ record.name }}?`');
169172
expect(issues[2]!.message).toMatch(/^An action's `confirmText` is blank/);
170-
expect(issues.map((i) => i.severity)).toEqual(['warning', 'error', 'error', 'warning']);
173+
expect(issues.map((i) => i.severity)).toEqual(['error', 'error', 'error', 'error']);
171174
});
172175

173176
it('on a page write runs that pass alone', () => {
@@ -182,7 +185,7 @@ describe('validateStackExpressions — a page action row\'s copy (#24814)', () =
182185
});
183186
});
184187

185-
describe('the runtime publish gate — a refusal, but for the runner\'s transitional `${…}` (#24814, #25680)', () => {
188+
describe('the runtime publish gate — every finding a refusal, a holeless `${…}` included (#24814, #25680, #25709)', () => {
186189
const findings = (type: string, item: unknown) => {
187190
const { errors, advisories } = runRuntimeAuthoringRules({ type, item, context: { objects } });
188191
const copy = (f: { where: string }) => /confirmText|successMessage|errorMessage/.test(f.where);
@@ -206,17 +209,20 @@ describe('the runtime publish gate — a refusal, but for the runner\'s transiti
206209
expect(findings('object', { ...objects[0], actions: [action] }).errors).toHaveLength(1);
207210
});
208211

209-
it('a page write carrying a transitional `${…}` confirmText answers one advisory and no error', () => {
212+
it('a page write carrying a holeless `${record.*}` confirmText answers one error and no advisory', () => {
210213
const { errors, advisories } = findings('page', row({ confirmText: 'Delete ${record.name}?' }));
211-
expect(errors).toEqual([]);
212-
expect(advisories).toHaveLength(1);
213-
expect(advisories[0]!.message).toContain('as `Delete {{ record.name }}?`');
214+
expect(errors).toHaveLength(1);
215+
expect(errors[0]!.where).toContain('confirmText');
216+
expect(errors[0]!.message).toContain('as `Delete {{ record.name }}?`');
217+
expect(advisories).toEqual([]);
214218
});
215219

216-
it('an action write carrying a `${result.*}` successMessage answers one advisory and no error', () => {
220+
it('an action write carrying a holeless `${result.*}` successMessage answers one error and no advisory', () => {
217221
const { errors, advisories } = findings('action', invite({ successMessage: 'Invitation sent to ${result.email}' }));
218-
expect(errors).toEqual([]);
219-
expect(advisories).toHaveLength(1);
222+
expect(errors).toHaveLength(1);
223+
expect(errors[0]!.where).toContain('successMessage');
224+
expect(errors[0]!.message).toContain('as `Invitation sent to {{ result.email }}`');
225+
expect(advisories).toEqual([]);
220226
});
221227

222228
it('control: the converted platform sentence draws nothing', () => {

‎packages/lint/src/validate-action-copy-templates.ts‎

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@
3131
* fail, and the publish gate answers its 422. Each of these texts parsed while
3232
* the keys were plain strings, and it still parses (the slot keeps its blank
3333
* arm), so a stored row keeps loading until its next save; the save is judged.
34-
* One finding stays a WARNING: a `${…}` token the console's runner still fills
35-
* in its transitional reading — a sentence with no `{{ }}` hole whose every
36-
* token is `${…}` over a root `ACTION_COPY_DOLLAR_TRANSITION_ROOTS` names for
37-
* the key (`dollarOnlyTokenRoots`). Refusing it waits for the runner to retire
38-
* that reading; any other `${…}` token is shown raw, so it is an error.
34+
* A `${…}` token is one of them in every sentence (#25709): the console's
35+
* runner shows it as written, a sentence with no `{{ }}` hole included, so
36+
* there is no transitional reading left to warn about.
3937
*/
4038

4139
import { validateExpression } from '@objectstack/formula';
42-
import { closedScopeTemplateRefusal, dollarOnlyTokenRoots, templateSlotSource } from '@objectstack/spec/automation';
40+
import { closedScopeTemplateRefusal, templateSlotSource } from '@objectstack/spec/automation';
4341
import {
44-
ACTION_COPY_DOLLAR_TRANSITION_ROOTS,
4542
ACTION_ERROR_TEMPLATE_ROOTS,
4643
ACTION_SUCCESS_TEMPLATE_ROOTS,
4744
actionConfirmTemplateRoots,
@@ -69,10 +66,6 @@ const CONTAINER_COMPONENTS: ReadonlySet<string> = new Set(['action:group', 'acti
6966
/** A blank sentence — `trim()`'s whitespace set is exactly `\s`. */
7067
const BLANK_TEXT = /^\s*$/;
7168

72-
/** What the one finding that stays a warning ends with: why it is advice, for now. */
73-
const TRANSITIONAL = ' A warning, not a refusal, for now: the console\'s runner still fills a `${…}` token over this '
74-
+ 'root in a sentence with no `{{ }}` hole.';
75-
7669
/** What a blank sentence costs, per key, at the console's runner. */
7770
const BLANK_COST: Record<CopyKey, string> = {
7871
confirmText: 'so no question is asked (an empty sentence declares no confirmation, and a whitespace one shows an '
@@ -82,17 +75,6 @@ const BLANK_COST: Record<CopyKey, string> = {
8275
+ 'sentence, or remove the key.',
8376
};
8477

85-
/**
86-
* Whether `text` is the one shape the runner still reads in its `${…}`
87-
* dialect for `key`: no `{{ }}` hole, and every token a `${…}` over a root it
88-
* fills there.
89-
*/
90-
function isTransitionalDollar(key: CopyKey, text: string): boolean {
91-
const roots = dollarOnlyTokenRoots(text);
92-
const fills = ACTION_COPY_DOLLAR_TRANSITION_ROOTS[key];
93-
return roots !== undefined && roots.every((root) => fills.includes(root));
94-
}
95-
9678
/** The roots one key's holes may name, for the action that carries it. */
9779
function rootsOf(key: CopyKey, action: AnyRec): readonly string[] {
9880
if (key === 'confirmText') return actionConfirmTemplateRoots(action);
@@ -141,11 +123,7 @@ function judgeAction(
141123
}
142124
const refusal = closedScopeTemplateRefusal(text, { slot, roots: rootsOf(key, action) });
143125
if (refusal !== undefined) {
144-
if (isTransitionalDollar(key, text)) {
145-
issues.push({ where: located, message: `${refusal}${TRANSITIONAL}`, source: text, severity: 'warning' });
146-
} else {
147-
refuse(refusal, text);
148-
}
126+
refuse(refusal, text);
149127
continue;
150128
}
151129
for (const e of validateExpression('template', text).errors) refuse(e.message, e.source);

0 commit comments

Comments
 (0)