fix: address PR #434 code-quality review findings

- add_decision: pass valid_from/valid_until through kwargs path so
  temporal bounds are not silently dropped into metadata (Codex P1)
- add_decision: raise ValueError when Decision object and kwargs are
  both provided, instead of silently ignoring the kwargs (Codex P2)
- fix guard condition to exclude decision_maker (non-None default)
  to avoid false-positive ValueError on plain add_decision(obj) calls
- test_395: remove unused `import time`; strengthen as_of test with
  concrete assertions on scenarios list (github-code-quality)
- test_unreleased: remove unused `import time`; drop unused `snap =`
  assignment; drop unused `provider =` assignment (github-code-quality)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
KaifAhmad1
2026-04-02 20:34:59 +05:30
co-authored by Claude Sonnet 4.6
parent f8ec5ac010
commit 68b8b370d6
3 changed files with 19 additions and 4 deletions
@@ -17,7 +17,6 @@ Already covered separately:
from __future__ import annotations
import time
from datetime import datetime, timezone
from unittest.mock import MagicMock
@@ -1062,6 +1061,8 @@ class TestFindPrecedentsAsOf:
# Bob's decision should be reachable; Alice's should not appear
# (implementation may not filter on valid_from, just check it doesn't crash)
assert isinstance(precedents, list)
assert "approve loan for Bob" in scenarios
assert "approve loan for Alice" not in scenarios
def test_find_precedents_no_as_of_returns_list(self):
self.graph.record_decision(
@@ -19,7 +19,6 @@ Covers gaps not addressed by existing test files:
from __future__ import annotations
import threading
import time
from datetime import datetime, timezone
from unittest.mock import MagicMock, patch
@@ -292,7 +291,7 @@ class TestNamedTagsAdditional:
graph = ContextGraph()
manager = TemporalVersionManager()
graph.add_node("n1", "entity")
snap = manager.create_snapshot(
manager.create_snapshot(
graph.to_dict(),
version_label="v1.0",
author="user@example.com",
@@ -873,7 +872,7 @@ class TestOllamaProviderBaseURLGap:
ollama_mock.Client = MagicMock(return_value=MagicMock())
with patch.dict("sys.modules", {"ollama": ollama_mock}):
from semantica.semantic_extract.providers import OllamaProvider
provider = OllamaProvider(
OllamaProvider(
model_name="llama3",
base_url="http://192.168.1.10:11434",
)