graphite-code 1.8.2__tar.gz → 1.9.1__tar.gz

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.
Files changed (338) hide show
  1. {graphite_code-1.8.2 → graphite_code-1.9.1}/CHANGELOG.md +92 -1
  2. {graphite_code-1.8.2 → graphite_code-1.9.1}/PKG-INFO +2 -2
  3. {graphite_code-1.8.2 → graphite_code-1.9.1}/README.md +1 -1
  4. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/__init__.py +1 -1
  5. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/agent_hooks.py +201 -11
  6. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/cli.py +64 -5
  7. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/engine_identity.py +110 -17
  8. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/freshness.py +28 -2
  9. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_agent_hooks.py +225 -0
  10. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cache_engine_identity.py +6 -2
  11. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_engine_identity.py +52 -10
  12. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_hardening.py +105 -0
  13. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_reliability.py +5 -0
  14. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_search.py +75 -0
  15. {graphite_code-1.8.2 → graphite_code-1.9.1}/.gitignore +0 -0
  16. {graphite_code-1.8.2 → graphite_code-1.9.1}/.mcp.json +0 -0
  17. {graphite_code-1.8.2 → graphite_code-1.9.1}/ARCHITECTURE.md +0 -0
  18. {graphite_code-1.8.2 → graphite_code-1.9.1}/CONTRIBUTING.md +0 -0
  19. {graphite_code-1.8.2 → graphite_code-1.9.1}/LICENSE +0 -0
  20. {graphite_code-1.8.2 → graphite_code-1.9.1}/RELEASING.md +0 -0
  21. {graphite_code-1.8.2 → graphite_code-1.9.1}/SECURITY.md +0 -0
  22. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/__init__.py +0 -0
  23. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/build_benchmark.py +0 -0
  24. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/realty_router/README.md +0 -0
  25. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/realty_router/__init__.py +0 -0
  26. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/realty_router/evaluate.py +0 -0
  27. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/realty_router/tasks.json +0 -0
  28. {graphite_code-1.8.2 → graphite_code-1.9.1}/benchmarks/synthetic_repo.py +0 -0
  29. {graphite_code-1.8.2 → graphite_code-1.9.1}/pyproject.toml +0 -0
  30. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/__init__.py +0 -0
  31. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/compare_dist.py +0 -0
  32. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/gen_cli_reference.py +0 -0
  33. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/mutation_tests.py +0 -0
  34. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/pyscopeoracle.py +0 -0
  35. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/sqloracle.py +0 -0
  36. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/verify_artifact.py +0 -0
  37. {graphite_code-1.8.2 → graphite_code-1.9.1}/scripts/verify_published_release.py +0 -0
  38. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/__main__.py +0 -0
  39. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/_cleanup_worker.py +0 -0
  40. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/_win32_ctypes.py +0 -0
  41. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/activation.py +0 -0
  42. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/agent_settings.py +0 -0
  43. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/analyze.py +0 -0
  44. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/answer_contract.py +0 -0
  45. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/bootstrap.py +0 -0
  46. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/buildlock.py +0 -0
  47. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/cache.py +0 -0
  48. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/channel.py +0 -0
  49. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/cluster.py +0 -0
  50. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/config.py +0 -0
  51. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/context.py +0 -0
  52. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/daemon.py +0 -0
  53. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/daemon_health.py +0 -0
  54. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/daemon_launch.py +0 -0
  55. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/debt.py +0 -0
  56. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/dependency_install.py +0 -0
  57. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/detach.py +0 -0
  58. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/doctor.py +0 -0
  59. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/doctor_probes.py +0 -0
  60. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/export/__init__.py +0 -0
  61. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/export/html.py +0 -0
  62. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/export/json.py +0 -0
  63. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/export/md.py +0 -0
  64. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/extract/__init__.py +0 -0
  65. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/extract/ast.py +0 -0
  66. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/extract/pyscope.py +0 -0
  67. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/git.py +0 -0
  68. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/graph.py +0 -0
  69. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/graph_io.py +0 -0
  70. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/health.py +0 -0
  71. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/hook_entry.py +0 -0
  72. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/hookinstall.py +0 -0
  73. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/hookshim.py +0 -0
  74. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/incident_ledger.py +0 -0
  75. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/ingest.py +0 -0
  76. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/init.py +0 -0
  77. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/io.py +0 -0
  78. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/launchd_agent.py +0 -0
  79. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/listing.py +0 -0
  80. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/llm.py +0 -0
  81. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/llm_probe.py +0 -0
  82. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/mcp.py +0 -0
  83. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/mcp_server.py +0 -0
  84. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/natural_query.py +0 -0
  85. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/overlays.py +0 -0
  86. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/ownership.py +0 -0
  87. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/probe_process.py +0 -0
  88. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/probe_workspace.py +0 -0
  89. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/process_contracts.py +0 -0
  90. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/programs.py +0 -0
  91. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/provider_observer.py +0 -0
  92. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/py.typed +0 -0
  93. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/query.py +0 -0
  94. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/query_plan.py +0 -0
  95. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/replacement_audit.py +0 -0
  96. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/resolve.py +0 -0
  97. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/review.py +0 -0
  98. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/__init__.py +0 -0
  99. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/approval.py +0 -0
  100. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/classifier.py +0 -0
  101. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/claude_executor.py +0 -0
  102. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/claude_probe.py +0 -0
  103. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/cli_identity.py +0 -0
  104. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/codex_executor.py +0 -0
  105. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/codex_probe.py +0 -0
  106. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/context_builder.py +0 -0
  107. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/contracts.py +0 -0
  108. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/diff_policy.py +0 -0
  109. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/edit_apply.py +0 -0
  110. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/effort.py +0 -0
  111. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/lifecycle.py +0 -0
  112. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_operator.py +0 -0
  113. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_service.py +0 -0
  114. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_storage.py +0 -0
  115. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/ollama_executor.py +0 -0
  116. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/ollama_probe.py +0 -0
  117. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/openrouter_executor.py +0 -0
  118. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/openrouter_probe.py +0 -0
  119. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/policy.py +0 -0
  120. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/probe_runner.py +0 -0
  121. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/process_runner.py +0 -0
  122. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/profiles.py +0 -0
  123. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/prompt.py +0 -0
  124. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/registry.py +0 -0
  125. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/route_pool.py +0 -0
  126. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/route_pool_execution.py +0 -0
  127. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/schema_validation.py +0 -0
  128. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/service.py +0 -0
  129. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/settings.py +0 -0
  130. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/shadow.py +0 -0
  131. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/storage.py +0 -0
  132. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/telemetry.py +0 -0
  133. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/worktree.py +0 -0
  134. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/zai_edit.py +0 -0
  135. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/zai_executor.py +0 -0
  136. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/routing/zai_probe.py +0 -0
  137. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/savings.py +0 -0
  138. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/systemd_unit.py +0 -0
  139. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/ts_bridge.py +0 -0
  140. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/ts_resolver.mjs +0 -0
  141. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/typescript_activation.py +0 -0
  142. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/usage_ledger.py +0 -0
  143. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/validation.py +0 -0
  144. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/watch.py +0 -0
  145. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/windows_job.py +0 -0
  146. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/windows_startup.py +0 -0
  147. {graphite_code-1.8.2 → graphite_code-1.9.1}/src/graphite/windows_task.py +0 -0
  148. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/conftest.py +0 -0
  149. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/data/sqloracle/blindspots.py.txt +0 -0
  150. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/data/sqloracle/round69.py.txt +0 -0
  151. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/fake_clis/fake_cli.py +0 -0
  152. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/fixtures/provider_lifecycle_schema_v1.sql +0 -0
  153. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v2_ca77600.sql +0 -0
  154. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v3_94eb333.sql +0 -0
  155. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v4_lifecycle_migration.sql +0 -0
  156. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test__win32_ctypes.py +0 -0
  157. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_activation.py +0 -0
  158. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_activation_backstop.py +0 -0
  159. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_agent_hook_activation.py +0 -0
  160. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_agent_hooks_session_books.py +0 -0
  161. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_agent_hooks_session_tagging.py +0 -0
  162. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_agent_settings.py +0 -0
  163. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_answer_contract.py +0 -0
  164. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_arrow_and_constructor_binding.py +0 -0
  165. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ast_make_id_length.py +0 -0
  166. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ast_name_a_module_only_imports.py +0 -0
  167. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ast_source_lines.py +0 -0
  168. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ast_super_over_a_builtin_base.py +0 -0
  169. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_atomic_write.py +0 -0
  170. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_bootstrap.py +0 -0
  171. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_build_detach.py +0 -0
  172. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_buildlock.py +0 -0
  173. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cache_entry_pruning.py +0 -0
  174. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cache_file_identity.py +0 -0
  175. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cache_file_set.py +0 -0
  176. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cache_pruning.py +0 -0
  177. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_call_graph.py +0 -0
  178. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_case_ambiguous_answer.py +0 -0
  179. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_attribution.py +0 -0
  180. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_cli.py +0 -0
  181. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_core.py +0 -0
  182. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_kind.py +0 -0
  183. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_lock.py +0 -0
  184. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_log_integrity.py +0 -0
  185. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_mcp.py +0 -0
  186. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_register.py +0 -0
  187. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_report.py +0 -0
  188. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_channel_status.py +0 -0
  189. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_class_field_arrow_binding.py +0 -0
  190. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_below_repository_root.py +0 -0
  191. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_build_missing_path.py +0 -0
  192. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_channel.py +0 -0
  193. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_channel_attribution.py +0 -0
  194. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_doctor_below_root.py +0 -0
  195. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_reference.py +0 -0
  196. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_usage.py +0 -0
  197. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cli_version.py +0 -0
  198. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cluster.py +0 -0
  199. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_compare_dist.py +0 -0
  200. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_configuration_reference.py +0 -0
  201. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_context.py +0 -0
  202. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_context_builder.py +0 -0
  203. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cwd_relative_config.py +0 -0
  204. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_cycle_search.py +0 -0
  205. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon.py +0 -0
  206. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_activation.py +0 -0
  207. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_build_lock.py +0 -0
  208. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_child_lock.py +0 -0
  209. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_engine_staleness.py +0 -0
  210. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_health.py +0 -0
  211. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_health_activation.py +0 -0
  212. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_launch.py +0 -0
  213. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_service_cli.py +0 -0
  214. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_daemon_snapshot_failure.py +0 -0
  215. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_debt.py +0 -0
  216. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_dependency_install.py +0 -0
  217. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_destructured_binding.py +0 -0
  218. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_determinism.py +0 -0
  219. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_dispatch_evidence.py +0 -0
  220. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_doctor.py +0 -0
  221. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_doctor_agent_hooks.py +0 -0
  222. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_doctor_hooks.py +0 -0
  223. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_doctor_managed_docs.py +0 -0
  224. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_doctor_probes.py +0 -0
  225. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_documentation.py +0 -0
  226. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_edit_apply.py +0 -0
  227. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_exit_codes_reference.py +0 -0
  228. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_external_calls.py +0 -0
  229. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_file_node_id_collision.py +0 -0
  230. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_git_security.py +0 -0
  231. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_go_rust.py +0 -0
  232. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_graph_io.py +0 -0
  233. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_graph_provider_isolation.py +0 -0
  234. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_health.py +0 -0
  235. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_hook_entry.py +0 -0
  236. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_hook_template.py +0 -0
  237. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_hookinstall.py +0 -0
  238. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_hookshim.py +0 -0
  239. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_html_security.py +0 -0
  240. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_incident_ledger.py +0 -0
  241. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_init.py +0 -0
  242. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_init_activation_doctrine.py +0 -0
  243. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_init_hooks.py +0 -0
  244. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_init_validation_exit.py +0 -0
  245. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_launchd_agent.py +0 -0
  246. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_lifecycle_operator.py +0 -0
  247. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_listing.py +0 -0
  248. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_listing_surfaces.py +0 -0
  249. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_llm.py +0 -0
  250. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_llm_probe.py +0 -0
  251. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_mcp.py +0 -0
  252. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_mcp_server.py +0 -0
  253. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_mcp_server_channel_attribution.py +0 -0
  254. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_member_call_receiver.py +0 -0
  255. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_method_dispatch_scope.py +0 -0
  256. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_monorepo.py +0 -0
  257. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_mutation_tests.py +0 -0
  258. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_natural_query.py +0 -0
  259. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_no_path_is_graded.py +0 -0
  260. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_node_identity.py +0 -0
  261. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ollama_executor.py +0 -0
  262. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_overlays.py +0 -0
  263. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_path_leak_fixture.py +0 -0
  264. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_probe_diagnostics.py +0 -0
  265. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_probe_process.py +0 -0
  266. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_probe_workspace.py +0 -0
  267. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_process_contracts.py +0 -0
  268. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_programs.py +0 -0
  269. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_claude_probe.py +0 -0
  270. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_codex_probe.py +0 -0
  271. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_lifecycle.py +0 -0
  272. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_lifecycle_service.py +0 -0
  273. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_lifecycle_storage.py +0 -0
  274. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_observer.py +0 -0
  275. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_ollama_probe.py +0 -0
  276. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_openrouter_probe.py +0 -0
  277. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_provider_probe_runner.py +0 -0
  278. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_public_surface.py +0 -0
  279. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_published_schemas.py +0 -0
  280. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_pyscope.py +0 -0
  281. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_pyscopeoracle.py +0 -0
  282. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_builtin_named_symbols.py +0 -0
  283. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_import_bindings.py +0 -0
  284. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_inherits_edge.py +0 -0
  285. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_local_alias_call.py +0 -0
  286. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_reexport_follow.py +0 -0
  287. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_resolver.py +0 -0
  288. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_python_scope_identity.py +0 -0
  289. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_query_plan.py +0 -0
  290. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_replacement_audit.py +0 -0
  291. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_repository_root_ownership.py +0 -0
  292. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_resolve.py +0 -0
  293. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_resolve_python_reexports_of.py +0 -0
  294. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_review.py +0 -0
  295. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_route_pool.py +0 -0
  296. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_route_pool_execution.py +0 -0
  297. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_approval.py +0 -0
  298. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_benchmark.py +0 -0
  299. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_classifier.py +0 -0
  300. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_claude_executor.py +0 -0
  301. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_cli.py +0 -0
  302. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_cli_contracts.py +0 -0
  303. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_cli_recovery.py +0 -0
  304. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_codex_executor.py +0 -0
  305. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_context.py +0 -0
  306. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_contracts.py +0 -0
  307. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_diff_policy.py +0 -0
  308. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_executor.py +0 -0
  309. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_openrouter_executor.py +0 -0
  310. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_policy.py +0 -0
  311. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_process_runner.py +0 -0
  312. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_profiles.py +0 -0
  313. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_registry.py +0 -0
  314. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_schema_validation.py +0 -0
  315. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_security.py +0 -0
  316. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_service.py +0 -0
  317. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_shadow.py +0 -0
  318. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_storage.py +0 -0
  319. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_telemetry.py +0 -0
  320. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_worktree.py +0 -0
  321. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_zai_executor.py +0 -0
  322. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_routing_zai_probe.py +0 -0
  323. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_savings.py +0 -0
  324. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_self_super_dispatch.py +0 -0
  325. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_smoke.py +0 -0
  326. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_sqloracle.py +0 -0
  327. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_synthetic_repo.py +0 -0
  328. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_systemd_unit.py +0 -0
  329. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_ts_bridge.py +0 -0
  330. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_typescript_activation.py +0 -0
  331. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_typescript_resolver.py +0 -0
  332. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_usage_ledger.py +0 -0
  333. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_verify_artifact.py +0 -0
  334. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_verify_published_release.py +0 -0
  335. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_watch.py +0 -0
  336. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_windows_startup.py +0 -0
  337. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_windows_task.py +0 -0
  338. {graphite_code-1.8.2 → graphite_code-1.9.1}/tests/test_zai_edit.py +0 -0
@@ -13,7 +13,98 @@ machine-checkable identity; the version is for humans.
13
13
 
14
14
  [Keep a Changelog]: https://keepachangelog.com/en/1.1.0/
15
15
 
16
- ## [Unreleased]
16
+ ## [1.9.1] — 2026-11-03
17
+
18
+ A patch release: three fixes, and no change to any command, option, exit code
19
+ or entry point. The wording of human-readable output is not a stable surface
20
+ (`docs/compatibility.md`), and the agent hook's stable contract is that it
21
+ always exits 0 — neither moves. The graph the release changes was measured
22
+ against the 1.9.0 tree: every node id survives, none is removed, and no edge
23
+ triple is lost.
24
+
25
+ ### Fixed
26
+
27
+ **`graphite search` says how many matches there are, and how to see them.**
28
+ The text form printed `20 match(es) for: X (truncated)`, which reads as the
29
+ total: an agent that reads it that way believes the graph fell short and
30
+ falls back to searching files one at a time — the outcome the graph-first
31
+ rule exists to prevent. The full answer was one flag away and nothing in the
32
+ output or the help said so. The line now reads `20 of 3499 match(es) for: X
33
+ (truncated; pass --limit 3499 to see all)`, and where `--limit` is capped it
34
+ says the cap instead of naming a number above it. `--limit`'s help states
35
+ its default. The JSON form already carried both figures and is unchanged.
36
+
37
+ **A search for a phrase is no longer refused for a word the repo happens to
38
+ name.** The strict agent hook refused `email you` because `email` is a
39
+ method in that repository's graph, and refused `the parser tree` and
40
+ `version path` for the same reason — while `Send Test Email` passed. Whether
41
+ a prose search was allowed depended on where the word fell in the sentence,
42
+ because the comparison is case-exact.
43
+
44
+ A literal space inside a pattern is part of the text the search must match,
45
+ so the word beside it cannot be the bare symbol the search is looking for.
46
+ That is the rule the gate already applied to a piece of a path, a file's
47
+ name and a hyphenated option, and a required space is that kind of joining
48
+ character. A phrase is now searched as text, on all three routes — the Grep
49
+ tool, a shell search and PowerShell — and the graph-first reminder still
50
+ reaches the agent.
51
+
52
+ Two conditions keep this from becoming a way past the gate: the space must
53
+ be **required** (a quantifier or an escape after it may make the space
54
+ absent — `?`, `*`, `{0}`, and BRE's escaped `\?` — and an absent space can
55
+ still find the bare name; where the engine's dialect cannot be read, the
56
+ term is judged rather than excused) and it must be **interior** (text on both
57
+ sides, within the same branch and group, so a space at the edge of either —
58
+ leading, trailing, or against an alternation, a group or an anchor — cannot
59
+ be added to any pattern to smuggle a bare symbol through). A regex escape is
60
+ not a space: `^\s*def\s+name\b` still names the symbol and is still refused,
61
+ and a bare identifier is still refused.
62
+
63
+ **A qualified member the graph cannot answer for is no longer refused.** The
64
+ strict agent hook refused `RUNTIME\.put\(` because `put` is a
65
+ property of a test mock's object literal — a node nothing calls, so the
66
+ route the refusal offers (`callers put`) answers with an empty list. The
67
+ member was a call on something the graph does not model, and the graph had
68
+ nothing to say about it.
69
+
70
+ A member is now exempt from being a refusal when **both** hold: the receiver
71
+ is not something this repo defines, and nothing in this repo calls anything
72
+ of that name. Both are needed — the receiver alone would excuse
73
+ `self.check(`, where the graph does know who calls the method, and the
74
+ callers alone would excuse `graph.jsonify`, where the receiver is a symbol
75
+ this repo defines. A bare word is still refused, including one nothing
76
+ calls.
77
+
78
+ ## [1.9.0] — 2026-10-31
79
+
80
+ A minor release: one addition to a stable JSON output, and no change to any
81
+ command, option, exit code or entry point. By the rule in
82
+ `docs/compatibility.md` — "additions are minors" — a field added to a versioned
83
+ JSON output is a minor, not a patch.
84
+
85
+ ### Added
86
+
87
+ **`check` now names the engine file that moved, not just the fact that the
88
+ engine moved.** `engine_changed` reported that graphite's own engine had
89
+ changed since the graph was built and listed no files — and that was
90
+ structural, not an oversight: the engine's fingerprint covers the *package*
91
+ directory while the file-level diff covers the *repository* being checked, so
92
+ the file that moved was in neither list, and the repository's `added`,
93
+ `changed` and `removed` were empty by construction. The 1.7.0 pre-push gate
94
+ hit exactly this and could say nothing about what had moved.
95
+
96
+ The build now records the engine's file inventory in the manifest, and
97
+ `check --json` reports the difference as `engine_files`
98
+ (`added`/`changed`/`removed`, relative to the engine's package root, so no
99
+ absolute path is disclosed). The short form names the files too. When the
100
+ manifest records no inventory — one written before this, or an engine that
101
+ cannot be read — the answer is `null`, not an empty list: "no file changed"
102
+ and "we do not know" are different claims.
103
+
104
+ The engine's *fingerprint* is unchanged, byte for byte: this adds a record
105
+ beside the identity, and no existing graph is invalidated by it. The inventory
106
+ comes out of the pass the fingerprint already made, so the build does not read
107
+ the package twice — measured at 127 ms per build before and after.
17
108
 
18
109
  ## [1.8.2] — 2026-10-30
19
110
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.8.2
3
+ Version: 1.9.1
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.8.0, production/stable.** Published on PyPI as
52
+ **Status: 1.9.1, 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`,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
4
4
 
5
- **Status: 1.8.0, production/stable.** Published on PyPI as
5
+ **Status: 1.9.1, production/stable.** Published on PyPI as
6
6
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
7
7
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
8
8
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -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.2"
41
+ __version__ = "1.9.1"
@@ -19,10 +19,12 @@ from . import usage_ledger
19
19
  from .activation import mark_active
20
20
  from .config import Config
21
21
  from .freshness import check_graph_freshness
22
+ from .graph import edge_relations
22
23
  from .graph_io import load_validated_graph_bundle
23
24
  from .health import _edge_language, is_placeholder, persisted_resolution
24
25
  from .incident_ledger import record_incident, repo_ledger_dir
25
26
  from .ingest import enclosing_git_root, repository_root
27
+ from .query import _CALL_RELATIONS
26
28
 
27
29
  SESSION_CONTRACT = (
28
30
  "graphite-first: this repo uses a shared code graph. For cross-file questions "
@@ -236,27 +238,137 @@ def _without_fused_escapes(pattern: str) -> str:
236
238
  return _FUSED_ESCAPE_RE.sub(lambda found: found.group() if found.group() == "\\\\" else " ", pattern)
237
239
 
238
240
 
239
- def _pattern_tokens(pattern: str, fold_case: bool) -> list[str]:
241
+ # A run of literal whitespace in a pattern. Tab counts: a pattern may be
242
+ # written with one.
243
+ _WHITESPACE_RUN_RE = re.compile(r"[ \t]+")
244
+ # The characters that end a branch, a group, a character class, a repetition
245
+ # or an anchor's span. A run next to one of them sits at the edge of what the
246
+ # pattern matches rather than inside a phrase, so it is not a joining
247
+ # character: `dependents |zzqx` is the first branch `dependents ` and
248
+ # `zzqx| dependents` is the second branch ` dependents`, and both are the
249
+ # bare name with a space at the edge of it.
250
+ _BOUNDARY_CHARS = frozenset("|()[]{}^$")
251
+ # A quantifier or an escape after a space. The space may be absent -- `?`,
252
+ # `*` and `{0` in ERE, `\\?` and `\\{0,1\\}` in BRE -- or the construct is one
253
+ # this hook cannot parse, and a parse it does not understand fails closed.
254
+ # Either way the space is not something the matched text must carry, so the
255
+ # bare name is still what the search may be looking for.
256
+ _QUANTIFIER_OR_ESCAPE_AFTER = frozenset("?*+{\\")
257
+
258
+
259
+ def _required_interior_whitespace(pattern: str) -> list[tuple[int, int]]:
260
+ """Spans of whitespace a matched text must carry, with text on both sides.
261
+
262
+ A literal space inside a pattern is part of the text the search must
263
+ match: `email you` finds the phrase, not the bare word. The rule that
264
+ already skips a piece of a path, a file's name or a hyphenated option is
265
+ the same one -- a fragment of a longer literal is not judged alone -- and
266
+ a required space beside a word is that kind of joining character. So a
267
+ prose search is not refused for a word the repo happens to call `email`
268
+ (round 331), and the refusal no longer depends on where the word falls
269
+ in the sentence.
270
+
271
+ Two conditions keep this from becoming a way past the gate:
272
+
273
+ - the space must be REQUIRED. A quantifier or an escape after it may make
274
+ the space absent, and an absent space can still find the bare name.
275
+ - it must be INTERIOR: text on both sides, within the same branch and
276
+ group. A space at the edge of either -- leading, trailing, or against
277
+ an alternation, a group or an anchor -- would let any pattern smuggle a
278
+ bare symbol past the gate by adding one space, so it is not treated as
279
+ a joining character.
280
+
281
+ The engine's dialect is not read, and where it would matter the space is
282
+ judged rather than excused: a bare `?` is a quantifier in ERE and a
283
+ literal character in BRE, and the hook cannot tell which it is looking
284
+ at, so `email ?you` is judged in both. That refuses a search the pattern
285
+ may have allowed, and refusing is the safe direction.
286
+
287
+ A regex escape is not a space. `\\s` is an operator, so
288
+ `^\\s*def\\s+dependents\\b` still names the symbol and is still judged,
289
+ and the name beside an escape is judged exactly as it was.
290
+ """
291
+ spans: list[tuple[int, int]] = []
292
+ for found in _WHITESPACE_RUN_RE.finditer(pattern):
293
+ start, end = found.start(), found.end()
294
+ before = pattern[start - 1] if start else ""
295
+ after = pattern[end] if end < len(pattern) else ""
296
+ if not before or not after:
297
+ continue # at the edge of the pattern
298
+ if before in _BOUNDARY_CHARS or after in _BOUNDARY_CHARS:
299
+ continue # at the edge of a branch, a group or an anchor
300
+ if after in _QUANTIFIER_OR_ESCAPE_AFTER:
301
+ continue # the space may be absent, or the parse is unknown
302
+ spans.append((start, end))
303
+ return spans
304
+
305
+
306
+ def _beside_a_required_space(start: int, end: int, spaces: list[tuple[int, int]]) -> bool:
307
+ """Whether the token at `start:end` sits against a required interior space."""
308
+ return any(run_end == start or run_start == end for run_start, run_end in spaces)
309
+
310
+
311
+ def _receiver_of(pattern: str, start: int) -> str | None:
312
+ """The identifier the word at `start` is qualified by, or None.
313
+
314
+ `env.put(` and `env\\.put(` both qualify `put` by `env`. A word that is
315
+ not behind a dot is qualified by nothing.
316
+ """
317
+ index = start - 1
318
+ if index < 0:
319
+ return None
320
+ if pattern[index] == "\\":
321
+ index -= 1
322
+ if index < 0 or pattern[index] != ".":
323
+ return None
324
+ index -= 1 # past the dot
325
+ if index >= 0 and pattern[index] == "\\":
326
+ index -= 1 # and past the backslash of an escaped dot
327
+ end = index + 1
328
+ while index >= 0 and (pattern[index].isalnum() or pattern[index] == "_"):
329
+ index -= 1
330
+ if index + 1 == end:
331
+ return None # nothing before the dot
332
+ return pattern[index + 1:end]
333
+
334
+
335
+ def _pattern_tokens(pattern: str, fold_case: bool) -> list[tuple[str, str | None]]:
240
336
  """Identifier-like tokens from a grep pattern, deduplicated, capped.
241
337
 
242
338
  Two spellings of one word are one token only when the search folds case.
243
339
  Otherwise `Done|done` would keep `Done` alone and never check `done`.
340
+
341
+ Each token carries the identifier it is qualified by, or None when the
342
+ word appears without one. A word that appears bare anywhere in the
343
+ pattern is never a qualified member: `install|env.install(` is a search
344
+ for the bare name as well.
244
345
  """
245
- seen: set[str] = set()
246
- tokens: list[str] = []
346
+ seen: dict[str, str] = {}
347
+ receivers: dict[str, str | None] = {}
348
+ # The spaces are read from the pattern as written: `_without_fused_escapes`
349
+ # blanks an escape into spaces of its own, and a blanked escape is an
350
+ # operator, not a space the matched text must carry.
351
+ spaces = _required_interior_whitespace(pattern)
247
352
  pattern = _without_fused_escapes(pattern)
248
353
  for found in _IDENTIFIER_RE.finditer(pattern):
249
354
  if _is_literal_fragment(pattern, found.start(), found.end()):
250
355
  continue
356
+ if _beside_a_required_space(found.start(), found.end(), spaces):
357
+ continue
251
358
  token = found.group()
252
359
  key = token.lower() if fold_case else token
360
+ receiver = _receiver_of(pattern, found.start())
253
361
  if key in seen:
362
+ # Qualified somewhere and bare somewhere else is a search for the
363
+ # bare name too, so the word is not a qualified member.
364
+ if receivers[key] != receiver:
365
+ receivers[key] = None
254
366
  continue
255
- seen.add(key)
256
- tokens.append(token)
257
- if len(tokens) >= _MAX_TOKENS_CHECKED:
367
+ seen[key] = token
368
+ receivers[key] = receiver
369
+ if len(seen) >= _MAX_TOKENS_CHECKED:
258
370
  break
259
- return tokens
371
+ return [(seen[key], receivers[key]) for key in seen]
260
372
 
261
373
 
262
374
  def _hook_graph(root: Path) -> Any | None:
@@ -268,7 +380,74 @@ def _hook_graph(root: Path) -> Any | None:
268
380
  return graph
269
381
 
270
382
 
271
- def _graph_symbol(graph: Any, tokens: list[str], fold_case: bool) -> tuple[str, str] | None:
383
+ def _defines(graph: Any, word: str, fold_case: bool) -> bool:
384
+ """Whether this repo defines something by this word.
385
+
386
+ A placeholder does not count: `json` is in the graph because a file
387
+ imports it, not because the repo defines it.
388
+ """
389
+ key = word.lower() if fold_case else word
390
+ for node_id, data in graph.nodes(data=True):
391
+ if is_placeholder(data):
392
+ continue
393
+ for candidate in (node_id, str(data.get("name", ""))):
394
+ candidate_key = candidate.lower() if fold_case else candidate
395
+ if candidate_key and candidate_key == key:
396
+ return True
397
+ return False
398
+
399
+
400
+ def _has_callers(graph: Any, node_id: str) -> bool:
401
+ """Whether the graph's own `callers` listing for this node is non-empty.
402
+
403
+ The same relations `query "callers"` counts: an inbound edge whose
404
+ relations include a call or a reference. Nesting (`contains`) is not a
405
+ call -- a nested function is contained by its parent, not called by it.
406
+ """
407
+ return any(
408
+ any(relation in _CALL_RELATIONS for relation in edge_relations(graph[source][node_id]))
409
+ for source in graph.predecessors(node_id)
410
+ )
411
+
412
+
413
+ def _exempt_member(graph: Any, word: str, receiver: str | None, fold_case: bool) -> bool:
414
+ """Whether a qualified member is something the graph cannot answer for.
415
+
416
+ The receiver is not something this repo defines, so the member is a call
417
+ on something the graph does not model -- a runtime binding, or a test
418
+ double's namesake. And nothing in this repo calls anything of that name,
419
+ so the route the refusal offers (`callers <word>`) would resolve the word
420
+ to a node with no callers and answer with an empty list (round 332).
421
+
422
+ Both conditions are needed, and each of them alone would undo a decision
423
+ this gate already made:
424
+
425
+ - the receiver alone would excuse `self.check(`, where the graph does
426
+ know who calls the method;
427
+ - the callers alone would excuse `graph.jsonify`, where the receiver is
428
+ a symbol this repo defines.
429
+ """
430
+ if receiver is None:
431
+ return False
432
+ if _defines(graph, receiver, fold_case):
433
+ return False
434
+ key = word.lower() if fold_case else word
435
+ for node_id, data in graph.nodes(data=True):
436
+ if is_placeholder(data):
437
+ continue
438
+ name = str(data.get("name", ""))
439
+ name_key = name.lower() if fold_case else name
440
+ id_key = node_id.lower() if fold_case else node_id
441
+ if name_key != key and id_key != key:
442
+ continue
443
+ if _has_callers(graph, node_id):
444
+ return False
445
+ return True
446
+
447
+
448
+ def _graph_symbol(
449
+ graph: Any, tokens: list[tuple[str, str | None]], fold_case: bool
450
+ ) -> tuple[str, str] | None:
272
451
  """First token that IS something this repo defines (exact id or name), else None.
273
452
 
274
453
  A placeholder does not count. `json` is in the graph because a file imports
@@ -278,15 +457,26 @@ def _graph_symbol(graph: Any, tokens: list[str], fold_case: bool) -> tuple[str,
278
457
 
279
458
  Case is compared the way the search compares it. A case-exact search for
280
459
  `DONE` cannot find a function `done`, so it is not a search for one.
460
+
461
+ A qualified member the graph cannot answer for is not a symbol this
462
+ search is about, and does not refuse it (round 332).
281
463
  """
282
- wanted = {(token.lower() if fold_case else token): token for token in tokens}
464
+ wanted = {(token.lower() if fold_case else token): token for token, _ in tokens}
465
+ receivers = {(token.lower() if fold_case else token): receiver for token, receiver in tokens}
466
+ exempt: set[str] = set()
283
467
  for node_id, data in graph.nodes(data=True):
284
468
  if is_placeholder(data):
285
469
  continue
286
470
  for candidate in (node_id, str(data.get("name", ""))):
287
471
  key = candidate.lower() if fold_case else candidate
288
- if key and key in wanted:
289
- return node_id, wanted[key]
472
+ if not (key and key in wanted):
473
+ continue
474
+ if key in exempt:
475
+ continue
476
+ if _exempt_member(graph, key, receivers.get(key), fold_case):
477
+ exempt.add(key)
478
+ continue
479
+ return node_id, wanted[key]
290
480
  return None
291
481
 
292
482
 
@@ -42,7 +42,7 @@ from .daemon_health import HealthOptions, evaluate_daemon_health, format_health_
42
42
  from . import buildlock
43
43
  from .detach import spawn_detached
44
44
  from .doctor import format_doctor_text, run_doctor
45
- from .engine_identity import engine_identity
45
+ from .engine_identity import engine_identity, engine_identity_and_files
46
46
  from .export.html import to_html as export_html
47
47
  from .export.json import build_bundle, to_json as export_json
48
48
  from .export.md import to_markdown as export_md
@@ -277,10 +277,18 @@ def _scan(args: argparse.Namespace, cfg: Config) -> tuple[dict[str, Any], list[A
277
277
 
278
278
  start = time.time()
279
279
  entries = collect_files(root, cfg)
280
+ # One pass over the engine's files yields both the identity and the
281
+ # inventory, so the inventory costs nothing beyond what the fingerprint
282
+ # already cost.
283
+ engine, engine_files = engine_identity_and_files(cfg.cache_version)
280
284
  manifest = {
281
285
  "root": root.name,
282
286
  "file_count": len(entries),
283
- "engine": engine_identity(cfg.cache_version),
287
+ "engine": engine,
288
+ # The engine's own files, so a later `check` can name WHICH of them
289
+ # moved when the identity does. The fingerprint alone cannot: it says
290
+ # that something under the package directory changed and not what.
291
+ "engine_files": engine_files,
284
292
  "files": [
285
293
  {"rel_path": e.rel_path, "language": e.language, "size": e.size, "hash": e.content_hash}
286
294
  for e in entries
@@ -809,6 +817,29 @@ def _short_value(value: Any, limit: int = 12) -> str:
809
817
  return text if len(text) <= limit else text[:limit] + "..."
810
818
 
811
819
 
820
+ def _print_engine_files(files: Any) -> None:
821
+ """Name the engine's own files that moved, when they are known.
822
+
823
+ `engine_changed` otherwise says only THAT the engine moved. The file
824
+ names are what a consumer can act on, and they are what the 1.7.0 gate
825
+ could not report.
826
+ """
827
+ if not isinstance(files, dict):
828
+ return
829
+ named: list[str] = []
830
+ for key in ("changed", "added", "removed"):
831
+ values = files.get(key)
832
+ if not isinstance(values, list):
833
+ continue
834
+ for name in values:
835
+ named.append(f"{key}: {name}")
836
+ if not named:
837
+ return
838
+ print(" engine files that moved:")
839
+ for line in named:
840
+ print(f" {line}")
841
+
842
+
812
843
  def cmd_check(args: argparse.Namespace) -> int:
813
844
  root = Path(args.path).resolve()
814
845
  # Below a repository's root there is no graph to be fresh or stale, and
@@ -855,6 +886,7 @@ def cmd_check(args: argparse.Namespace) -> int:
855
886
  if reason == "engine_changed":
856
887
  print(" graphite was updated since this graph was built; rebuild to refresh")
857
888
  _print_engine_delta(status.get("engine_delta"))
889
+ _print_engine_files(status.get("engine_files"))
858
890
  for key in ("added", "changed", "removed"):
859
891
  if status.get(key):
860
892
  print(f" {key}: {', '.join(status[key])}")
@@ -1383,6 +1415,29 @@ def cmd_query(args: argparse.Namespace) -> int:
1383
1415
  return 0
1384
1416
 
1385
1417
 
1418
+ def _search_summary(result: dict[str, Any]) -> str:
1419
+ """The one line that says what was shown, how much exists, and how to see it.
1420
+
1421
+ `20 match(es)` reads as the total, and an agent that reads it that way
1422
+ believes the graph fell short and falls back to searching files one at a
1423
+ time -- the outcome the graph-first rule exists to prevent. The full
1424
+ answer was one flag away, so the line now says so (round 330). The JSON
1425
+ form already carried both figures and is unchanged.
1426
+ """
1427
+ count = result["count"]
1428
+ query = result["query"]
1429
+ if not result.get("truncated"):
1430
+ return f"[graphite] {count} match(es) for: {query}"
1431
+ total = result["total_matches"]
1432
+ if total <= MAX_SEARCH_LIMIT:
1433
+ way_out = f"pass --limit {total} to see all"
1434
+ else:
1435
+ # `--limit` is capped, so naming a number above the cap would be a
1436
+ # false instruction. Say the cap instead.
1437
+ way_out = f"--limit caps at {MAX_SEARCH_LIMIT}"
1438
+ return f"[graphite] {count} of {total} match(es) for: {query} (truncated; {way_out})"
1439
+
1440
+
1386
1441
  def cmd_search(args: argparse.Namespace) -> int:
1387
1442
  started = time.perf_counter()
1388
1443
  g = _load_cli_graph(args)
@@ -1394,8 +1449,7 @@ def cmd_search(args: argparse.Namespace) -> int:
1394
1449
  elif not result["results"]:
1395
1450
  print(f"[graphite] no matches for: {result['query']}")
1396
1451
  else:
1397
- suffix = " (truncated)" if result["truncated"] else ""
1398
- print(f"[graphite] {result['count']} match(es) for: {result['query']}{suffix}")
1452
+ print(_search_summary(result))
1399
1453
  for item in result["results"]:
1400
1454
  location = f" ({item['source_file']})" if item["source_file"] else ""
1401
1455
  print(f" - {item['id']} [{item['kind']}, {item['match_type']}]{location}")
@@ -3330,7 +3384,12 @@ def build_parser() -> argparse.ArgumentParser:
3330
3384
  default=_DEFAULT_GRAPH_JSON,
3331
3385
  help="Path to graph.json",
3332
3386
  )
3333
- p_search.add_argument("--limit", type=int, default=DEFAULT_SEARCH_LIMIT, help="Maximum results")
3387
+ p_search.add_argument(
3388
+ "--limit",
3389
+ type=int,
3390
+ default=DEFAULT_SEARCH_LIMIT,
3391
+ help=f"Maximum results (default: {DEFAULT_SEARCH_LIMIT})",
3392
+ )
3334
3393
  p_search.add_argument("--json", action="store_true", help="Emit machine-readable JSON")
3335
3394
  p_search.set_defaults(func=cmd_search)
3336
3395