graphite-code 1.6.0__tar.gz → 1.7.0__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 (321) hide show
  1. {graphite_code-1.6.0 → graphite_code-1.7.0}/CHANGELOG.md +103 -0
  2. {graphite_code-1.6.0 → graphite_code-1.7.0}/PKG-INFO +2 -2
  3. {graphite_code-1.6.0 → graphite_code-1.7.0}/README.md +1 -1
  4. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/__init__.py +1 -1
  5. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/cli.py +4 -2
  6. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/daemon.py +10 -3
  7. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/ingest.py +42 -5
  8. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_agent_hooks_session_tagging.py +92 -0
  9. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_context_builder.py +2 -2
  10. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_snapshot_failure.py +74 -0
  11. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_doctor.py +131 -26
  12. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_hardening.py +2 -2
  13. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_published_schemas.py +54 -0
  14. {graphite_code-1.6.0 → graphite_code-1.7.0}/.gitignore +0 -0
  15. {graphite_code-1.6.0 → graphite_code-1.7.0}/ARCHITECTURE.md +0 -0
  16. {graphite_code-1.6.0 → graphite_code-1.7.0}/CONTRIBUTING.md +0 -0
  17. {graphite_code-1.6.0 → graphite_code-1.7.0}/LICENSE +0 -0
  18. {graphite_code-1.6.0 → graphite_code-1.7.0}/RELEASING.md +0 -0
  19. {graphite_code-1.6.0 → graphite_code-1.7.0}/pyproject.toml +0 -0
  20. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/__main__.py +0 -0
  21. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/_cleanup_worker.py +0 -0
  22. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/_win32_ctypes.py +0 -0
  23. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/activation.py +0 -0
  24. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/agent_hooks.py +0 -0
  25. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/agent_settings.py +0 -0
  26. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/analyze.py +0 -0
  27. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/answer_contract.py +0 -0
  28. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/bootstrap.py +0 -0
  29. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/buildlock.py +0 -0
  30. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/cache.py +0 -0
  31. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/channel.py +0 -0
  32. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/cluster.py +0 -0
  33. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/config.py +0 -0
  34. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/context.py +0 -0
  35. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/daemon_health.py +0 -0
  36. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/daemon_launch.py +0 -0
  37. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/debt.py +0 -0
  38. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/dependency_install.py +0 -0
  39. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/detach.py +0 -0
  40. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/doctor.py +0 -0
  41. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/doctor_probes.py +0 -0
  42. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/engine_identity.py +0 -0
  43. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/export/__init__.py +0 -0
  44. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/export/html.py +0 -0
  45. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/export/json.py +0 -0
  46. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/export/md.py +0 -0
  47. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/extract/__init__.py +0 -0
  48. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/extract/ast.py +0 -0
  49. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/extract/pyscope.py +0 -0
  50. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/freshness.py +0 -0
  51. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/git.py +0 -0
  52. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/graph.py +0 -0
  53. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/graph_io.py +0 -0
  54. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/health.py +0 -0
  55. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/hook_entry.py +0 -0
  56. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/hookinstall.py +0 -0
  57. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/hookshim.py +0 -0
  58. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/incident_ledger.py +0 -0
  59. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/init.py +0 -0
  60. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/io.py +0 -0
  61. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/launchd_agent.py +0 -0
  62. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/listing.py +0 -0
  63. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/llm.py +0 -0
  64. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/llm_probe.py +0 -0
  65. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/mcp.py +0 -0
  66. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/mcp_server.py +0 -0
  67. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/natural_query.py +0 -0
  68. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/overlays.py +0 -0
  69. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/ownership.py +0 -0
  70. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/probe_process.py +0 -0
  71. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/probe_workspace.py +0 -0
  72. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/process_contracts.py +0 -0
  73. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/programs.py +0 -0
  74. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/provider_observer.py +0 -0
  75. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/py.typed +0 -0
  76. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/query.py +0 -0
  77. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/query_plan.py +0 -0
  78. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/replacement_audit.py +0 -0
  79. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/resolve.py +0 -0
  80. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/review.py +0 -0
  81. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/__init__.py +0 -0
  82. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/approval.py +0 -0
  83. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/classifier.py +0 -0
  84. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/claude_executor.py +0 -0
  85. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/claude_probe.py +0 -0
  86. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/cli_identity.py +0 -0
  87. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/codex_executor.py +0 -0
  88. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/codex_probe.py +0 -0
  89. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/context_builder.py +0 -0
  90. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/contracts.py +0 -0
  91. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/diff_policy.py +0 -0
  92. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/edit_apply.py +0 -0
  93. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/effort.py +0 -0
  94. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/lifecycle.py +0 -0
  95. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/lifecycle_operator.py +0 -0
  96. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/lifecycle_service.py +0 -0
  97. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/lifecycle_storage.py +0 -0
  98. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/ollama_executor.py +0 -0
  99. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/ollama_probe.py +0 -0
  100. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/openrouter_executor.py +0 -0
  101. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/openrouter_probe.py +0 -0
  102. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/policy.py +0 -0
  103. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/probe_runner.py +0 -0
  104. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/process_runner.py +0 -0
  105. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/profiles.py +0 -0
  106. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/prompt.py +0 -0
  107. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/registry.py +0 -0
  108. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/route_pool.py +0 -0
  109. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/route_pool_execution.py +0 -0
  110. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/schema_validation.py +0 -0
  111. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/service.py +0 -0
  112. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/settings.py +0 -0
  113. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/shadow.py +0 -0
  114. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/storage.py +0 -0
  115. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/telemetry.py +0 -0
  116. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/worktree.py +0 -0
  117. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/zai_edit.py +0 -0
  118. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/zai_executor.py +0 -0
  119. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/routing/zai_probe.py +0 -0
  120. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/savings.py +0 -0
  121. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/systemd_unit.py +0 -0
  122. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/ts_bridge.py +0 -0
  123. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/ts_resolver.mjs +0 -0
  124. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/typescript_activation.py +0 -0
  125. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/usage_ledger.py +0 -0
  126. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/validation.py +0 -0
  127. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/watch.py +0 -0
  128. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/windows_job.py +0 -0
  129. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/windows_startup.py +0 -0
  130. {graphite_code-1.6.0 → graphite_code-1.7.0}/src/graphite/windows_task.py +0 -0
  131. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/conftest.py +0 -0
  132. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/data/sqloracle/blindspots.py.txt +0 -0
  133. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/data/sqloracle/round69.py.txt +0 -0
  134. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/fake_clis/fake_cli.py +0 -0
  135. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/fixtures/provider_lifecycle_schema_v1.sql +0 -0
  136. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/fixtures/routing_schema_v2_ca77600.sql +0 -0
  137. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/fixtures/routing_schema_v3_94eb333.sql +0 -0
  138. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/fixtures/routing_schema_v4_lifecycle_migration.sql +0 -0
  139. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test__win32_ctypes.py +0 -0
  140. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_activation.py +0 -0
  141. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_activation_backstop.py +0 -0
  142. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_agent_hook_activation.py +0 -0
  143. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_agent_hooks.py +0 -0
  144. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_agent_hooks_session_books.py +0 -0
  145. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_agent_settings.py +0 -0
  146. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_answer_contract.py +0 -0
  147. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_arrow_and_constructor_binding.py +0 -0
  148. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ast_make_id_length.py +0 -0
  149. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ast_name_a_module_only_imports.py +0 -0
  150. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ast_source_lines.py +0 -0
  151. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ast_super_over_a_builtin_base.py +0 -0
  152. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_atomic_write.py +0 -0
  153. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_bootstrap.py +0 -0
  154. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_build_detach.py +0 -0
  155. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_buildlock.py +0 -0
  156. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cache_engine_identity.py +0 -0
  157. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cache_entry_pruning.py +0 -0
  158. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cache_file_identity.py +0 -0
  159. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cache_file_set.py +0 -0
  160. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cache_pruning.py +0 -0
  161. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_call_graph.py +0 -0
  162. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_case_ambiguous_answer.py +0 -0
  163. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_attribution.py +0 -0
  164. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_cli.py +0 -0
  165. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_core.py +0 -0
  166. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_kind.py +0 -0
  167. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_lock.py +0 -0
  168. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_log_integrity.py +0 -0
  169. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_mcp.py +0 -0
  170. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_register.py +0 -0
  171. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_report.py +0 -0
  172. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_channel_status.py +0 -0
  173. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_class_field_arrow_binding.py +0 -0
  174. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_below_repository_root.py +0 -0
  175. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_build_missing_path.py +0 -0
  176. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_channel.py +0 -0
  177. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_channel_attribution.py +0 -0
  178. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_doctor_below_root.py +0 -0
  179. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_reference.py +0 -0
  180. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_usage.py +0 -0
  181. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cli_version.py +0 -0
  182. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cluster.py +0 -0
  183. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_compare_dist.py +0 -0
  184. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_configuration_reference.py +0 -0
  185. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_context.py +0 -0
  186. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cwd_relative_config.py +0 -0
  187. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_cycle_search.py +0 -0
  188. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon.py +0 -0
  189. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_activation.py +0 -0
  190. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_build_lock.py +0 -0
  191. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_child_lock.py +0 -0
  192. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_engine_staleness.py +0 -0
  193. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_health.py +0 -0
  194. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_health_activation.py +0 -0
  195. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_launch.py +0 -0
  196. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_daemon_service_cli.py +0 -0
  197. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_debt.py +0 -0
  198. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_dependency_install.py +0 -0
  199. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_destructured_binding.py +0 -0
  200. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_determinism.py +0 -0
  201. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_dispatch_evidence.py +0 -0
  202. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_doctor_agent_hooks.py +0 -0
  203. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_doctor_hooks.py +0 -0
  204. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_doctor_managed_docs.py +0 -0
  205. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_doctor_probes.py +0 -0
  206. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_documentation.py +0 -0
  207. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_edit_apply.py +0 -0
  208. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_engine_identity.py +0 -0
  209. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_exit_codes_reference.py +0 -0
  210. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_external_calls.py +0 -0
  211. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_file_node_id_collision.py +0 -0
  212. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_git_security.py +0 -0
  213. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_go_rust.py +0 -0
  214. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_graph_io.py +0 -0
  215. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_graph_provider_isolation.py +0 -0
  216. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_health.py +0 -0
  217. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_hook_entry.py +0 -0
  218. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_hook_template.py +0 -0
  219. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_hookinstall.py +0 -0
  220. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_hookshim.py +0 -0
  221. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_html_security.py +0 -0
  222. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_incident_ledger.py +0 -0
  223. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_init.py +0 -0
  224. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_init_activation_doctrine.py +0 -0
  225. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_init_hooks.py +0 -0
  226. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_init_validation_exit.py +0 -0
  227. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_launchd_agent.py +0 -0
  228. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_lifecycle_operator.py +0 -0
  229. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_listing.py +0 -0
  230. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_listing_surfaces.py +0 -0
  231. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_llm.py +0 -0
  232. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_llm_probe.py +0 -0
  233. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_mcp.py +0 -0
  234. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_mcp_server.py +0 -0
  235. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_mcp_server_channel_attribution.py +0 -0
  236. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_member_call_receiver.py +0 -0
  237. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_method_dispatch_scope.py +0 -0
  238. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_monorepo.py +0 -0
  239. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_mutation_tests.py +0 -0
  240. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_natural_query.py +0 -0
  241. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_no_path_is_graded.py +0 -0
  242. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_node_identity.py +0 -0
  243. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ollama_executor.py +0 -0
  244. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_overlays.py +0 -0
  245. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_path_leak_fixture.py +0 -0
  246. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_probe_diagnostics.py +0 -0
  247. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_probe_process.py +0 -0
  248. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_probe_workspace.py +0 -0
  249. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_process_contracts.py +0 -0
  250. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_programs.py +0 -0
  251. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_claude_probe.py +0 -0
  252. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_codex_probe.py +0 -0
  253. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_lifecycle.py +0 -0
  254. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_lifecycle_service.py +0 -0
  255. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_lifecycle_storage.py +0 -0
  256. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_observer.py +0 -0
  257. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_ollama_probe.py +0 -0
  258. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_openrouter_probe.py +0 -0
  259. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_provider_probe_runner.py +0 -0
  260. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_public_surface.py +0 -0
  261. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_pyscope.py +0 -0
  262. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_pyscopeoracle.py +0 -0
  263. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_builtin_named_symbols.py +0 -0
  264. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_import_bindings.py +0 -0
  265. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_inherits_edge.py +0 -0
  266. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_local_alias_call.py +0 -0
  267. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_reexport_follow.py +0 -0
  268. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_resolver.py +0 -0
  269. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_python_scope_identity.py +0 -0
  270. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_query_plan.py +0 -0
  271. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_reliability.py +0 -0
  272. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_replacement_audit.py +0 -0
  273. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_repository_root_ownership.py +0 -0
  274. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_resolve.py +0 -0
  275. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_resolve_python_reexports_of.py +0 -0
  276. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_review.py +0 -0
  277. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_route_pool.py +0 -0
  278. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_route_pool_execution.py +0 -0
  279. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_approval.py +0 -0
  280. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_benchmark.py +0 -0
  281. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_classifier.py +0 -0
  282. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_claude_executor.py +0 -0
  283. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_cli.py +0 -0
  284. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_cli_contracts.py +0 -0
  285. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_cli_recovery.py +0 -0
  286. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_codex_executor.py +0 -0
  287. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_context.py +0 -0
  288. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_contracts.py +0 -0
  289. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_diff_policy.py +0 -0
  290. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_executor.py +0 -0
  291. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_openrouter_executor.py +0 -0
  292. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_policy.py +0 -0
  293. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_process_runner.py +0 -0
  294. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_profiles.py +0 -0
  295. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_registry.py +0 -0
  296. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_schema_validation.py +0 -0
  297. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_security.py +0 -0
  298. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_service.py +0 -0
  299. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_shadow.py +0 -0
  300. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_storage.py +0 -0
  301. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_telemetry.py +0 -0
  302. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_worktree.py +0 -0
  303. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_zai_executor.py +0 -0
  304. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_routing_zai_probe.py +0 -0
  305. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_savings.py +0 -0
  306. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_search.py +0 -0
  307. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_self_super_dispatch.py +0 -0
  308. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_smoke.py +0 -0
  309. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_sqloracle.py +0 -0
  310. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_synthetic_repo.py +0 -0
  311. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_systemd_unit.py +0 -0
  312. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_ts_bridge.py +0 -0
  313. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_typescript_activation.py +0 -0
  314. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_typescript_resolver.py +0 -0
  315. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_usage_ledger.py +0 -0
  316. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_verify_artifact.py +0 -0
  317. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_verify_published_release.py +0 -0
  318. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_watch.py +0 -0
  319. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_windows_startup.py +0 -0
  320. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_windows_task.py +0 -0
  321. {graphite_code-1.6.0 → graphite_code-1.7.0}/tests/test_zai_edit.py +0 -0
@@ -15,6 +15,109 @@ machine-checkable identity; the version is for humans.
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [1.7.0] — 2026-10-28
19
+
20
+ A minor release: the daemon's log now says WHICH way enumerating a repository
21
+ failed, and `check --json`, `validate --json` and `daemon-health --json` carry
22
+ `schema_version`, with a schema published for each of them.
23
+
24
+ The three outputs are stable surfaces and a field is added to each, so this is
25
+ a minor by the rule in `docs/compatibility.md` -- "Fields are added in minors"
26
+ -- and by the precedent of 1.1.0, whose own note reads "The agent channel's
27
+ read surfaces gain fields, which is an addition to a stable surface." No
28
+ command, option, exit code or entry point is added, removed or renamed.
29
+
30
+ The field was added because the three outputs were the only ones in that list
31
+ without it, so a consumer branching on it had nothing to branch on. The
32
+ published schemas are deliberately open at the top level, because the same
33
+ rule lets a later minor add fields to them.
34
+
35
+ The daemon's change is a fix that adds no field: every way enumerating a
36
+ repository can fail raised the same path-free `IngestError`, so the cause
37
+ chain rendered the class name alone and four different failures read
38
+ "IngestError" and could not be told apart. Each failure now raises a cause
39
+ carrying its own reason, and the chain names it. The message a caller sees is
40
+ unchanged.
41
+
42
+ The graph changes by what these fixes add. Measured on this repository: the
43
+ v1.6.0 tree built by the installed 1.6.0 engine, and this tree built by this
44
+ engine, each into fresh output, cache and state directories:
45
+
46
+ - 9,298 nodes become 9,322 and 25,599 edges become 25,655. The 24 new nodes
47
+ are the functions the daemon's fix adds, the three published schemas, the
48
+ new test's function, and the fixtures and helpers that go with them;
49
+ - every node id survives: 9,298 of 9,298 are in both, 24 are new and none is
50
+ removed; 8,742 of them keep their denotation exactly;
51
+ - 6,752 definition ids become 6,768: 6,196 keep their id and their definition,
52
+ and 556 keep their id but move line -- every one of them in the six files
53
+ this release touches (`tests/test_doctor.py` 383, `src/graphite/cli.py` 89,
54
+ `src/graphite/daemon.py` 35, `tests/test_agent_hooks_session_tagging.py` 18,
55
+ `src/graphite/ingest.py` 16, `tests/test_published_schemas.py` 15). No
56
+ definition id is removed and 16 are new;
57
+ - `calls` goes from 16,418 relation triples to 16,457, `contains` from 6,750 to
58
+ 6,766, `imports` stays at 2,480, and `inherits` goes from 121 to 122. 25,769
59
+ relation triples become 25,825, with 2 only in the old graph and 58 only in
60
+ the new one;
61
+ - 18 cycles where there were 18, the same ones, and 178 communities where
62
+ there were 175. The entry points, the orphans and the surprising
63
+ connections are identical; the god nodes and the top files by links differ,
64
+ because the new code adds and moves them;
65
+ - `resolution_health` is healthy on both sides: the `calls` ratio is 0.983
66
+ before and after, and `imports` is 1.0 on both.
67
+
68
+ `metadata.engine.fingerprint` moves, as it does whenever the engine's own
69
+ files change -- and they do: the identity hashes every `.py` and `.mjs` file
70
+ in the package, so a change to the daemon or the ingest moves it whether or
71
+ not the extraction changed.
72
+
73
+ The two builds above used different `tree-sitter` versions (0.25.2 for the
74
+ installed 1.6.0 and 0.26.0 for the dev environment), so the difference was
75
+ controlled for rather than assumed away: the SAME tree built by both engines
76
+ gives the same ids, the same edges and the same triples, node for node --
77
+ 9,322 nodes, 25,655 edges and all 25,825 relation triples identical, with no
78
+ id moved and none removed, and identical cycles, entry points, god nodes,
79
+ orphans, surprising connections, top files by links, clusters and
80
+ `resolution_health`. The figures above are therefore attributable to this
81
+ change and not to the parsers.
82
+
83
+ ### Added
84
+
85
+ - `check --json`, `validate --json` and `daemon-health --json` now carry
86
+ `schema_version`, which `docs/compatibility.md` already listed them as
87
+ carrying, and a schema for each is published under `docs/schemas/`. The
88
+ three outputs were the only ones in that list without the field, so a
89
+ consumer branching on it had nothing to branch on. A field is added to
90
+ three stable surfaces, so this is a minor by the rule in
91
+ `docs/compatibility.md` -- "Fields are added in minors" -- and the
92
+ published schemas are deliberately open at the top level, because the
93
+ same rule lets a later minor add fields to them.
94
+
95
+ ### Fixed
96
+
97
+ - The daemon's log now says WHICH way enumerating a repository failed.
98
+ Every one of those failures raises the same path-free `IngestError`
99
+ message, and the cause chain rendered the class name alone, so four
100
+ different failures read "IngestError" and could not be told apart -- the
101
+ same loss #113 fixed for Git's exit status. Each failure now raises a
102
+ cause carrying its own reason (`nested_git_root`,
103
+ `output_not_nul_terminated`, `too_many_records`, `path_not_contained`),
104
+ and the chain names it. The message a caller sees is unchanged, and no
105
+ command, option, exit code or JSON field changes.
106
+ - Tests: the three mutation survivors in `src/graphite/agent_hooks.py` are
107
+ now killed. A mutant the suite cannot kill is a behaviour the suite does
108
+ not pin, and the mutation gate's ledger recorded three of them: `or` ->
109
+ `and` in `_entry_is_this_session`, and `0` -> `1` twice in `handle_stop`
110
+ -- in the ledger's byte length when there is no ledger, and in the
111
+ cursor's offset when the state has none. The first two are pinned by the
112
+ one case that distinguishes them. The third had no such case and needed
113
+ one: a cursor state that lost its offset is a damaged cursor, and the
114
+ ledger is newline-delimited JSON, so an offset of 1 would cut the first
115
+ entry in half -- it would no longer parse, and the turn's own use would
116
+ go uncounted without a word. The default is 0, which is what the
117
+ function already does with a damaged cursor elsewhere. Each kill is
118
+ proved by applying the mutation and watching the test that is meant to
119
+ kill it fail, with the source restored byte-identical afterwards.
120
+
18
121
  ## [1.6.0] — 2026-10-27
19
122
 
20
123
  A minor release: the daemon's health report no longer reads "ok" while every
@@ -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`,
@@ -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.6.0, production/stable.** Published on PyPI as
5
+ **Status: 1.7.0, 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.6.0"
41
+ __version__ = "1.7.0"
@@ -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
@@ -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
 
@@ -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
@@ -15,6 +15,7 @@ terminal in the same repository is real use too.
15
15
  """
16
16
  from __future__ import annotations
17
17
 
18
+ import json
18
19
  from pathlib import Path
19
20
 
20
21
  import pytest
@@ -170,3 +171,94 @@ def test_a_command_run_by_a_session_is_tagged_with_that_session(tmp_path: Path,
170
171
  capsys.readouterr()
171
172
 
172
173
  assert [entry.get("session") for entry in iter_entries(tmp_path)] == ["A"]
174
+
175
+
176
+ def _write_entry_with_tag(root: Path, tag: str) -> None:
177
+ """Write one ledger entry by hand, carrying a tag the recorder cannot.
178
+
179
+ `record_usage` writes the session tag only when it is truthy, so an EMPTY
180
+ tag can only reach the ledger from outside -- a hand-edited file, or one
181
+ half-written by something else. That is exactly the case
182
+ `_entry_is_this_session` is defensive about, so the fixture writes the
183
+ entry in the recorder's own shape.
184
+ """
185
+ entry = {
186
+ "ts": "2026-01-01T00:00:00+00:00",
187
+ "cmd": "context",
188
+ "wall_ms": 50,
189
+ "output_bytes": 30,
190
+ "files": [{"path": "alpha.py", "bytes": (root / "alpha.py").stat().st_size}],
191
+ "session": tag,
192
+ }
193
+ path = usage_ledger.ledger_path(root)
194
+ path.parent.mkdir(parents=True, exist_ok=True)
195
+ with open(path, "a", encoding="utf-8") as handle:
196
+ handle.write(json.dumps(entry) + "\n")
197
+
198
+
199
+ def test_an_entry_whose_session_tag_is_empty_counts_for_every_session(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
200
+ """An EMPTY tag names no session, exactly as no tag at all does.
201
+
202
+ `_entry_is_this_session` accepts an entry that names no session, and the
203
+ condition that does it is `not isinstance(tag, str) or not tag`. Read as
204
+ `and`, an empty tag would fall through to `tag == session_id` and be
205
+ counted for NOBODY -- so a person running graphite in a terminal, whose
206
+ tag was written empty, would have their real use dropped. This pins the
207
+ `or`.
208
+ """
209
+ _start(repo, "A")
210
+ _start(repo, "B")
211
+ _write_entry_with_tag(repo, "")
212
+
213
+ assert _stop(repo, "A") is not None
214
+ assert _stop(repo, "B") is not None
215
+
216
+ unit = _one_entry_tokens(repo)
217
+ assert _session_tokens(repo, "A") == unit
218
+ assert _session_tokens(repo, "B") == unit
219
+
220
+
221
+ def test_a_stop_with_no_ledger_file_leaves_the_cursor_at_offset_zero(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
222
+ """No ledger means no bytes to read, so the cursor starts at zero.
223
+
224
+ `handle_stop` takes the ledger's byte length as `size`, and zero when
225
+ there is no ledger. That number is the cursor's offset, and the offset is
226
+ where the NEXT Stop reads from -- so a one-byte offset would mean
227
+ starting one byte into a ledger that did not exist yet, and the first
228
+ entry in it would be read from the wrong place. This pins the zero.
229
+ """
230
+ assert not usage_ledger.ledger_path(repo).exists()
231
+
232
+ assert _stop(repo, "A") is None
233
+
234
+ assert read_cursor(repo)["sessions"]["A"]["offset"] == 0
235
+
236
+
237
+ def test_a_cursor_state_without_an_offset_reads_the_ledger_from_its_start(
238
+ repo: Path, monkeypatch: pytest.MonkeyPatch
239
+ ) -> None:
240
+ """A state that lost its offset is a damaged cursor, and a damaged
241
+ cursor reads the ledger from the beginning.
242
+
243
+ The ledger is newline-delimited JSON, so the offset decides where a
244
+ line starts. An offset of 1 would cut the FIRST entry in half: it no
245
+ longer parses, and the turn's own use would go uncounted without a
246
+ word. The default is 0 because that is what this function already does
247
+ with a damaged cursor elsewhere -- an offset past the end of the ledger
248
+ resyncs to 0.
249
+ """
250
+ _start(repo, "A")
251
+ _use(repo, monkeypatch, "A")
252
+
253
+ # Damage the cursor: the session's state keeps no offset, and no inode
254
+ # either, so the rotation check cannot fire and the offset alone decides.
255
+ cursor = read_cursor(repo)
256
+ cursor["sessions"]["A"].pop("offset", None)
257
+ cursor["sessions"]["A"].pop("ino", None)
258
+ usage_ledger.write_cursor(repo, cursor)
259
+
260
+ summary = _stop(repo, "A")
261
+
262
+ unit = _one_entry_tokens(repo)
263
+ assert summary is not None
264
+ assert _session_tokens(repo, "A") == unit
@@ -118,7 +118,7 @@ def test_safe_text_decodes_utf8() -> None:
118
118
  [
119
119
  b"binary\x00payload",
120
120
  b"\xff\xfe not utf-8",
121
- b"api_key = sk-live-0123456789abcdef\n",
121
+ b"api_key = sk-" + b"live-0123456789abcdef\n",
122
122
  b"Authorization: Bearer abcdefghijklmnop\n",
123
123
  b"-----BEGIN RSA PRIVATE KEY-----\n",
124
124
  # Assembled so the source holds no credential-shaped literal.
@@ -271,7 +271,7 @@ def test_build_context_hashes_the_public_manifest_and_carries_source_only_when_a
271
271
  def test_build_context_counts_every_kind_of_exclusion(tmp_path: Path) -> None:
272
272
  (tmp_path / "src").mkdir()
273
273
  (tmp_path / "src" / "app.py").write_bytes(b"x = 1\n")
274
- (tmp_path / "src" / "secret.py").write_bytes(b"api_key = sk-live-0123456789abcdef\n")
274
+ (tmp_path / "src" / "secret.py").write_bytes(b"api_key = sk-" + b"live-0123456789abcdef\n")
275
275
  (tmp_path / ".env").write_bytes(b"A=1\n")
276
276
  graph = nx.DiGraph()
277
277
  graph.add_node("app", source_file="src/app.py")
@@ -505,3 +505,77 @@ def test_the_cause_chain_stops_at_a_bounded_depth() -> None:
505
505
 
506
506
  assert chain.count(" <- ") < 10
507
507
  assert chain.startswith("RuntimeError <- RuntimeError")
508
+
509
+
510
+ def _git_root(base: Path, name: str = "repo") -> Path:
511
+ """A directory that IS a Git root, so enumeration reaches the parser."""
512
+ root = base / name
513
+ root.mkdir(parents=True)
514
+ (root / ".git").mkdir()
515
+ return root
516
+
517
+
518
+ def _listing_runner(output: bytes):
519
+ """A GitRunner stand-in returning a fixed `ls-files` stdout."""
520
+ class _FakeRunner:
521
+ def __init__(self, project_root):
522
+ pass
523
+
524
+ def run(self, arguments, *, timeout_seconds, **kwargs):
525
+ return subprocess.CompletedProcess(arguments, 0, output, b"")
526
+
527
+ return _FakeRunner
528
+
529
+
530
+ @pytest.mark.parametrize(
531
+ ("mode", "expected_reason", "expected_message"),
532
+ [
533
+ ("nested_root", "nested_git_root", "nested Git roots are unsupported"),
534
+ ("output_not_terminated", "output_not_nul_terminated", SNAPSHOT_ERROR),
535
+ ("too_many_records", "too_many_records", SNAPSHOT_ERROR),
536
+ ("path_not_contained", "path_not_contained", SNAPSHOT_ERROR),
537
+ ],
538
+ )
539
+ def test_each_way_enumeration_fails_is_named_in_the_cause_chain(
540
+ tmp_path: Path,
541
+ monkeypatch: pytest.MonkeyPatch,
542
+ mode: str,
543
+ expected_reason: str,
544
+ expected_message: str,
545
+ ) -> None:
546
+ """Four different failures, four different reasons, one message.
547
+
548
+ `IngestError` says WHAT failed and not WHY, and every one of these
549
+ raises the same message, so the daemon's chain read "IngestError" four
550
+ times over and could not say which failure it was -- the same loss
551
+ #113 fixed for Git's exit status. The CAUSE now carries the reason, and
552
+ the message the caller sees is unchanged.
553
+ """
554
+ base = tmp_path / "projects"
555
+ base.mkdir()
556
+
557
+ if mode == "nested_root":
558
+ # A directory INSIDE a Git root, but not a root itself.
559
+ (base / ".git").mkdir()
560
+ root = base / "inner"
561
+ root.mkdir()
562
+ output = b""
563
+ else:
564
+ root = _git_root(base)
565
+ output = {
566
+ "output_not_terminated": b"file.py",
567
+ "too_many_records": b"a\0b\0c\0d\0",
568
+ "path_not_contained": b"../escape.py\0",
569
+ }[mode]
570
+
571
+ monkeypatch.setattr(ingest_module, "GitRunner", _listing_runner(output))
572
+ if mode == "too_many_records":
573
+ monkeypatch.setattr(ingest_module, "MAX_GIT_FILE_RECORDS", 2)
574
+
575
+ with pytest.raises(IngestError) as caught:
576
+ ingest_module._git_ls_files(root.resolve())
577
+
578
+ assert str(caught.value) == expected_message
579
+ assert describe_exception_chain(caught.value) == (
580
+ f"IngestError <- IngestEnumerationError:{expected_reason}"
581
+ )