concept: warnings and errors - definition, reporting and display #24

Open
opened 2026-11-18 11:36:57 +01:00 by michael · 0 comments
Owner

Goal

Define what a warning is, how it differs from an error, and how a
warning reaches the screen - the same way for every module and every
host. Today there is no contract for it, and the code has grown three
ways.

Background

  • Review of the DAW ecosystem against its contracts (open point P10:
    "follow-up errors and warnings without a contract").
  • A warning is not an error (decision of the maintainer, 2026-11-17):
    an error ends a function with nil, daw_error/v1; a warning is
    something that happened while the operation still worked.
  • Decision of 2026-11-06 (see DAW/daw-contracts#21): daw_error_report/v1
    is on hold; a follow-up problem is a daw_event/v1 event
    (cleanup_failed style); only daw_error/v1 is an error object.
  • daw_event/v1 ("Relation to daw_error/v1"): a warning-like occurrence
    is a named type/code that says what happened, not a generic
    severity label and not an embedded error object.
  • Logging standard (daw-project-standard, section 8): [WARN] means
    "unexpected, not blocking".

Current state (found in the code)

Producers: result.warnings in DAW/daw-module-manager

Entries are { kind, id?, error?, path? }, and are not uniform:

  • install/available.lua: index_problem, module_broken - with id
    and error as daw_error/v1
  • activate.lua: leftover_removed, interrupted_install_restored -
    with path and no error
  • activate.lua, install/init.lua: cleanup_failed - error is a
    daw_error/v1
  • install/init.lua (progress): progress_failed - error is a plain
    text, not a daw_error/v1

The same occurrence has two paths: a failed cleanup of the work
directory is a warning in result.warnings when the operation was
activated, and an event work_dir_cleanup_failed when it was not. Two
comments in the code mark this as INTERIM ("when warnings move to
events (see issue list)"; without a sink the event is lost).

Display: adapters/ui/results.lua in DAW/fragjan

  • every warning is one line [WARN] <kind> <id>: <text>; the exit code
    is raised to warn
  • kind is shown as the identifier, not as a translated text; a
    warning has no resource_id, so it cannot be translated
  • an entry without error is shown as [WARN] leftover_removed: nil
    (reproduced); path is never shown
  • events are all shown as [INFO] ...; an event has no level, so an
    event can never be shown as a warning
  • fragjan itself shows its own problems (a text without translation,
    DAW/fragjan#153) as a [WARN] line, and also raises the exit code

Questions to decide

  1. What is a warning (a definition in one or two sentences, with
    examples), and what is an error? Where is the line for a failed
    cleanup after a successful operation?
  2. One way for a module to report a warning: (A) an event with a named
    type/code, the host decides how to show it; (B) result.warnings
    as a list of daw_error/v1 objects only; (C) both, with a rule for
    which one is used when.
  3. Who decides that an event is shown as a warning: the module (a field
    in the contract), the host (a configuration by type), or the
    contract (a list of warning types as data)? No fixed lists in code.
  4. How is a warning shown the same way everywhere: one line format,
    translated text (resource_id), the data (path, id) shown, and
    the exit code.
  5. What happens with a warning without a sink (a run that cannot show
    events)?

Scope

  • decisions recorded in the contracts (daw_event/v1, perhaps
    daw_error/v1, README) and in the standards
  • afterwards implementation issues, one per repository: DAW/daw-module-manager
    (producers), DAW/fragjan (display, the nil line), DAW/daw-modul-berhtjan-cli
    (if it shows events)

Acceptance criteria

  • questions 1 to 5 decided and written down, with examples
  • a valid example for a warning (as an event, or as a result entry)
  • the nil display and the untranslated kind named in the
    implementation issues
  • implementation issues created in each affected repository

DAW/daw-contracts#21 (daw_error_report/v1 on hold),
DAW/daw-contracts#20 (event message), DAW/fragjan#153,
DAW/daw-module-manager#29

## Goal Define what a warning is, how it differs from an error, and how a warning reaches the screen - the same way for every module and every host. Today there is no contract for it, and the code has grown three ways. ## Background - Review of the DAW ecosystem against its contracts (open point P10: "follow-up errors and warnings without a contract"). - A warning is not an error (decision of the maintainer, 2026-11-17): an error ends a function with `nil, daw_error/v1`; a warning is something that happened while the operation still worked. - Decision of 2026-11-06 (see DAW/daw-contracts#21): `daw_error_report/v1` is on hold; a follow-up problem is a `daw_event/v1` event (`cleanup_failed` style); only `daw_error/v1` is an error object. - `daw_event/v1` ("Relation to daw_error/v1"): a warning-like occurrence is a named `type`/`code` that says what happened, not a generic severity label and not an embedded error object. - Logging standard (`daw-project-standard`, section 8): `[WARN]` means "unexpected, not blocking". ## Current state (found in the code) ### Producers: `result.warnings` in DAW/daw-module-manager Entries are `{ kind, id?, error?, path? }`, and are not uniform: - `install/available.lua`: `index_problem`, `module_broken` - with `id` and `error` as `daw_error/v1` - `activate.lua`: `leftover_removed`, `interrupted_install_restored` - with `path` and **no** `error` - `activate.lua`, `install/init.lua`: `cleanup_failed` - `error` is a `daw_error/v1` - `install/init.lua` (progress): `progress_failed` - `error` is a plain **text**, not a `daw_error/v1` The same occurrence has two paths: a failed cleanup of the work directory is a warning in `result.warnings` when the operation was activated, and an event `work_dir_cleanup_failed` when it was not. Two comments in the code mark this as INTERIM ("when warnings move to events (see issue list)"; without a sink the event is lost). ### Display: `adapters/ui/results.lua` in DAW/fragjan - every warning is one line `[WARN] <kind> <id>: <text>`; the exit code is raised to `warn` - `kind` is shown as the identifier, not as a translated text; a warning has no `resource_id`, so it cannot be translated - an entry without `error` is shown as `[WARN] leftover_removed: nil` (reproduced); `path` is never shown - events are all shown as `[INFO] ...`; an event has no level, so an event can never be shown as a warning - fragjan itself shows its own problems (a text without translation, DAW/fragjan#153) as a `[WARN]` line, and also raises the exit code ## Questions to decide 1. What is a warning (a definition in one or two sentences, with examples), and what is an error? Where is the line for a failed cleanup after a successful operation? 2. One way for a module to report a warning: (A) an event with a named `type`/`code`, the host decides how to show it; (B) `result.warnings` as a list of `daw_error/v1` objects only; (C) both, with a rule for which one is used when. 3. Who decides that an event is shown as a warning: the module (a field in the contract), the host (a configuration by `type`), or the contract (a list of warning types as data)? No fixed lists in code. 4. How is a warning shown the same way everywhere: one line format, translated text (`resource_id`), the data (`path`, `id`) shown, and the exit code. 5. What happens with a warning without a sink (a run that cannot show events)? ## Scope - decisions recorded in the contracts (`daw_event/v1`, perhaps `daw_error/v1`, README) and in the standards - afterwards implementation issues, one per repository: DAW/daw-module-manager (producers), DAW/fragjan (display, the `nil` line), DAW/daw-modul-berhtjan-cli (if it shows events) ## Acceptance criteria - [ ] questions 1 to 5 decided and written down, with examples - [ ] a valid example for a warning (as an event, or as a result entry) - [ ] the `nil` display and the untranslated `kind` named in the implementation issues - [ ] implementation issues created in each affected repository ## Related DAW/daw-contracts#21 (`daw_error_report/v1` on hold), DAW/daw-contracts#20 (event message), DAW/fragjan#153, DAW/daw-module-manager#29
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#24
No description provided.