You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(graph): Gap 6 — confidence + reason on WorkflowEdge
Every edge in the workflow graph now carries two optional fields:
* ``confidence: float | None`` (range-checked 0.0–1.0 via pydantic)
* ``reason: str | None`` — short provenance tag
The detail-panel renders a percent chip + reason tag for heuristic
edges (calls / imports / unresolved) so a viewer can tell a resolved
import from a same-name guess at a glance. Structural defaults
("100% direct-ast") are suppressed — they'd just be noise on every
defined_in edge.
Producer plumbing
* ``workflow_graph_source_ast._run_edge`` fetches AP's
``r.confidence`` + ``r.resolution_method`` via Cypher, gated by a
new ``has_provenance: bool`` arg so HasMethod_* tables (no
confidence column) don't trigger Kuzu's Binder exception.
* AP quotes ``resolution_method`` as a literal string in
resolver.rs:183 (``format!("'{method}'")``), so we strip the
quote chars at the infrastructure boundary.
Convention-based defaults (one source of truth)
``core.workflow_graph_schema.edge_provenance_defaults(kind,
ap_confidence=None, ap_reason=None)`` is the single place that
maps an edge kind to its default (confidence, reason) pair:
* ``defined_in`` / ``member_of`` → (1.0, "direct-ast")
* ``about_entity`` → (1.0, "memory-entities-link")
* ``calls`` / ``imports`` → AP-supplied values or (None, None)
Four ingest sites (``ingest_symbol``, ``ingest_ast_edge``,
``ingest_about_entity``, and the parallel inline L6 path in
``http_standalone_graph``) all call the helper, eliminating the DRY
violation the audit flagged.
Tests
15 new unit tests in ``tests_py/core/test_workflow_edge_confidence.py``:
* Schema round-trip and pydantic range check (raises on 1.5 / -0.3).
* ``edge_provenance_defaults`` — structural defaults, heuristic
pass-through, empty-string reason normalises to None (cross-path
parity), AP confidence of 0.0 is preserved (not treated as
missing).
* Ingestor tagging — defined_in / member_of / calls paths.
* Validate-graph tolerance of mixed-confidence edges.
Existing 1902 tests unchanged → 1910 passing total.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments