Fix typos in README and test files related to SYNC_BEHAVIOR documentation

This commit is contained in:
Jokob @NetAlertX
2026-05-26 07:51:09 +00:00
parent f8f7ac3827
commit 5ea999fd57
3 changed files with 14 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ The `SYNC_BEHAVIOR` setting — configured on the **hub only** — controls how
New devices are inserted using all available column values from the node's existing record (name, alert settings, vendor, etc.). If the device already exists on the hub, the INSERT is silently skipped.
Subsequent syncs update only empty/unknown fields on the hub (e.g., if the hub's `devName` is `(unknown)` and the node now has a resolved name, it propagates). Fields customized by a user on the hub (fileds with source set to `USER` or `LOCKED`) are never overwritten.
Subsequent syncs update only empty/unknown fields on the hub (e.g., if the hub's `devName` is `(unknown)` and the node now has a resolved name, it propagates). Fields customized by a user on the hub (fields with source set to `USER` or `LOCKED`) are never overwritten.
```
First sync: INSERT with node's full config

View File

@@ -272,9 +272,12 @@ def main():
# Subsequent node changes only update empty hub fields.
#
# carbon-copy — UPSERT all devices every sync.
# Node is authoritative; overwrites hub values except
# USER/LOCKED-sourced fields (enforced by the
# update_devices_data_from_scan pipeline, not here).
# Node is fully authoritative; raw SQL bypasses
# can_overwrite_field(), so ALL hub fields are
# overwritten on every sync, including USER/LOCKED-
# sourced fields. (update_devices_data_from_scan
# respects field locks but is not invoked here;
# see README "carbon-copy" for the contract.)
#
# hub-defaults — Skip direct INSERT entirely.
# Hub creates new devices via create_new_devices()

View File

@@ -572,7 +572,7 @@ class TestMode3JsonSkip:
# ===========================================================================
# SYNC_BEHAVIOR three hub device-write modes (Mode 3 RECEIVE)
# SYNC_BEHAVIOR - three hub device-write modes (Mode 3 - RECEIVE)
# ===========================================================================
class TestSyncBehavior:
@@ -775,4 +775,9 @@ class TestSyncBehavior:
assert row["eveIp"] == "10.0.0.1"
assert row["eveAdditionalInfo"] == "Acme"
assert row["evePendingAlertEmail"] == 1
assert cur.fetchone()["cnt"] == 0
# Confirm exactly one event was inserted (no duplicates).
cur.execute(
"SELECT COUNT(*) AS cnt FROM Events WHERE eveEventType='New Device' AND eveMac=?",
("aa:bb:cc:dd:ee:01",),
)
assert cur.fetchone()["cnt"] == 1