loomweave-plugin-python 1.4.0__py3-none-any.whl → 1.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  """loomweave-plugin-python — Python language plugin for Loomweave."""
2
2
 
3
- __version__ = "1.4.0"
3
+ __version__ = "1.6.0"
@@ -37,14 +37,92 @@ class UnresolvedCallSite(TypedDict):
37
37
  callee_expr: str
38
38
 
39
39
 
40
+ class FacetCoverageWire(TypedDict):
41
+ """Wire shape of one resolution facet's coverage claim (host contract)."""
42
+
43
+ status: Literal["complete", "degraded"]
44
+ reason: NotRequired[str]
45
+ transient: bool
46
+ collateral: bool
47
+
48
+
49
+ class ResolutionCoverageWire(TypedDict):
50
+ calls: FacetCoverageWire
51
+ references: FacetCoverageWire
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class FacetCoverage:
56
+ """How much of one resolution facet (calls / references) a file received.
57
+
58
+ The resolver degrades to EMPTY evidence -- not an error -- when pyright is
59
+ unavailable, times out, or has been poisoned for the rest of the run. The
60
+ host cannot tell that apart from a genuinely call-free file, so it treated
61
+ the empty result as a completed analysis and its incremental skip pinned
62
+ the hole for as long as the file's bytes stayed unchanged
63
+ (clarion-3e517d4aff). This claim rides every ``analyze_file`` result so the
64
+ host can re-dispatch a ``degraded`` + ``transient`` file next run and name
65
+ the hole on its read surface.
66
+
67
+ ``transient`` is True when re-running the unchanged file could plausibly
68
+ recover coverage (resolver timeout, crash, poison, unavailable binary) and
69
+ False for content-determined limits a re-run would hit again (syntax
70
+ error, per-file site cap, nesting too complex).
71
+
72
+ ``collateral`` (clarion-7fc41105ea, ADR-057) is decided by which catch-site
73
+ built the claim, never by message text. Self-inflicted (``False``) means
74
+ ONLY: ``pyright_timeout`` on this file's own budget, or
75
+ ``pyright_transport_failure`` -- pyright died while THIS file's request was
76
+ in flight (``pyright_local_read_error``, a read error on an unrelated
77
+ target while pyright stayed alive, is also this file's gap). Everything
78
+ else is collateral (``True``): ``pyright_restarting`` (found dead on
79
+ arrival), ``pyright_spawn_failed`` (deferred spawn), and the run-disabled
80
+ tokens ``pyright_unavailable`` / ``pyright_poisoned`` /
81
+ ``pyright_restart_cap_exceeded``. The full vocabulary is documented at the
82
+ top of ``pyright_session.py``.
83
+ """
84
+
85
+ status: Literal["complete", "degraded"] = "complete"
86
+ reason: str | None = None
87
+ transient: bool = False
88
+ # The hole predates this file (pyright already dead, spawn deferred, run
89
+ # disabled by an EARLIER file's failure): collateral, not this file's
90
+ # doing. The host dispatches collateral files first so the troublemaker
91
+ # goes last, and keeps a prior self-inflicted mark sticky across a
92
+ # collateral run.
93
+ collateral: bool = False
94
+
95
+ @classmethod
96
+ def degraded(cls, reason: str, *, transient: bool, collateral: bool = False) -> FacetCoverage:
97
+ return cls(status="degraded", reason=reason, transient=transient, collateral=collateral)
98
+
99
+ @property
100
+ def is_degraded(self) -> bool:
101
+ return self.status == "degraded"
102
+
103
+ def to_wire(self) -> FacetCoverageWire:
104
+ wire: FacetCoverageWire = {
105
+ "status": self.status,
106
+ "transient": self.transient,
107
+ "collateral": self.collateral,
108
+ }
109
+ if self.reason is not None:
110
+ wire["reason"] = self.reason
111
+ return wire
112
+
113
+
40
114
  @dataclass
41
115
  class CallResolutionResult:
42
116
  edges: list[CallsRawEdge] = field(default_factory=list)
43
117
  unresolved_call_sites_total: int = 0
118
+ # Bare unshadowed-builtin calls dropped before persistence; disclosed so
119
+ # the omission is visible in run stats (clarion-8a862d8f7e).
120
+ unresolved_call_sites_skipped_builtin_total: int = 0
44
121
  unresolved_call_sites: list[UnresolvedCallSite] = field(default_factory=list)
45
122
  pyright_query_latency_ms: list[int] = field(default_factory=list)
46
123
  pyright_index_parse_latency_ms: list[int] = field(default_factory=list)
47
124
  findings: list[Finding] = field(default_factory=list)
125
+ coverage: FacetCoverage = field(default_factory=FacetCoverage)
48
126
 
49
127
 
50
128
  class CallResolver(Protocol):