Repository navigation
Description
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, RSQLqoncode,name,severity)GET /rest/v1/action-status-codes/{id}POST /rest/v1/action-status-codesPUT /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
MgmtActionStatusandMgmtActionexpose 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) showslastActionStatusCode==200, but the RSQL key islastStatusCode.Action.lastStatusCodeisn'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
strailov commentedon Oct 30, 2026
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:
Entity (new table
sp_action_status_code, tenant-aware, the usual audit fields):idcodenameDOWNLOAD_HASH_MISMATCHdescriptionseverityThe 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 onsp_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, RSQLqoncode,name,severity.GET /rest/v1/action-status-codes/{code}POST /rest/v1/action-status-codesdocuments 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 existingsp_action_status (tenant, code)index. Documenting a code means aPOSTto 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
coderather than by technicalid: 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 toideventually.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:sp_action.last_action_status_codehas no index. Tenant-wide filtering on it, including today'slastStatusCode==Xand ranges likelastStatusCode=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 tosp_actionin a Flyway migration blocks writes on PostgreSQL during the build (plainCREATE INDEX), which is not acceptable for large installations.4. Severity values
Severity is aligned with logging levels:
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:
action.status.code.auto-confirmationRUNNING)action.status.code.wait-for-confirmationWAIT_FOR_CONFIRMATION)action.status.code.cancelingaction.status.code.canceledBehaviour:
Action.lastStatusCode, like a device-reported code.Open questions:
lastStatusCode? With the semantics "last status code" it should, but it hides the device's last reported code (still visible in the status history).strailov commentedon Nov 3, 2026
After short discussion agreed on the following things :
GET /rest/v1/action-status-codesshould be responsible to fill the catalog with undocumented status codes if flag (likeundocumented=true) is set and do not fill the catalog and return only the ones present in it without that flag.GET /rest/v1/action-status-codes/undocumentedas obsoletecode. Hence the API will look something like :GET /rest/v1/action-status-codes: paged list of status codes, RSQLqoncode,name,severityandundocumented.undocumented: false).undocumented: true). They carry only thecode: noid, name,description or severity.
q=undocumented==truelists what is left to document,q=undocumented==falselists only the catalogue.GET /rest/v1/action-status-codes/{id}POST /rest/v1/action-status-codesdocuments a code (also one that is currently listed as undocumented).PUT /rest/v1/action-status-codes/{id}updates name, description and severity.codeis immutable.avgustinmm commentedon Nov 3, 2026
GET /rest/v1/action-status-codesmust 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
strailov commentedon Nov 3, 2026
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.