mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-10 03:41:52 +02:00
Import already had this: `comparable()` in import.rs, added last week, strips identity fields off a model so a re-import can tell a change from a conflict. Request versioning arrived with its own copy of the same idea. Now both call `yaak_models::content`, which owns the mechanism and — more usefully — the reasoning. Two things had no single home before: why identity fields can never count as content, and why hashing has to sort object keys itself rather than trusting `serde_json::Map` to be a `BTreeMap` (`preserve_order` is on in some builds of this workspace and off in others). The key lists stay separate on purpose, as IDENTITY_KEYS and PLACEMENT_KEYS. Import counts a move as a change, because equality there means "same content in the same place"; versioning must not, or dragging a request around the sidebar would mint versions nobody asked for. A test on each side pins that difference, since the obvious next refactor is to collapse the two lists into one and neither behaviour would fail loudly if you did. Directory sync deliberately keeps its own Sha1 and is not folded in. It checksums the bytes of a file to notice someone edited it on disk, so it has to reflect formatting and key order — the exact things this module discards.