Skip to content

Commit a8f9f1c

Browse files
committed
feat(spec,platform-objects)!: migrate the in-repo action copy to {{ }}; semantic migration entry
#27948, ruling A, step 2: - migration: semantic entry `action-dialog-outcome-copy-template-holes` (no conversion: a `${…}` token held an expression, a hole holds a path and formatters only; `os migrate meta` lists it). - producers: the invite actions' `sent` / `link_only` outcomes, `resend_invitation` and `update_member_role` descriptions (the `??` fallback becomes `| default:'this member'`), the role change's `permission_set_granted` outcomes, and their en / zh-CN / ja-JP / es-ES bundles (en regenerates identically); the action form's outcomeMessages help and the actions guide teach `{{ }}`. - changeset: Clause-② yes (narrowing), Metadata-protocol narrowed, ADR-0087 registered. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwQ8tWwY7TiHQPMCHR
1 parent 45d5e28 commit a8f9f1c

17 files changed

Lines changed: 205 additions & 81 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/lint': minor
4+
'@objectstack/platform-objects': patch
5+
'@objectstack/runtime': patch
6+
'@objectstack/cli': patch
7+
---
8+
9+
feat(spec)!: an action's `description`, each param's `helpText` and each `outcomeMessages` entry are `template` slots; the doors refuse `${…}` there
10+
11+
Clause-②: yes (narrowing)
12+
Metadata-protocol: narrowed
13+
14+
<!-- adr-0087: registered action-dialog-outcome-copy-template-holes -->
15+
16+
Step 2 of #27948 (ruling A): the five action copy keys speak one hole syntax, ADR-0032's `{{ }}`. `confirmText` and `successMessage` already did (#24814); the param dialog's `description`, each param's `helpText` and each `outcomeMessages` entry now join them.
17+
18+
- **The parse.** Each of the three is typed as `confirmText` is: a bare string is shorthand for `{ dialect: 'template', source }` and parses to that envelope; the envelope is taken; `description` and an `outcomeMessages` entry keep the inline locale map they took as an `I18nLabel`, and `helpText` stays without one (it was a plain string). A blank string and a `${…}` sentence still parse, so a stored action loads.
19+
- **The roots.** `description` and `helpText` read `confirmText`'s roots: `record`, the record the action runs against (a registered action's `params` is the input list the dialog collects, so it binds nothing). An `outcomeMessages` entry reads `successMessage`'s: `result`, the handler's answer, and `record`.
20+
- **The doors.** `objectstack validate`, `compile` and the publish gate (422) judge each sentence through the same judge as `confirmText`: a `${…}` token, a single-brace `{x}` token, a hole over a root the runner does not bind, a hole holding logic or an unknown formatter, and a blank sentence are errors, each named at its own path (`description`, `params[N].helpText`, `outcomeMessages.OUTCOME`) with its `{{ }}` spelling. An inline `properties.action` is judged on its params' `helpText`.
21+
- **The readers.** The CLI's i18n extraction seeds the envelope's text exactly as the bare string's, and the MCP `list_actions` param description reads `helpText`'s text, never the object.
22+
- **The platform's own copy** is rewritten: the invite actions' outcomes (`Invitation sent to {{ result.email }}`), `resend_invitation`'s and `update_member_role`'s descriptions, the role-change `permission_set_granted` outcomes, and their four translation bundles.
23+
24+
What to do (FROM → TO, on `description`, `params[].helpText` and `outcomeMessages` entries):
25+
26+
- `Resend the invitation to ${record.email}?` → `Resend the invitation to {{ record.email }}?`
27+
- `Invitation sent to ${result.email}` → `Invitation sent to {{ result.email }}`
28+
- `${record.owner?.name ?? 'nobody'}` → `{{ record.owner.name | default:'nobody' }}` (the `default` formatter also covers an empty value)
29+
- other logic in a `${…}` token moves into the handler's answer and is read from `result`.
30+
31+
The console keeps filling `${…}` in a stored sentence with no `{{ }}` hole, so stored copy reads as before until its next save, which is judged. `os migrate meta` lists the change (`action-dialog-outcome-copy-template-holes`); no conversion is registered, since a `${…}` token held an expression and a hole holds only a path and formatters.
32+
33+
A TypeScript reader of a parsed `ActionSchema` now meets the envelope on these three keys: read its text with `templateSlotSource` (`@objectstack/spec/automation`).

‎content/docs/ui/actions.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ strict params gate admits either bag without a word.
386386
`'Invitation sent to {{ result.email }}'`; a `${…}` token in it is refused. A
387387
`type: 'api'` or `'script'` action whose handler can succeed in more than one
388388
way adds `outcomeMessages`, one entry per snake_case `outcome` the handler
389-
returns, each of which may read `${result.*}`; the toast shows the entry the
389+
returns, each a template like `successMessage` (`{{ result.* }}`,
390+
`{{ record.* }}`; a `${…}` token is refused); the toast shows the entry the
390391
answer names, else `successMessage`, else a generic "Action completed
391392
successfully". A `message` in the server's answer is shown only when the copy
392393
asks for it (`{{ result.message }}`). Post-success navigation is

‎packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
18251825
},
18261826
outcomeMessages: {
18271827
label: "Outcome Messages",
1828-
helpText: "Success message per handler outcome, as JSON: each key is a snake_case `outcome` value the handler returns in its success payload, and each value is the label shown for that outcome, e.g. {\"archived\": \"Archived\", \"already_archived\": \"Already archived\"}. A label may interpolate ${result.*}. An outcome with no entry shows the success message; a key the handler never returns is never shown. Not allowed beside a result dialog or `operation: 'update'`."
1828+
helpText: "Success message per handler outcome, as JSON: each key is a snake_case `outcome` value the handler returns in its success payload, and each value is the label shown for that outcome, e.g. {\"archived\": \"Archived\", \"already_archived\": \"Already archived\"}. A label may hold {{ result.* }} holes. An outcome with no entry shows the success message; a key the handler never returns is never shown. Not allowed beside a result dialog or `operation: 'update'`."
18291829
},
18301830
onSuccess: {
18311831
label: "On Success",

‎packages/platform-objects/src/apps/translations/en.objects.generated.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
141141
description: "Invite someone by email address. They join this organization with the chosen role when they accept the invitation.",
142142
successMessage: "Invitation sent to {{ result.email }}",
143143
outcomeMessages: {
144-
sent: "Invitation sent to ${result.email}",
145-
link_only: "Invitation created for ${result.email}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
144+
sent: "Invitation sent to {{ result.email }}",
145+
link_only: "Invitation created for {{ result.email }}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
146146
},
147147
params: {
148148
role: {
@@ -581,8 +581,8 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
581581
description: "Invite someone by email address. They join this organization with the chosen role when they accept the invitation.",
582582
successMessage: "Invitation sent to {{ result.email }}",
583583
outcomeMessages: {
584-
sent: "Invitation sent to ${result.email}",
585-
link_only: "Invitation created for ${result.email}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
584+
sent: "Invitation sent to {{ result.email }}",
585+
link_only: "Invitation created for {{ result.email }}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
586586
},
587587
params: {
588588
role: {
@@ -673,8 +673,8 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
673673
description: "Invite someone by email address. They join this organization with the chosen role when they accept the invitation.",
674674
successMessage: "Invitation sent to {{ result.email }}",
675675
outcomeMessages: {
676-
sent: "Invitation sent to ${result.email}",
677-
link_only: "Invitation created for ${result.email}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
676+
sent: "Invitation sent to {{ result.email }}",
677+
link_only: "Invitation created for {{ result.email }}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
678678
},
679679
params: {
680680
role: {
@@ -700,10 +700,10 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
700700
},
701701
update_member_role: {
702702
label: "Change Role",
703-
description: "Choose the new organization role for ${record.user_id?.name ?? 'this member'}.",
703+
description: "Choose the new organization role for {{ record.user_id.name | default:'this member' }}.",
704704
successMessage: "Member role updated",
705705
outcomeMessages: {
706-
permission_set_granted: "Member role updated. The new role also granted the permission set ${result.grantedPermissionSet.label}."
706+
permission_set_granted: "Member role updated. The new role also granted the permission set {{ result.grantedPermissionSet.label }}."
707707
},
708708
params: {
709709
role: {
@@ -721,7 +721,7 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
721721
confirmText: "Make the selected member an owner of this organization? They get every owner privilege, including deleting the organization. You stay an owner too; to step down, use Change Role on your own membership.",
722722
successMessage: "Member is now an owner",
723723
outcomeMessages: {
724-
permission_set_granted: "Member is now an owner. The new role also granted the permission set ${result.grantedPermissionSet.label}."
724+
permission_set_granted: "Member is now an owner. The new role also granted the permission set {{ result.grantedPermissionSet.label }}."
725725
}
726726
}
727727
}
@@ -825,8 +825,8 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
825825
description: "Invite someone by email address. They join this organization with the chosen role when they accept the invitation.",
826826
successMessage: "Invitation sent to {{ result.email }}",
827827
outcomeMessages: {
828-
sent: "Invitation sent to ${result.email}",
829-
link_only: "Invitation created for ${result.email}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
828+
sent: "Invitation sent to {{ result.email }}",
829+
link_only: "Invitation created for {{ result.email }}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
830830
},
831831
params: {
832832
role: {
@@ -848,11 +848,11 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
848848
},
849849
resend_invitation: {
850850
label: "Resend Invitation",
851-
description: "Resend the invitation to ${record.email}? Its expiry date starts over.",
851+
description: "Resend the invitation to {{ record.email }}? Its expiry date starts over.",
852852
successMessage: "Invitation resent",
853853
outcomeMessages: {
854-
sent: "Invitation resent to ${result.email}",
855-
link_only: "Invitation renewed for ${result.email}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
854+
sent: "Invitation resent to {{ result.email }}",
855+
link_only: "Invitation renewed for {{ result.email }}. Mail is not configured on this server, so no email went out. Use Copy Invite Link on the invitation to share it."
856856
}
857857
},
858858
copy_invitation_link: {

‎packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
18251825
},
18261826
outcomeMessages: {
18271827
label: "Mensajes por resultado",
1828-
helpText: "Mensaje de éxito por cada resultado del manejador, en JSON: cada clave es un valor `outcome` en snake_case que el manejador devuelve en su carga útil de éxito, y cada valor es la etiqueta que se muestra para ese resultado, p. ej., {\"archived\": \"Archivado\", \"already_archived\": \"Ya estaba archivado\"}. Una etiqueta puede interpolar ${result.*}. Un resultado sin entrada muestra el mensaje de éxito; una clave que el manejador nunca devuelve no se muestra nunca. No se admite junto a un diálogo de resultado ni con `operation: 'update'`."
1828+
helpText: "Mensaje de éxito por cada resultado del manejador, en JSON: cada clave es un valor `outcome` en snake_case que el manejador devuelve en su carga útil de éxito, y cada valor es la etiqueta que se muestra para ese resultado, p. ej., {\"archived\": \"Archivado\", \"already_archived\": \"Ya estaba archivado\"}. Una etiqueta puede interpolar {{ result.* }}. Un resultado sin entrada muestra el mensaje de éxito; una clave que el manejador nunca devuelve no se muestra nunca. No se admite junto a un diálogo de resultado ni con `operation: 'update'`."
18291829
},
18301830
onSuccess: {
18311831
label: "Al completarse",

‎packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
141141
description: "Invita a alguien por su dirección de correo electrónico. Se une a esta organización con el rol elegido cuando acepta la invitación.",
142142
successMessage: "Invitación enviada a {{ result.email }}",
143143
outcomeMessages: {
144-
sent: "Invitación enviada a ${result.email}",
145-
link_only: "Invitación creada para ${result.email}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
144+
sent: "Invitación enviada a {{ result.email }}",
145+
link_only: "Invitación creada para {{ result.email }}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
146146
},
147147
params: {
148148
role: {
@@ -581,8 +581,8 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
581581
description: "Invita a alguien por su dirección de correo electrónico. Se une a esta organización con el rol elegido cuando acepta la invitación.",
582582
successMessage: "Invitación enviada a {{ result.email }}",
583583
outcomeMessages: {
584-
sent: "Invitación enviada a ${result.email}",
585-
link_only: "Invitación creada para ${result.email}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
584+
sent: "Invitación enviada a {{ result.email }}",
585+
link_only: "Invitación creada para {{ result.email }}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
586586
},
587587
params: {
588588
role: {
@@ -673,8 +673,8 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
673673
description: "Invita a alguien por su dirección de correo electrónico. Se une a esta organización con el rol elegido cuando acepta la invitación.",
674674
successMessage: "Invitación enviada a {{ result.email }}",
675675
outcomeMessages: {
676-
sent: "Invitación enviada a ${result.email}",
677-
link_only: "Invitación creada para ${result.email}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
676+
sent: "Invitación enviada a {{ result.email }}",
677+
link_only: "Invitación creada para {{ result.email }}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
678678
},
679679
params: {
680680
role: {
@@ -700,10 +700,10 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
700700
},
701701
update_member_role: {
702702
label: "Cambiar rol",
703-
description: "Elija el nuevo rol en la organización para ${record.user_id?.name ?? 'este miembro'}.",
703+
description: "Elija el nuevo rol en la organización para {{ record.user_id.name | default:'este miembro' }}.",
704704
successMessage: "Rol del miembro actualizado",
705705
outcomeMessages: {
706-
permission_set_granted: "Rol del miembro actualizado. El nuevo rol también concedió el conjunto de permisos ${result.grantedPermissionSet.label}."
706+
permission_set_granted: "Rol del miembro actualizado. El nuevo rol también concedió el conjunto de permisos {{ result.grantedPermissionSet.label }}."
707707
},
708708
params: {
709709
role: {
@@ -721,7 +721,7 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
721721
confirmText: "¿Hacer propietario de esta organización al miembro seleccionado? Obtendrá todos los privilegios de propietario, incluido eliminar la organización. Tú sigues siendo propietario; para dejar de serlo, usa «Cambiar rol» en tu propia membresía.",
722722
successMessage: "El miembro ahora es propietario",
723723
outcomeMessages: {
724-
permission_set_granted: "El miembro ahora es propietario. El nuevo rol también concedió el conjunto de permisos ${result.grantedPermissionSet.label}."
724+
permission_set_granted: "El miembro ahora es propietario. El nuevo rol también concedió el conjunto de permisos {{ result.grantedPermissionSet.label }}."
725725
}
726726
}
727727
}
@@ -825,8 +825,8 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
825825
description: "Invita a alguien por su dirección de correo electrónico. Se une a esta organización con el rol elegido cuando acepta la invitación.",
826826
successMessage: "Invitación enviada a {{ result.email }}",
827827
outcomeMessages: {
828-
sent: "Invitación enviada a ${result.email}",
829-
link_only: "Invitación creada para ${result.email}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
828+
sent: "Invitación enviada a {{ result.email }}",
829+
link_only: "Invitación creada para {{ result.email }}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
830830
},
831831
params: {
832832
role: {
@@ -848,11 +848,11 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
848848
},
849849
resend_invitation: {
850850
label: "Reenviar invitación",
851-
description: "¿Reenviar la invitación a ${record.email}? Su plazo de vencimiento vuelve a empezar.",
851+
description: "¿Reenviar la invitación a {{ record.email }}? Su plazo de vencimiento vuelve a empezar.",
852852
successMessage: "Invitación reenviada",
853853
outcomeMessages: {
854-
sent: "Invitación reenviada a ${result.email}",
855-
link_only: "Invitación renovada para ${result.email}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
854+
sent: "Invitación reenviada a {{ result.email }}",
855+
link_only: "Invitación renovada para {{ result.email }}. El correo no está configurado en este servidor, así que no ha salido ningún mensaje. Usa Copiar enlace de invitación en la invitación para compartirla."
856856
}
857857
},
858858
copy_invitation_link: {

0 commit comments

Comments
 (0)