mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
* docs(cookbook): add Change Management module notebook Add cookbook/introduction/24_Change_Management.ipynb covering the change_management module with verified, executable examples: - ChangeLogEntry with email-validated author field - InMemoryVersionStorage save/get/list_all/exists/delete round trip - named tags (save_tag/get_tag) for release pinning - compute_checksum / verify_checksum integrity verification with tamper detection The change_management module currently has no cookbook coverage. All API calls and outputs were executed against semantica/change_management/change_log.py and version_storage.py. Signed-off-by: LeonSGP43 <LeonSGP43@users.noreply.github.com> * docs(cookbook): clarify outputs verified against repo source, not PyPI release Signed-off-by: LeonSGP43 <leonsgp43@users.noreply.github.com> * docs(cookbook): execute change management notebook in Jupyter (real kernel run, stream outputs, execution counts) Signed-off-by: LeonSGP43 <cine.dreamer.one@gmail.com> --------- Signed-off-by: LeonSGP43 <LeonSGP43@users.noreply.github.com> Signed-off-by: LeonSGP43 <leonsgp43@users.noreply.github.com> Signed-off-by: LeonSGP43 <cine.dreamer.one@gmail.com> Co-authored-by: LeonSGP43 <LeonSGP43@users.noreply.github.com>
8.6 KiB
8.6 KiB
In [1]:
!pip install -q semanticaIn [2]:
from semantica.change_management import ChangeLogEntry
entry = ChangeLogEntry(
timestamp="2026-08-15T09:00:00Z",
author="demo@example.com",
description="initial version",
)
entryOut [2]:
ChangeLogEntry(timestamp='2026-08-15T09:00:00Z', author='demo@example.com', description='initial version', change_id=None, related_changes=[])
In [3]:
from semantica.change_management import InMemoryVersionStorage, compute_checksum
storage = InMemoryVersionStorage()
snapshot = {
"label": "v1.0.0",
"data": {"entities": {"acme": {"type": "Company"}}},
"change_log": {
"timestamp": entry.timestamp,
"author": entry.author,
"description": entry.description,
},
}
snapshot["checksum"] = compute_checksum({k: v for k, v in snapshot.items() if k != "checksum"})
storage.save(snapshot)
storage.exists("v1.0.0")Out [3]:
True
In [4]:
storage.save_tag("release", "v1.0.0")
storage.get_tag("release"), [s["label"] for s in storage.list_all()]Out [4]:
('v1.0.0', ['v1.0.0'])In [5]:
from semantica.change_management import verify_checksum
stored = storage.get("v1.0.0")
print("intact:", verify_checksum(stored))
tampered = storage.get("v1.0.0")
tampered["data"]["entities"]["acme"]["note"] = "mutated after the fact"
print("tampered:", verify_checksum(tampered))intact: True tampered: False
In [6]:
storage.delete("v1.0.0")
storage.exists("v1.0.0")Out [6]:
False