graphite-code 1.6.0__py3-none-any.whl → 1.7.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.
graphite/__init__.py CHANGED
@@ -38,4 +38,4 @@ __all__ = ["__version__"]
38
38
  #: Coarse and hand-maintained by construction. It is a release label, not
39
39
  #: evidence that a given fix is present -- to answer that, survey for the marker
40
40
  #: the fix introduced, or compare `graphite --version` fingerprints.
41
- __version__ = "1.6.0"
41
+ __version__ = "1.7.0"
graphite/cli.py CHANGED
@@ -783,6 +783,7 @@ def cmd_check(args: argparse.Namespace) -> int:
783
783
  if not args.json:
784
784
  raise ValueError(_below_a_root(root, top))
785
785
  status: dict[str, Any] = {
786
+ "schema_version": 1,
786
787
  "stale": True,
787
788
  "reason": "below_repository_root",
788
789
  "repository_root": top.as_posix() if trusted_root(top) else None,
@@ -799,6 +800,7 @@ def cmd_check(args: argparse.Namespace) -> int:
799
800
  cfg = _project_scoped_config(args, root, canonical=True)
800
801
  status = check_graph_freshness(root, cfg, ignore_engine=args.ignore_engine)
801
802
  if args.json:
803
+ status["schema_version"] = 1
802
804
  status["resolution_health"] = persisted_resolution(
803
805
  root,
804
806
  on_error=lambda exc: record_incident(
@@ -1288,7 +1290,7 @@ def cmd_validate(args: argparse.Namespace) -> int:
1288
1290
  return 1
1289
1291
  report = validate_graph_bundle(bundle)
1290
1292
  if args.json:
1291
- print(json.dumps(report, ensure_ascii=False, indent=2))
1293
+ print(json.dumps({"schema_version": 1, **report}, ensure_ascii=False, indent=2))
1292
1294
  else:
1293
1295
  if report["ok"]:
1294
1296
  print(
@@ -2048,7 +2050,7 @@ def cmd_daemon_health(args: argparse.Namespace) -> int:
2048
2050
  )
2049
2051
  report = evaluate_daemon_health(base, state_dir=state_dir, options=options)
2050
2052
  if args.json:
2051
- print(json.dumps(report, ensure_ascii=False, indent=2))
2053
+ print(json.dumps({"schema_version": 1, **report}, ensure_ascii=False, indent=2))
2052
2054
  else:
2053
2055
  print(format_health_text(report), end="")
2054
2056
  return 1 if args.fail_on_error and not report["ok"] else 0
graphite/daemon.py CHANGED
@@ -16,7 +16,6 @@ from . import activation, buildlock
16
16
  from .config import Config
17
17
  from .engine_identity import EngineIdentityError, engine_identity
18
18
  from .freshness import graph_engine_changed
19
- from .git import GitError
20
19
  from .incident_ledger import record_incident, repo_ledger_dir
21
20
  from .io import atomic_write_json
22
21
  from .provider_observer import ProviderObservationSummary
@@ -176,9 +175,17 @@ def _exception_identity(exc: BaseException) -> str:
176
175
  so no path and no Git text can ride along. Every other exception
177
176
  contributes its class name and nothing else -- the message may name a
178
177
  path, and the class is what separates the causes.
178
+
179
+ An exception that is not a `GitError` may still know its own identity:
180
+ anything offering `diagnostic()` is asked for it, on the same contract
181
+ -- fixed tokens, no path, no message text. `IngestEnumerationError` is
182
+ the second class that offers one, and it is what separates the ways
183
+ enumerating a repository can fail. Asking rather than isinstance-ing
184
+ keeps the daemon from having to know where the exception came from.
179
185
  """
180
- if isinstance(exc, GitError):
181
- return exc.diagnostic()
186
+ diagnostic = getattr(exc, "diagnostic", None)
187
+ if callable(diagnostic):
188
+ return str(diagnostic())
182
189
  return type(exc).__name__
183
190
 
184
191
 
graphite/ingest.py CHANGED
@@ -21,6 +21,28 @@ class IngestError(RuntimeError):
21
21
  """Raised when repository files cannot be enumerated safely."""
22
22
 
23
23
 
24
+ class IngestEnumerationError(RuntimeError):
25
+ """Which way enumerating a repository failed, in one path-free word.
26
+
27
+ `IngestError` says WHAT failed and not WHY, and every enumeration
28
+ failure raises the same message, so a daemon that could not snapshot a
29
+ repository logged "IngestError" and could not say which failure it was
30
+ -- the same loss #113 fixed for Git's exit status. This is the CAUSE
31
+ those sites now raise, and it carries the reason.
32
+
33
+ The reason is a fixed token, never a path and never Git's own text, so
34
+ the chain the daemon logs stays path-free.
35
+ """
36
+
37
+ def __init__(self, reason: str) -> None:
38
+ super().__init__(reason)
39
+ self.reason = reason
40
+
41
+ def diagnostic(self) -> str:
42
+ """Path-free identity: the class and the reason, nothing else."""
43
+ return f"{type(self).__name__}:{self.reason}"
44
+
45
+
24
46
  @dataclass(frozen=True)
25
47
  class FileEntry:
26
48
  rel_path: str # posix-style relative path
@@ -248,7 +270,9 @@ def _git_ls_files(
248
270
  enclosing = enclosing_git_root(root)
249
271
  if enclosing != root:
250
272
  if enclosing is not None:
251
- raise IngestError("nested Git roots are unsupported")
273
+ raise IngestError("nested Git roots are unsupported") from (
274
+ IngestEnumerationError("nested_git_root")
275
+ )
252
276
  return None
253
277
  try:
254
278
  result = GitRunner(root).run(
@@ -271,7 +295,9 @@ def _git_ls_files(
271
295
  if not output:
272
296
  return []
273
297
  if not output.endswith("\x00"):
274
- raise IngestError("unable to enumerate Git repository safely")
298
+ raise IngestError("unable to enumerate Git repository safely") from (
299
+ IngestEnumerationError("output_not_nul_terminated")
300
+ )
275
301
 
276
302
  selected: list[str] = []
277
303
  start = 0
@@ -281,13 +307,24 @@ def _git_ls_files(
281
307
  ):
282
308
  end = output.find("\x00", start)
283
309
  if end < 0:
284
- raise IngestError("unable to enumerate Git repository safely")
310
+ # Unreachable while the invariant above holds: the output ends
311
+ # with NUL, and the loop only runs while `start` is inside it,
312
+ # so there is always a NUL at or after `start`. Kept, because
313
+ # the invariant is a property of the parser and not of the
314
+ # caller.
315
+ raise IngestError("unable to enumerate Git repository safely") from (
316
+ IngestEnumerationError("record_not_nul_terminated")
317
+ )
285
318
  record_count += 1
286
319
  if record_count > MAX_GIT_FILE_RECORDS:
287
- raise IngestError("unable to enumerate Git repository safely")
320
+ raise IngestError("unable to enumerate Git repository safely") from (
321
+ IngestEnumerationError("too_many_records")
322
+ )
288
323
  normalized = _normalize_git_path(root, output[start:end])
289
324
  if normalized is None:
290
- raise IngestError("unable to enumerate Git repository safely")
325
+ raise IngestError("unable to enumerate Git repository safely") from (
326
+ IngestEnumerationError("path_not_contained")
327
+ )
291
328
  if is_eligible is None or is_eligible(normalized):
292
329
  selected.append(normalized)
293
330
  start = end + 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Local-first, zero-LLM knowledge graph extraction for codebases.
5
5
  Project-URL: Homepage, https://github.com/jared0565/graphite
6
6
  Project-URL: Repository, https://github.com/jared0565/graphite
@@ -49,7 +49,7 @@ Description-Content-Type: text/markdown
49
49
 
50
50
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
51
51
 
52
- **Status: 1.6.0, production/stable.** Published on PyPI as
52
+ **Status: 1.7.0, production/stable.** Published on PyPI as
53
53
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
54
54
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
55
55
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -1,4 +1,4 @@
1
- graphite/__init__.py,sha256=SLrW9H5yRx2K-eZi3AcyjaqaE17IeOfuMuEVHZdz1dg,2181
1
+ graphite/__init__.py,sha256=h7w8E5zcEDstaoiLb4ApnaHeJFStv6Lv_6yWi__sJ2E,2181
2
2
  graphite/__main__.py,sha256=Bp5bcXE6M0AnuNW1LjOXOEvGG5r0fXZoeRb_k5Yxphs,149
3
3
  graphite/_cleanup_worker.py,sha256=oIXOPa1jHVP8ePRSwn27nZEHOAc4DSBrjeH2Ds9wuq8,19619
4
4
  graphite/_win32_ctypes.py,sha256=YLH4kpKjL7zUUOs9E8C-Kjdy45PJBd6eRUeKwiKdSV4,1476
@@ -11,11 +11,11 @@ graphite/bootstrap.py,sha256=OPDzN9jSr8IE1N7xOnVKk3FgO2UqBTOUNcNV-pZAsus,8448
11
11
  graphite/buildlock.py,sha256=QXo4cnGGCmhxuuYdy6f5OHF82Yg6zHUMxLVdxwG49ic,5393
12
12
  graphite/cache.py,sha256=Mh28dYg9irXBvH-oa8jpFSM-ehXcs5FuNVHVzF_WRA8,9143
13
13
  graphite/channel.py,sha256=UNFAGuws6XFbkBu0fnVLepBDxT1BWAJlW33IPVlDi9M,72908
14
- graphite/cli.py,sha256=qadvl3RNIGL5tyDdO6IXo-j9cdaBQHwoegVHKrN6eoU,162367
14
+ graphite/cli.py,sha256=2I97jYhTwfZZ7X7BSK6G4KRKqD8Mc8m21Zgri2NqDA4,162487
15
15
  graphite/cluster.py,sha256=j5dFT40DD7scD4h8d7XJoAGQIcJKpsKsrFceiJkOuzw,4066
16
16
  graphite/config.py,sha256=ZWhWOWYEyKGoHCp6vWI4M4NQM57ohf5BaX0Ty8HfWYM,9267
17
17
  graphite/context.py,sha256=vWMuFxqDGby-9Gs_t9XNJzKR-nZqwMdbU2y6N_GypWU,13215
18
- graphite/daemon.py,sha256=1HqFDikebA1Dd34GaZdQZv4ng_MIl1bXDOqGXkdgtZs,35598
18
+ graphite/daemon.py,sha256=HX-Txkb3ov6b7IIVKukWY4iswEae2rbMCsIAn1OvoRM,36061
19
19
  graphite/daemon_health.py,sha256=cdBUGOsK6rdu2lk3kavH9e66_SsWL2GDtqYpVpvrT2s,34299
20
20
  graphite/daemon_launch.py,sha256=d6VhJVARdhBSdGWPHxKgveDisX5JWHlDJeV6tjLJWKw,2329
21
21
  graphite/debt.py,sha256=mvxoFrICwbWP19YKlf1cZIPFg8qIf7Jgyr9kIweVBbE,4664
@@ -33,7 +33,7 @@ graphite/hook_entry.py,sha256=0lfCZB9-B_9QBKagLhV_VIMVFcrOeAwpLcFXUjhMMpg,2655
33
33
  graphite/hookinstall.py,sha256=7qfboCBjP7DAeugbXXjZDDg-0aP7GJc_WhqxgJsOlV4,10215
34
34
  graphite/hookshim.py,sha256=4to9xkNOWPjbk1Es97KTTknjJM9gdHkbEDjCQq8ntec,3771
35
35
  graphite/incident_ledger.py,sha256=wHW-P_PJNollM_L9bAXHaxFeLb89wMXs7XX0VrH7aSw,8654
36
- graphite/ingest.py,sha256=zoLz_bm-LcPnIFIV618I9c6kkH3a4hcMUQ2lZqsC9-k,12296
36
+ graphite/ingest.py,sha256=FG4YNRTds7GFypV8HgT_DOlTzw4zoVw2aaKwGPrSxX0,13892
37
37
  graphite/init.py,sha256=yoCyQ83UJ7Nb_suq_HUAVOwPhHbqpWfKtfD4P3n_LPE,41322
38
38
  graphite/io.py,sha256=YBXfMcPsv1Lzun8ByW4BQlfgMm54akckLFrUhwWtleI,2996
39
39
  graphite/launchd_agent.py,sha256=rmKhhCbB-9FDU_3A1b2OlZxKpxZqdgtYnLbzkFMs_rI,4529
@@ -113,8 +113,8 @@ graphite/routing/zai_edit.py,sha256=Kra2tI9GkntQAhV1vNHlFlp4sY-ksq2-bY4N9fEfLEc,
113
113
  graphite/routing/zai_executor.py,sha256=cHUl7DbWRUhYg9Lwm3OiP6H3dI70y_b8iAWCyfgOPi0,6636
114
114
  graphite/routing/zai_probe.py,sha256=HL2vM8s2J4-n8Bp3l7QLpWLEk-PhZrt_rLc2cY65hvU,4771
115
115
  graphite/ts_resolver.mjs,sha256=wiKDWkJIC9__3wL49ty4W8hRc5biisNNtFhH1aFA47A,10822
116
- graphite_code-1.6.0.dist-info/METADATA,sha256=Cd41UxGEVydfLhACVT2inMXPyix5nFzAf-xk4vdY9IY,48525
117
- graphite_code-1.6.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
118
- graphite_code-1.6.0.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
- graphite_code-1.6.0.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
- graphite_code-1.6.0.dist-info/RECORD,,
116
+ graphite_code-1.7.0.dist-info/METADATA,sha256=_YssabdvTH_ygGcoSIiAUxKdoftnKNb3009FdOGiSio,48525
117
+ graphite_code-1.7.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
118
+ graphite_code-1.7.0.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
+ graphite_code-1.7.0.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
+ graphite_code-1.7.0.dist-info/RECORD,,