omnect-os-init writes the factory-reset result into /run/omnect-device-service/omnect-os-initramfs.json. The current parser in src/twin/factory_reset.rs cannot read that format.
Mismatches
|
omnect-os-init writes |
ODS expects |
| JSON key |
"factory_reset" |
"factory-reset" |
status |
0..=4 (adds 4 = Warning, see omnect/omnect-os-init#19) |
Deserialize_repr enum with 0..=3 only — 4 fails to parse |
error |
omitted on success (skip_serializing_if) |
required String |
paths |
omitted when empty |
required Vec<String> |
data_wiped |
always present (bool) |
not in the struct (ignored by serde, ok) |
Effect
- Today: the key lookup
omnect_os_initramfs_json["factory-reset"] returns null, so ODS logs "no result" and reports nothing. The reset outcome never reaches the twin. No error is raised.
- After fixing only the key: a result with
status: 4 or a missing error/paths makes factory_reset_result() fail. FactoryReset::new()? propagates the error out of Twin::new, so ODS does not start.
Task
Adapt FactoryResetResult/FactoryResetStatus (and the testfiles) to the omnect-os-init contract:
- key
factory_reset
status value 4 (warning: reset succeeded, but a partition needed a second mkfs)
error, paths, context optional with defaults
- decide how to handle a future unknown status value without failing ODS startup
Contract source: src/runtime/omnect_device_service.rs in omnect/omnect-os-init and its integration tests (tests/factory_reset.rs).
omnect-os-init writes the factory-reset result into
/run/omnect-device-service/omnect-os-initramfs.json. The current parser insrc/twin/factory_reset.rscannot read that format.Mismatches
"factory_reset""factory-reset"status0..=4(adds4= Warning, see omnect/omnect-os-init#19)Deserialize_reprenum with0..=3only —4fails to parseerrorskip_serializing_if)StringpathsVec<String>data_wipedEffect
omnect_os_initramfs_json["factory-reset"]returns null, so ODS logs "no result" and reports nothing. The reset outcome never reaches the twin. No error is raised.status: 4or a missingerror/pathsmakesfactory_reset_result()fail.FactoryReset::new()?propagates the error out ofTwin::new, so ODS does not start.Task
Adapt
FactoryResetResult/FactoryResetStatus(and the testfiles) to the omnect-os-init contract:factory_resetstatusvalue4(warning: reset succeeded, but a partition needed a secondmkfs)error,paths,contextoptional with defaultsContract source:
src/runtime/omnect_device_service.rsin omnect/omnect-os-init and its integration tests (tests/factory_reset.rs).