daw_event/v1, daw_event_response/v1: typed answer field and receiver rules #19

Closed
opened 2026-11-16 16:26:00 +01:00 by michael · 1 comment
Owner

Problem

The first real use of decision_required (module removal confirmation,
DAW/daw-module-manager) showed two gaps that every later use will hit:

  1. The field that says what may be answered (daw_field_type/v1) has no
    place in daw_event/v1. The code puts it into data.answer, next to
    the values of the message placeholders. That is a convention, not a
    contract, and answer can collide with a placeholder name. The
    response value sits in data.value, also only by convention.
  2. daw_event_response/v1 says what event_id and operation_id mean,
    but not who checks them and what happens with an unexpected, repeated
    or incomplete response. In the removal flow a response was accepted
    without event_id and source, because the module cannot know the
    event_id of an event it sent in an earlier call.

Changing this is cheap now and expensive once several programs use it.

Proposal (to discuss)

A. A typed field for the answer in daw_event/v1

  • optional field answer on the event itself, a daw_field_type/v1
    object (name to be confirmed in the discussion)
  • the same reasoning as in the section "Relation to daw_error/v1": an
    object of another contract is a typed field, never an untyped value
    inside data
  • it is only meaningful for type = decision_required; a
    decision_required without it stays valid (the form of the answer is
    then defined per code, as today)
  • data keeps its role: domain data and placeholder values

B. The answer in daw_event_response/v1

  • if the event declares answer, data.value has the form that field
    declares (single: one value, multiple: a list of values); otherwise the
    form is defined per event code, as today

C. Receiver rules for responses

Whoever holds the pending event checks the response (the pattern of the
receiver contract in mainjan/v1):

  • event_id must name a pending event, operation_id must match it,
    source must be present
  • the value must be one the declared field allows
  • the first valid response counts; a second response for the same event
    and a response for an unknown event are rejected
  • a module that is called again with a response does not have to
    remember the event; the holder (the host) has checked it

Not in this issue

Acceptance criteria

  • name and rules agreed
  • specification.md and contract.json of daw_event/v1 and
    daw_event_response/v1 updated, changelog entries
  • examples: a decision with the field, a response to it, invalid
    cases (unknown event, wrong operation_id, repeated response)
  • note which of this is growth inside v1 (draft)

DAW/daw-contracts#17, DAW/daw-contracts#18,
DAW/daw-modul-berhtjan-core (pending decisions registry, companion issue),
DAW/daw-module-manager (companion issue),
DAW/daw-modul-berhtjan-cli#15

## Problem The first real use of `decision_required` (module removal confirmation, DAW/daw-module-manager) showed two gaps that every later use will hit: 1. The field that says what may be answered (`daw_field_type/v1`) has no place in `daw_event/v1`. The code puts it into `data.answer`, next to the values of the message placeholders. That is a convention, not a contract, and `answer` can collide with a placeholder name. The response value sits in `data.value`, also only by convention. 2. `daw_event_response/v1` says what `event_id` and `operation_id` mean, but not who checks them and what happens with an unexpected, repeated or incomplete response. In the removal flow a response was accepted without `event_id` and `source`, because the module cannot know the `event_id` of an event it sent in an earlier call. Changing this is cheap now and expensive once several programs use it. ## Proposal (to discuss) ### A. A typed field for the answer in `daw_event/v1` - optional field `answer` on the event itself, a `daw_field_type/v1` object (name to be confirmed in the discussion) - the same reasoning as in the section "Relation to daw_error/v1": an object of another contract is a typed field, never an untyped value inside `data` - it is only meaningful for `type = decision_required`; a `decision_required` without it stays valid (the form of the answer is then defined per `code`, as today) - `data` keeps its role: domain data and placeholder values ### B. The answer in `daw_event_response/v1` - if the event declares `answer`, `data.value` has the form that field declares (single: one value, multiple: a list of values); otherwise the form is defined per event `code`, as today ### C. Receiver rules for responses Whoever holds the pending event checks the response (the pattern of the receiver contract in `mainjan/v1`): - `event_id` must name a pending event, `operation_id` must match it, `source` must be present - the value must be one the declared field allows - the first valid response counts; a second response for the same event and a response for an unknown event are rejected - a module that is called again with a response does not have to remember the event; the holder (the host) has checked it ## Not in this issue - the form of `collection.values` entries (DAW/daw-contracts#17) - placeholder syntax (DAW/daw-contracts#18) - persistence of pending events across processes (later, with `mainjan`) ## Acceptance criteria - [ ] name and rules agreed - [ ] specification.md and contract.json of `daw_event/v1` and `daw_event_response/v1` updated, changelog entries - [ ] examples: a decision with the field, a response to it, invalid cases (unknown event, wrong `operation_id`, repeated response) - [ ] note which of this is growth inside v1 (draft) ## Related DAW/daw-contracts#17, DAW/daw-contracts#18, DAW/daw-modul-berhtjan-core (pending decisions registry, companion issue), DAW/daw-module-manager (companion issue), DAW/daw-modul-berhtjan-cli#15
Author
Owner

Implemented on main

Commits: 6e1838f

Pushed. Follow-up points, if any, are tracked in their own issues.

## Implemented on main Commits: 6e1838f Pushed. Follow-up points, if any, are tracked in their own issues.
michael 2026-11-18 11:55:50 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-contracts#19
No description provided.