graphite-code 1.8.0__py3-none-any.whl → 1.8.2__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 +1 -1
- graphite/doctor_probes.py +66 -3
- {graphite_code-1.8.0.dist-info → graphite_code-1.8.2.dist-info}/METADATA +1 -1
- {graphite_code-1.8.0.dist-info → graphite_code-1.8.2.dist-info}/RECORD +7 -7
- {graphite_code-1.8.0.dist-info → graphite_code-1.8.2.dist-info}/WHEEL +0 -0
- {graphite_code-1.8.0.dist-info → graphite_code-1.8.2.dist-info}/entry_points.txt +0 -0
- {graphite_code-1.8.0.dist-info → graphite_code-1.8.2.dist-info}/licenses/LICENSE +0 -0
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.8.
|
|
41
|
+
__version__ = "1.8.2"
|
graphite/doctor_probes.py
CHANGED
|
@@ -71,6 +71,35 @@ _TYPESCRIPT_SCRIPT = (
|
|
|
71
71
|
"process.exit(4)}"
|
|
72
72
|
"process.stdout.write(JSON.stringify({detected:true}));"
|
|
73
73
|
)
|
|
74
|
+
#: The identity rule, shared by the parent and by BOTH child bootstraps.
|
|
75
|
+
#:
|
|
76
|
+
#: A DIRECTORY's size and times are not its identity. A directory's size is
|
|
77
|
+
#: its entry count and its times move whenever a child is created or removed.
|
|
78
|
+
#: For a repository root that is routine rather than an attack -- a coverage
|
|
79
|
+
#: run writing its own bookkeeping files into the checkout is enough -- so
|
|
80
|
+
#: refusing on it turns a harmless concurrent write into a refusal to probe.
|
|
81
|
+
#: The inode IS a directory's identity: the same object, or a different one.
|
|
82
|
+
#:
|
|
83
|
+
#: A FILE keeps every field. A file's size and mtime ARE its content, and they
|
|
84
|
+
#: are what says the content did not change under us. The old rule also got
|
|
85
|
+
#: this backwards for directories: an in-place edit to a file inside a
|
|
86
|
+
#: directory does NOT move the directory's times, so the directory check never
|
|
87
|
+
#: saw it, while a benign create or delete always moved them. What the
|
|
88
|
+
#: directory check could reliably express is WHICH directory it is, and that is
|
|
89
|
+
#: what it now says.
|
|
90
|
+
#:
|
|
91
|
+
#: The bootstraps run isolated (`-I -S`) and cannot import this module, so
|
|
92
|
+
#: they carry this text rather than calling it. Splicing the SAME constant
|
|
93
|
+
#: into both keeps the two children from drifting apart, and a test pins that
|
|
94
|
+
#: their copies agree with the parent's.
|
|
95
|
+
_MCP_IDENTITY_MATCHER = '''
|
|
96
|
+
def identity_matches(stat, identity, require_directory):
|
|
97
|
+
"""Whether `stat` is still the object `identity` recorded."""
|
|
98
|
+
if require_directory:
|
|
99
|
+
return [stat.st_dev, stat.st_ino] == identity[:2]
|
|
100
|
+
return [stat.st_dev, stat.st_ino, stat.st_size, stat.st_mtime_ns] == identity
|
|
101
|
+
'''
|
|
102
|
+
|
|
74
103
|
_MCP_MANIFEST_BUILDER_BOOTSTRAP = """\
|
|
75
104
|
import os
|
|
76
105
|
import json
|
|
@@ -79,6 +108,7 @@ import sys
|
|
|
79
108
|
from importlib.machinery import PathFinder
|
|
80
109
|
|
|
81
110
|
sys.excepthook = lambda *_: os._exit(70)
|
|
111
|
+
""" + _MCP_IDENTITY_MATCHER + """\
|
|
82
112
|
def validate_binding(raw, require_directory):
|
|
83
113
|
if not isinstance(raw, dict) or set(raw) != {"canonical", "identity", "lexical"}:
|
|
84
114
|
raise SystemExit(70)
|
|
@@ -98,7 +128,7 @@ def validate_binding(raw, require_directory):
|
|
|
98
128
|
if lexical.resolve(strict=True) != canonical or canonical.resolve(strict=True) != canonical:
|
|
99
129
|
raise SystemExit(70)
|
|
100
130
|
stat = canonical.stat()
|
|
101
|
-
if
|
|
131
|
+
if not identity_matches(stat, identity, require_directory):
|
|
102
132
|
raise SystemExit(70)
|
|
103
133
|
if canonical.is_dir() != require_directory:
|
|
104
134
|
raise SystemExit(70)
|
|
@@ -272,6 +302,7 @@ from importlib import metadata
|
|
|
272
302
|
from importlib.machinery import PathFinder
|
|
273
303
|
|
|
274
304
|
sys.excepthook = lambda *_: os._exit(70)
|
|
305
|
+
""" + _MCP_IDENTITY_MATCHER + """
|
|
275
306
|
def overlaps_selected(path):
|
|
276
307
|
try:
|
|
277
308
|
path.relative_to(selected)
|
|
@@ -303,7 +334,7 @@ def validate_binding(raw, require_directory, reject_selected=True):
|
|
|
303
334
|
if resolved != canonical or canonical.resolve(strict=True) != canonical:
|
|
304
335
|
raise SystemExit(70)
|
|
305
336
|
stat = canonical.stat()
|
|
306
|
-
if
|
|
337
|
+
if not identity_matches(stat, identity, require_directory):
|
|
307
338
|
raise SystemExit(70)
|
|
308
339
|
if require_directory != canonical.is_dir() or (reject_selected and overlaps_selected(canonical)):
|
|
309
340
|
raise SystemExit(70)
|
|
@@ -941,9 +972,41 @@ def _path_is_within(path: Path, root: Path) -> bool:
|
|
|
941
972
|
return False
|
|
942
973
|
|
|
943
974
|
|
|
975
|
+
def _identity_matches(
|
|
976
|
+
stat: os.stat_result,
|
|
977
|
+
identity: list[object],
|
|
978
|
+
*,
|
|
979
|
+
require_directory: bool,
|
|
980
|
+
) -> bool:
|
|
981
|
+
"""Whether `stat` is still the object `identity` recorded.
|
|
982
|
+
|
|
983
|
+
A DIRECTORY's size and times are not its identity: a directory's size is
|
|
984
|
+
its entry count and its times move whenever a child is created or
|
|
985
|
+
removed. For a repository root that is routine rather than an attack --
|
|
986
|
+
a coverage run writing its own bookkeeping files into the checkout is
|
|
987
|
+
enough -- so refusing on it turns a harmless concurrent write into a
|
|
988
|
+
refusal to probe. The inode IS a directory's identity: the same object,
|
|
989
|
+
or a different one.
|
|
990
|
+
|
|
991
|
+
A FILE keeps every field: a file's size and mtime ARE its content, and
|
|
992
|
+
they are what says the content did not change under us.
|
|
993
|
+
|
|
994
|
+
The two child bootstraps apply the same rule. They carry their own copy
|
|
995
|
+
(``_MCP_IDENTITY_MATCHER``) because they run isolated and cannot import
|
|
996
|
+
this module; a test pins that the copies agree.
|
|
997
|
+
"""
|
|
998
|
+
if require_directory:
|
|
999
|
+
return [stat.st_dev, stat.st_ino] == identity[:2]
|
|
1000
|
+
return [stat.st_dev, stat.st_ino, stat.st_size, stat.st_mtime_ns] == identity
|
|
1001
|
+
|
|
1002
|
+
|
|
944
1003
|
def _path_binding(path: Path, *, require_directory: bool) -> dict[str, object]:
|
|
945
1004
|
# Best-effort race detection only: same-user replacement after the final
|
|
946
1005
|
# check remains an operating-system trust boundary, not a complete TOCTOU fix.
|
|
1006
|
+
#
|
|
1007
|
+
# The recorded identity keeps all four fields for every kind of path. For a
|
|
1008
|
+
# DIRECTORY the last two are a record of what was observed, not what is
|
|
1009
|
+
# compared -- see `_identity_matches`.
|
|
947
1010
|
lexical = Path(os.path.abspath(path))
|
|
948
1011
|
canonical = lexical.resolve(strict=True)
|
|
949
1012
|
if canonical.is_dir() != require_directory:
|
|
@@ -981,7 +1044,7 @@ def _validate_path_binding(
|
|
|
981
1044
|
if lexical.resolve(strict=True) != canonical or canonical.resolve(strict=True) != canonical:
|
|
982
1045
|
raise ValueError
|
|
983
1046
|
stat = canonical.stat()
|
|
984
|
-
if
|
|
1047
|
+
if not _identity_matches(stat, identity, require_directory=require_directory):
|
|
985
1048
|
raise ValueError
|
|
986
1049
|
if canonical.is_dir() != require_directory:
|
|
987
1050
|
raise ValueError
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: graphite-code
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.2
|
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
graphite/__init__.py,sha256=
|
|
1
|
+
graphite/__init__.py,sha256=yFVfDAknH4Qw5mLU4UT9fdViz7Y752yfgC3Cgh3zMqA,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
|
|
@@ -22,7 +22,7 @@ graphite/debt.py,sha256=mvxoFrICwbWP19YKlf1cZIPFg8qIf7Jgyr9kIweVBbE,4664
|
|
|
22
22
|
graphite/dependency_install.py,sha256=JpuIGFzGfZZYDA-ymnBVDiG3t-brpDZ4rwF99HxY7nQ,60103
|
|
23
23
|
graphite/detach.py,sha256=BlUjeh_UcjpQ9DMRZFOgxhk83zUbMSTPmXe6t1FFEKE,1270
|
|
24
24
|
graphite/doctor.py,sha256=CknFB3EeBiiWbQc9IePBDuQWf6foMbI9Bbq871SNxvg,35249
|
|
25
|
-
graphite/doctor_probes.py,sha256=
|
|
25
|
+
graphite/doctor_probes.py,sha256=x2WgaQfUwT0cXspKXWqmrWdQ6-3NtUB0au27XED4z2M,92885
|
|
26
26
|
graphite/engine_identity.py,sha256=hZYA9fBsg2fj_61Rtkc84XzJrdsa2MaDFOLZJV4I7eE,8951
|
|
27
27
|
graphite/freshness.py,sha256=zBREb_Llvh1Rq2Dairjrh_yCkEy-WRSh2xv5JWYvOgQ,6557
|
|
28
28
|
graphite/git.py,sha256=3dWIVVBkEKK8IPIYx_vfAL6E6Syk26RSv_LONUQ7FpI,16047
|
|
@@ -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.8.
|
|
117
|
-
graphite_code-1.8.
|
|
118
|
-
graphite_code-1.8.
|
|
119
|
-
graphite_code-1.8.
|
|
120
|
-
graphite_code-1.8.
|
|
116
|
+
graphite_code-1.8.2.dist-info/METADATA,sha256=c_EXphDQPbhwa8n3VNbmx2bnh89QvUpfZyBLMvSnqHQ,48525
|
|
117
|
+
graphite_code-1.8.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
118
|
+
graphite_code-1.8.2.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
|
|
119
|
+
graphite_code-1.8.2.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
|
|
120
|
+
graphite_code-1.8.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|