mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-09-15 04:00:33 +00:00
Bugs fixed: - enrich.py: predict_links called predictor.predict_links() with wrong signature (graph_dict as graph_store, node_id as node_labels, top_n instead of top_k). Rewrote to iterate candidate nodes and call score_link(session.graph, src, candidate) directly. - enrich.py: detect_duplicates called session.get_nodes() synchronously in an async handler, blocking the event loop. Wrapped in to_thread(). - export_import.py: temp file was leaked on export exception. Now always cleaned up via try/finally. Moved `import os` to module level. - pyproject.toml: missing comma between two strings in the `all` extra caused a TOML syntax error breaking `pip install semantica[all]`. - app.py: generic Exception handler swallowed HTTPException(503) raised by get_session dependency. Now re-raises HTTPException explicitly. - decisions.py: compliance endpoint imported PolicyEngine then discarded it, always returning compliant=True. Replaced with in-graph check: scans for violates/non_compliant/breaches edges from the decision node. - app.py: removed unused `import traceback`. Refactor: - session.py: added build_graph_dict(node_ids=None) method to eliminate _build_graph_dict() duplication across graph.py, analytics.py, and export_import.py (three identical copies). - session.py: all 8 lazy analytics properties now initialise under _lock to prevent double-instantiation under concurrent requests. - graph.py: find_path now dispatches to dijkstra_shortest_path or bfs_shortest_path based on the `algorithm` query param (was always BFS). - annotations.py: removed unnecessary get_annotations() round-trip in create_annotation — add_annotation mutates ann_data in-place. - temporal.py: split bare `except Exception` into ImportError (silent) and Exception (logs warning), so real bugs are no longer hidden. Tests (49 total, all passing): - Added TestEnrichExtract, TestLinkPrediction, TestDedup classes. - Added test_compliance_with_violation to verify real violation detection. - Added test_snapshot_at_excludes_temporal_node, test_diff assertions, test_export_json_subset, test_import_with_edges, test_import_unsupported_format. - Strengthened analytics, search, and annotation assertions. - Reasoning test now asserts response shape when status is 200. Co-authored-by: ZohaibHassan16 <zohaibhassan16@users.noreply.github.com> Co-authored-by: KaifAhmad1 <kaifahmad1@users.noreply.github.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>