Define parameterized i18n semantics for daw_error/v1 messages #8
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type/design
type
docs
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-contracts#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The first real
daw_i18n/v1migration inDAW/daw-lua-commonrevealed an ambiguity for parameterized runtime messages.
Example from
base64.lua:daw_i18n/v1correctly forbids fragment concatenation for translatableresources. The corresponding canonical resource therefore needs to be
a complete statement with a named placeholder, for example:
However, the runtime error still needs a directly usable canonical
English diagnostic message such as:
The contracts do not yet define how a parameterized
daw_i18n/v1resource relates to the materializedmessageof adaw_error/v1instance, nor where the placeholder values required forlater translation are represented.
Intended direction
daw_error/v1.messageshould remain a complete, directly usablecanonical English diagnostic message.
It MUST NOT become an unresolved i18n template merely because a
resource_idis present.For a parameterized resource, the intended model is conceptually:
with a canonical
daw_i18n/v1resource such as:The materialized runtime
messageand the canonical resource templateare therefore not byte-identical when placeholders are present.
Open contract point
The contracts need to define how the named placeholders declared by
the referenced
daw_i18n/v1resource obtain their values from theruntime object.
Using fields from
daw_error/v1.datawith matching names is thecurrent candidate, but this MUST be decided explicitly rather than
introduced as an implementation convention.
In particular, the contract should clarify whether:
daw_error/v1.data, orThe solution should preserve structured error data without implicitly
declaring every
datafield to be an i18n parameter.Scope
Clarify the interaction between:
daw_error/v1.messagedaw_error/v1.resource_iddaw_i18n/v1resourcesThis issue does not define a language-specific resolver API or fallback
policy.
Acceptance criteria
messagewhenresource_idreferences a parameterized resource.
messageremains a complete, directly usable canonical Englishdiagnostic string with runtime values materialized.
{placeholder}syntax is not required indaw_error/v1.message.daw_i18n/v1placeholders are obtained from adaw_error/v1instance.
daw_error/v1.datais explicit and does not accidentally make every
datafield ani18n parameter.
invalid padding position in group {group}.messagesemantics remain unchanged.Related
DAW/daw-lua-common#48DAW/daw-contracts#6DAW/daw-contracts#7Resolution: parameter binding via data, relational not constructive
Decided model, validated against config_parser.lua's five
parameterized error sites:
declared by the referenced daw_i18n/v1 canonical resource MUST have
a same-named direct field in daw_error/v1.data.
syntax, expressions, and implicit traversal are not supported in
v1.
occur in the resource's parameters set (Resource.parameters ->
determines required names; error.data -> supplies the values; not
the reverse).
obligation. daw_error.new() does not require the referenced
daw_i18n/v1 resource to be available and does not validate this
relationship itself.
resource available MUST treat a missing required parameter value as
an invalid error/resource pairing, and MUST NOT silently omit,
invent, or leave the placeholder unresolved.
text; with parameters, message represents the canonical English
resource text with all declared placeholders materialized from the
corresponding data values. message never contains unresolved
{placeholder} syntax.
Explicitly out of scope for #8, tracked separately as #9:
deterministic representation of non-string parameter values (e.g.
data.line = 17 as a number, booleans). Resolution decided here; not
yet implemented in the contract files.
Updated acceptance criteria (supersedes originals, still open)
references a parameterized resource.
diagnostic string with runtime values materialized.
daw_error/v1.message.
daw_i18n/v1 placeholders are obtained from a daw_error/v1
instance (same-named direct fields in data).
is explicit and does not accidentally make every data field an
i18n parameter.
invalid_section_type (config_parser.lua real-world case).
introduced.
are explicitly out of v1 scope.
named as out of scope, tracked as DAW/daw-contracts#9.
Implemented
daw_error/v1/specification.md (message, resource_id, data sections)
and contract.json now define the parameter binding: resource.parameters
determines required names, daw_error.data supplies values via
same-named direct fields (relational, not construction-time), message
is fully materialized with no unresolved placeholders. Nested/path
parameter references are out of scope. Non-string value formatting is
explicitly deferred to #9.
The example_with_cell_id_and_resource in contract.json previously
contained an unresolved {path} placeholder in message, violating this
rule -- replaced with a materialized config_parser.lua example
(invalid_section_type).