Skip to content

Action status code catalog: name, description and severity for reported status codes #3436

Description

@laverman

Motivation

Devices report numeric status codes in action feedback (DDI status.code, DMF code). hawkBit stores them (ActionStatus.code, Action.lastStatusCode) and you can filter on the number (GET /rest/v1/actions?q=lastStatusCode==1234). But a bare number tells an operator nothing. They can't see what 1234 means, whether it is a problem, or find all actions that ended with an error code.

This issue proposes a catalog of status codes with a name, description and severity, which clients can display and use for filtering.

Proposal

1. Status code entity

Field Type Notes
id long technical ID
code integer the reported code, unique
name string short label, e.g. DOWNLOAD_HASH_MISMATCH
description string longer text for display
severity enum INFO, WARNING, ERROR

Plus the usual audit fields. One flat table: a code means the same thing regardless of target type or software version. That keeps it simple. Per-type meanings could come later if needed.

2. Management REST API

  • GET /rest/v1/action-status-codes (paged, RSQL q on code, name, severity)
  • GET /rest/v1/action-status-codes/{id}
  • POST /rest/v1/action-status-codes
  • PUT /rest/v1/action-status-codes/{id}

No delete: statuses keep referencing codes, and a deleted code would be provisioned again on its next report. Access uses the existing permissions (no new permission set).

3. Auto-provisioning
When feedback (DDI, DMF or Mgmt confirmation) reports a code that isn't in the catalog, create an entry automatically with a default name (e.g. "Code 1234"), no description, and severity INFO. An operator can then fill in the details. Concurrent first reports of the same code must not fail the feedback (unique constraint plus get-or-create).

4. Exposing and filtering

  • MgmtActionStatus and MgmtAction expose the resolved code details (e.g. name and severity, or a link to the code resource), keeping the existing integer fields.
  • Filter actions by the severity of their last status code, e.g. GET /rest/v1/actions?q=lastStatusCode.severity==ERROR.
  • Ranges on the code: GET /rest/v1/actions?q=lastStatusCode=ge=200;lastStatusCode=le=299. The generic RSQL operators should already support this. Verify it, add a test, and document it.

Related fixes found while looking at this

  • docs/entity-definitions.md (and its MCP copy) shows lastActionStatusCode==200, but the RSQL key is lastStatusCode.
  • Action.lastStatusCode isn't updated for cancel feedback (addCancelActionStatus), informational statuses or auto-confirmation, so filtering on it misses those actions.

Backward compatibility

Additive only: the existing code/lastStatusCode integer fields, the DDI/DMF payloads and the lastStatusCode RSQL key stay unchanged.

Activity

  1. added theissue type on Oct 22, 2026
  2. strailov commented on Oct 30, 2026

    @strailov
    Contributor

    Thanks for the detailed proposal. We went through it against the current code base and would like to narrow the scope a bit. Below is what we suggest.

    1. Status code catalogue (operator-maintained)

    We agree on a per-tenant catalogue table, but without auto-provisioning. Documenting codes is the operator's job; hawkBit does not create catalogue entries from device feedback.

    Reasons:

    • No extra writes in the hot feedback path (DDI/DMF). That avoids the get-or-create race, a new quota for device-driven inserts, and running the inserts as system user.
    • A code that is not in the catalogue is still fully usable. It is simply "undocumented".

    Entity (new table sp_action_status_code, tenant-aware, the usual audit fields):

    Field Type Notes
    id long technical ID
    code integer unique per tenant, immutable after creation
    name string short label, e.g. DOWNLOAD_HASH_MISMATCH
    description string optional
    severity enum see section 4

    The link to actions and statuses goes through the existing integer columns (sp_action.last_action_status_code, sp_action_status.code), joined on (tenant, code). There are no new columns, foreign keys or backfills on sp_action / sp_action_status. Those are the largest tables in production installations, and DDL on them is risky.

    2. Management API

    Catalogue (documented codes):

    • GET /rest/v1/action-status-codes: paged, RSQL q on code, name, severity.
    • GET /rest/v1/action-status-codes/{code}
    • POST /rest/v1/action-status-codes documents a code.
    • PUT /rest/v1/action-status-codes/{code} updates name, description and severity.

    Undocumented codes (reported but not in the catalogue):

    • GET /rest/v1/action-status-codes/undocumented: paged list of codes that appear in action statuses but have no catalogue entry, so operators can see what is left to document. It is read-only and computed from the existing sp_action_status (tenant, code) index. Documenting a code means a POST to the catalogue, after which the code no longer appears in this list.

    Keeping the two apart gives the catalogue endpoint clean semantics (real entities, RSQL, paging over one table). The more expensive "distinct reported codes" query only runs when a client explicitly asks for it.

    The current API suggestion is addressing catalogue entries by code rather than by technical id: the code is unique per tenant, immutable, and it is the value clients already have from statuses. No delete, as in the original proposal. Of course this could be discussed and changed to id eventually.

    3. Filtering by severity (not decided yet)

    We haven't decided yet whether and how to support lastStatusCode.severity==ERROR. We will test against a bigger, production-sized database first and decide based on the results. The main concern:

    • Performance. sp_action.last_action_status_code has no index. Tenant-wide filtering on it, including today's lastStatusCode==X and ranges like lastStatusCode=ge=200;lastStatusCode=le=299, together with the count query needed for paging, means a scan over all actions of the tenant. Adding an index to sp_action in a Flyway migration blocks writes on PostgreSQL during the build (plain CREATE INDEX), which is not acceptable for large installations.

    4. Severity values

    Severity is aligned with logging levels:

    TRACE, DEBUG, INFO, WARN, ERROR
    

    5. Configurable status codes for server-reported statuses

    To make server-side transitions visible in the same way as device-reported codes, we propose optional tenant configuration keys that define the code the server uses when it writes a status itself:

    Tenant config key (proposal) Applied when
    action.status.code.auto-confirmation the action is auto-confirmed (RUNNING)
    action.status.code.wait-for-confirmation the action is created waiting for confirmation (WAIT_FOR_CONFIRMATION)
    action.status.code.canceling the server requests cancellation (manual cancel, replaced by a new assignment, rollout cancel)
    action.status.code.canceled the server closes the action directly (force quit, auto-close of obsolete actions, rollout stop)

    Behaviour:

    • Not defined (default): exactly as today, no code is written.
    • Defined: the code is set on the server-generated action status and updates Action.lastStatusCode, like a device-reported code.
    • Operators can document these codes in the catalogue like any other code. They should pick values that do not collide with codes reported by their devices.

    Open questions:

    • Should a server-reported code overwrite the device's last code in lastStatusCode? With the semantics "last status code" it should, but it hides the device's last reported code (still visible in the status history).
    • Do we need separate keys per cancel cause (manual cancel vs. assignment override vs. rollout), or is one key per status enough?
  3. strailov commented on Nov 3, 2026

    @strailov
    Contributor

    After short discussion agreed on the following things :

    1. Skip auto-provisioning with slight changes from the suggested approach above
      • GET /rest/v1/action-status-codes should be responsible to fill the catalog with undocumented status codes if flag (like undocumented=true) is set and do not fill the catalog and return only the ones present in it without that flag.
      • Remove GET /rest/v1/action-status-codes/undocumented as obsolete
    2. Use technical id instead of proposed code. Hence the API will look something like :
      • GET /rest/v1/action-status-codes: paged list of status codes, RSQL q on code, name, severity and undocumented.
        • Documented codes are the catalogue entries (undocumented: false).
        • Undocumented codes are codes reported in action statuses that have no catalogue entry yet (undocumented: true). They carry only the code: no id, name,
          description or severity.
        • q=undocumented==true lists what is left to document, q=undocumented==false lists only the catalogue.
      • GET /rest/v1/action-status-codes/{id}
      • POST /rest/v1/action-status-codes documents a code (also one that is currently listed as undocumented).
      • PUT /rest/v1/action-status-codes/{id} updates name, description and severity. code is immutable.
  4. avgustinmm commented on Nov 3, 2026

    @avgustinmm
    Contributor

    GET /rest/v1/action-status-codes must NOT fill catalog - GET methods are read-only and modifying anything (even implicitly) contradicts with GET semantic. I don't see any point in having undocumented into the catalog. The API for retrieval is sufficient.

    personally I like more the previous variant with explicit /undocumented REST API

  5. strailov commented on Nov 3, 2026

    @strailov
    Contributor

    Well I guess nothing stops us to put analogical PUT/POST which does both - updates the catalog & retrieves all the codes from it ?
    Leaving the current GET to only retrieve what's in the catalog - like undocumented=true/false suggested behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions