From cf5eabb9647e6d53ec29a3f7de599a38dbfd5490 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Tue, 28 Jul 2026 18:09:57 -0500 Subject: Merge the two device state files and reduce mutation The registry (device names) and service-state (sync results) were two JSON files keyed the same way, split only for a TypeScript-compatibility that is moot now that the fabric identity cannot migrate between implementations. Merge them into one devices.json with a DeviceRecord per node, which also removes the parallel-map join in status and collapses the per-command load/store pairs. identity.json stays separate as a write-once secret. Also, from a reduction/immutability review: - Fix with_timeout passing a literal "{what}" instead of the error context - Drop needless mut: CompactDuration and parse_wall_clock become immutable expressions; run_status filters with a predicate instead of a mutator; sync_one extracts write_zone_and_dst; InspectOutcome gains Default plus a failed() constructor - Share a join_ids helper and a devices_path helper; add IdentityReport From; minor combinator tidy-ups 35 unit tests, clippy clean. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 5037d4c..0b33e60 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,9 @@ The same principles as the TypeScript implementation this replaces, plus the Rus connects retry three times with backoff, since an mDNS resolve answer can be lost per-attempt. - **Flat files, no database.** All state is plain files under `storagePath`: rs-matter's KV blobs (`matter/k_XXXX`, written atomically via temp+rename), `identity.json` (the root CA private key; - mode 0600), `nodes.json` (device registry), and `service-state.json` (per-node sync results). The - config and `service-state.json` are file-compatible with the TypeScript implementation. + mode 0600, written once and never touched by a sync), and `devices.json` (one record per + commissioned device: cached names plus latest sync results). The config is compatible with the + TypeScript implementation. - **Time is jiff end to end.** Timestamps are `jiff::Timestamp`; Matter-epoch microseconds exist only at the wire boundary. DST transitions come directly from the IANA tzdb transition table, never from offset probing. Time zones are IANA names, never fixed offsets. @@ -170,7 +171,7 @@ Then `sudo systemctl enable --now mattertimesync.timer` (2 minutes after boot, h ## Migrating from the TypeScript implementation -The config file and `service-state.json` carry over unchanged, but the **Matter fabric identity does +The config file carries over unchanged, but the **Matter fabric identity does not**: matter.js and rs-matter persist fabrics in different formats, and the device is paired to a key, not a storage path. Migration is one re-pairing: -- cgit v1.2.3