fix: make drawer_id deterministic for idempotent writes
Remove datetime.now() from drawer_id hash so same content + wing + room always produces the same ID. This enables the idempotency check that returns "already_exists" on duplicate writes.
This commit is contained in:
@@ -330,7 +330,7 @@ def tool_add_drawer(
|
|||||||
if not col:
|
if not col:
|
||||||
return _no_palace()
|
return _no_palace()
|
||||||
|
|
||||||
drawer_id = f"drawer_{wing}_{room}_{hashlib.sha256((content[:100] + datetime.now().isoformat()).encode()).hexdigest()[:24]}"
|
drawer_id = f"drawer_{wing}_{room}_{hashlib.sha256((wing + room + content[:100]).encode()).hexdigest()[:24]}"
|
||||||
|
|
||||||
_wal_log(
|
_wal_log(
|
||||||
"add_drawer",
|
"add_drawer",
|
||||||
|
|||||||
Reference in New Issue
Block a user