Added a new hybrid device type to POST /device. A hybrid device stores two kinds of data in one device: an immutable side for high-frequency, time-partitioned telemetry (subject to chunk_period and chunk_retention, append-only) and a mutable side for a small set of variables that support update and delete and are never dropped by retention.
Routing is controlled by a required per-device mutable_variable_regex. At insert time, each datum whose variable matches the regex is stored on the mutable side; everything else goes to the immutable side. Reads return both sides merged. The regex is an unanchored substring match (anchor with ^ or $ when needed).
Existing immutable and mutable devices can be converted to hybrid through POST /device/{deviceID}/convert. The device must be disabled and empty, the same rule as every conversion, and the request requires mutable_variable_regex, chunk_period, and chunk_retention. Converting away from hybrid is not supported.
Data import routes each CSV row by the device regex, exactly like live inserts: matching rows count toward the mutable limit; the rest must fit the chunk retention window.
Full-device export (POST /device/{deviceID}/data/backup) exports the mutable side; the immutable side is backed up per chunk via POST /device/{deviceID}/chunk/backup, unchanged.
POST /device/{deviceID}/empty accepts an optional {"route": "mutable" | "immutable"} body on hybrid devices to empty a single side; without it, the whole device is emptied as before.
The mutable_variable_regex can only be changed while the device is empty (0 data). On a device that already has data, the API rejects the change until the device is emptied.
The mutable_variable_regex rejects match-everything and match-nothing patterns (such as .*, .+, ^.*$, and ^$) at create and edit time. A hybrid device must genuinely split variables between its two sides; use a mutable or immutable device to store everything in one place.
Breaking Changes
None
Upgrade Notes
This release is additive. Existing immutable and mutable devices are unaffected, and no migration is required.
To create a hybrid device, send POST /device with type: "hybrid" and include name, network, connector, chunk_period, chunk_retention, and mutable_variable_regex. For example, mutable_variable_regex: "^mutable_" routes any variable starting with mutable_ to the mutable side and stores the rest on the immutable side.
To change the routing regex later, first empty the device data, then send the new mutable_variable_regex to PUT /device/{deviceID}.