witan-code 0.29.0__tar.gz → 0.31.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 (115) hide show
  1. {witan_code-0.29.0 → witan_code-0.31.0}/CHANGELOG.md +83 -0
  2. {witan_code-0.29.0 → witan_code-0.31.0}/PKG-INFO +11 -9
  3. {witan_code-0.29.0 → witan_code-0.31.0}/README.md +8 -6
  4. {witan_code-0.29.0 → witan_code-0.31.0}/docs/USER_GUIDE.md +5 -3
  5. {witan_code-0.29.0 → witan_code-0.31.0}/pyproject.toml +12 -4
  6. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_branches.py +132 -0
  7. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_cli_dispatch.py +74 -5
  8. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_cli_hooks.py +21 -0
  9. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_cli_output_format.py +17 -0
  10. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_context.py +32 -0
  11. witan_code-0.31.0/tests/test_diff_impact.py +589 -0
  12. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_edges.py +9 -2
  13. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_hooks.py +296 -17
  14. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_maintenance.py +33 -7
  15. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_remote_proxy.py +17 -5
  16. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_remote_store.py +36 -0
  17. witan_code-0.31.0/tests/test_search_docstrings.py +231 -0
  18. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_server.py +43 -0
  19. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_setup.py +9 -0
  20. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_visualize.py +69 -3
  21. witan_code-0.31.0/tests/test_why.py +381 -0
  22. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/cli.py +410 -47
  23. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/config.py +2 -2
  24. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/context.py +28 -4
  25. witan_code-0.31.0/witan_code/diff_impact.py +679 -0
  26. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/graph.py +4 -0
  27. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/hooks.py +70 -34
  28. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/indexer.py +129 -21
  29. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/maintenance.py +11 -5
  30. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/output.py +9 -1
  31. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries/bridge.gq +1 -1
  32. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries/code_read.gq +48 -0
  33. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/remote/store.py +25 -1
  34. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/schema/code-schema.pg +4 -1
  35. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/server.py +243 -47
  36. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/setup.py +15 -6
  37. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/skills/witan-code/SKILL.md +5 -4
  38. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/store.py +16 -0
  39. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/visualize.py +16 -8
  40. {witan_code-0.29.0 → witan_code-0.31.0}/.gitignore +0 -0
  41. {witan_code-0.29.0 → witan_code-0.31.0}/changelog.d/README.md +0 -0
  42. {witan_code-0.29.0 → witan_code-0.31.0}/config/claude.json +0 -0
  43. {witan_code-0.29.0 → witan_code-0.31.0}/config/copilot.json +0 -0
  44. {witan_code-0.29.0 → witan_code-0.31.0}/config/pi.json +0 -0
  45. {witan_code-0.29.0 → witan_code-0.31.0}/conftest.py +0 -0
  46. {witan_code-0.29.0 → witan_code-0.31.0}/docs/BRANCH_INDEXING.md +0 -0
  47. {witan_code-0.29.0 → witan_code-0.31.0}/docs/CLI_REFERENCE.md +0 -0
  48. {witan_code-0.29.0 → witan_code-0.31.0}/docs/EDGE_PRECISION_TIERS.md +0 -0
  49. {witan_code-0.29.0 → witan_code-0.31.0}/docs/PACKAGE_MAP.md +0 -0
  50. {witan_code-0.29.0 → witan_code-0.31.0}/docs/STAGE2_STITCHING.md +0 -0
  51. {witan_code-0.29.0 → witan_code-0.31.0}/docs/SYMBOL_FORMAT.md +0 -0
  52. {witan_code-0.29.0 → witan_code-0.31.0}/docs/SYMBOL_TABLE.md +0 -0
  53. {witan_code-0.29.0 → witan_code-0.31.0}/install.sh +0 -0
  54. {witan_code-0.29.0 → witan_code-0.31.0}/tests/__init__.py +0 -0
  55. {witan_code-0.29.0 → witan_code-0.31.0}/tests/conftest.py +0 -0
  56. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_batched_deletes.py +0 -0
  57. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_branches_served.py +0 -0
  58. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_bridge.py +0 -0
  59. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_chunked_load.py +0 -0
  60. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_cli_help_docstrings.py +0 -0
  61. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_cli_selected_target.py +0 -0
  62. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_config.py +0 -0
  63. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_config_targets.py +0 -0
  64. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_crossrepo.py +0 -0
  65. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_elicit.py +0 -0
  66. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_enrichment.py +0 -0
  67. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_github_app.py +0 -0
  68. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_graph.py +0 -0
  69. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_identity.py +0 -0
  70. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_index_failure_diagnostics.py +0 -0
  71. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_index_reports_its_store.py +0 -0
  72. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_index_requires_a_repo_key.py +0 -0
  73. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_indexer.py +0 -0
  74. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_indexer_scope.py +0 -0
  75. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_ingest.py +0 -0
  76. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_languages.py +0 -0
  77. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_package_map.py +0 -0
  78. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_reaper.py +0 -0
  79. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_rebuild_honours_the_repo_key.py +0 -0
  80. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_refusal_audit.py +0 -0
  81. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_repo.py +0 -0
  82. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_stitch.py +0 -0
  83. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_store.py +0 -0
  84. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_symbol_table.py +0 -0
  85. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_tasks.py +0 -0
  86. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_tool_schema.py +0 -0
  87. {witan_code-0.29.0 → witan_code-0.31.0}/tests/test_views.py +0 -0
  88. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/__init__.py +0 -0
  89. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/__main__.py +0 -0
  90. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/bridge.py +0 -0
  91. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/bridge_extractors.py +0 -0
  92. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/edges.py +0 -0
  93. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/elicit.py +0 -0
  94. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/extensions/pi/codegraph.ts +0 -0
  95. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/github_app.py +0 -0
  96. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/identity.py +0 -0
  97. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/ingest.py +0 -0
  98. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/package_map.py +0 -0
  99. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries/code_mutations.gq +0 -0
  100. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries/delete.gq +0 -0
  101. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/bash.scm +0 -0
  102. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/hcl.scm +0 -0
  103. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/python.scm +0 -0
  104. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/sql.scm +0 -0
  105. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/typescript.scm +0 -0
  106. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/queries_ts/yaml.scm +0 -0
  107. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/reaper.py +0 -0
  108. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/remote/__init__.py +0 -0
  109. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/remote/oidc.py +0 -0
  110. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/remote/proxy.py +0 -0
  111. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/repo.py +0 -0
  112. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/schema/bridge-schema.pg +0 -0
  113. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/selected_target.py +0 -0
  114. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/stitch.py +0 -0
  115. {witan_code-0.29.0 → witan_code-0.31.0}/witan_code/views.py +0 -0
@@ -8,6 +8,89 @@ a MINOR bump may include breaking changes).
8
8
 
9
9
  <!-- scriv-insert-here -->
10
10
 
11
+ ## [0.31.0] - 2026-11-13
12
+
13
+ ### Added
14
+
15
+ - `witan code why <path>` says whether a file is in the code graph, in the view the `code_*` tools read from its checkout, and if not, which indexer rule left it out (unsupported language, skipped directory, nested checkout, symlinked directory, gitignored) with the fix. An empty `code_*` result reads the same for an unused symbol and for a file the indexer never wrote; this tells the two apart. The rules are the indexer's own filter, now one function both the git-listing and disk-walk paths call, so the explanation cannot drift from what gets indexed. It reads the `--target`'s stores, and refuses (naming `code_transport`) when a remote URL sends the `code_*` reads to a deployment while the code-graph stores are local, since its answer would describe a graph those reads never use.
16
+
17
+ - `code_search_symbol` matches symbol docstrings as well as qualified names, so a query like "rate limiting" finds a symbol whose docstring describes it even when its name does not. A second BM25 run over `Symbol.docstring` is appended after the name run, keeping only the symbols the name run did not return, so a docstring-only match never outranks a name match, across a cross-repo fan-out too. Each run returns up to 50 symbols per store.
18
+
19
+ - `code_callers` takes `direction="callees"` to list the symbols a function calls, following the same `Calls` edges outward. The default, `direction="callers"`, is unchanged. Like the callers query it reads the checkout's branch view for the current repo.
20
+
21
+ - `witan code diff-impact --base origin/main` maps a branch's diff to the symbols it changes, by parsing both sides of each changed file with the indexer's parser (a decorator-only edit maps to the decorated symbol), then lists each symbol's callers, the bindings in other repos that share its env vars, endpoints and packages, the test files that name it (a stand-in for "tests to run", since the graph has no test-to-code edges), and the witan tasks and memories that cite it, plus the tasks claimed on the head branch. Every list carries its total next to what is shown (`--limit`, `--max-items`), changed test files are listed by file rather than looked up, renamed files are listed with a note that every symbol id in them moved, and the notes say what the answer cannot see: an unindexed repo, symbols missing from the index, callers in other files, and callers only this branch adds. Tasks and memories are skipped, with a note, when witan (council) is not installed. Honors `--output-format`. Its in-process lookups are pinned to the base branch's view, so a symbol the branch removed resolves against main even after the branch is indexed.
22
+ - `code_impact`, `code_cross_repo_impact` and `code_symbols_in_file` accept an optional `branch`, with the semantics `code_find_definition` already has: omitted, they follow the checkout's branch view for the current repo as before; `branch="main"` reads the default view from a checkout whose own branch is indexed. On `code_impact` it applies to the root symbol's repo, and on `code_cross_repo_impact` it selects that repo's bridge overlay. The server instructions now say which id-routed tools take `branch`.
23
+
24
+ ### Changed
25
+
26
+ - `code_find_definition` and `code_search_symbol` docs no longer contrast their `repo=""` with the witan memory/task tools, which now refuse an empty `repo` and take `all_repos=True` instead. Behaviour is unchanged.
27
+
28
+ - The `witan-code` skill points at `recall(symbol_id=…)` for the memories and
29
+ tasks attached to a symbol, since witan folded `symbol_context` into
30
+ `recall`.
31
+ - `witan code diff-impact` reads each changed symbol's tasks and memories
32
+ through `recall(symbol_id=…, hops=0, include_superseded=True)`. It still
33
+ called the removed `symbol_context`, so it failed on every changed non-test
34
+ symbol when witan was installed.
35
+
36
+ ### Fixed
37
+
38
+ - The optimize and cleanup throttle stamps
39
+ (`witan-code-{optimize,cleanup}-<digest>.json`) and the context hook's
40
+ cached bridge verdict (`codegraph-bridge-<digest>.probe`) moved from the bare
41
+ temp dir into witan-code's private per-user state dir, where the reindex
42
+ queue already lives (0700 under `$TMPDIR` on POSIX,
43
+ `%LOCALAPPDATA%\witan-code\state` on Windows). Another user could create a
44
+ predictable name in a shared `TMPDIR` first, as a file pinning a wrong
45
+ bridge verdict or as a symlink the write would follow. If the state dir is
46
+ refused, the hook probes the bridge uncached instead of dropping its block.
47
+ The first Stop hook after upgrading finds neither stamp, so it runs one
48
+ optimize and one `--cleanup-older-than 2d` cleanup that the old stamps might
49
+ have deferred (the cleanup by up to its 7-day window).
50
+
51
+ - `witan --target <name> code doctor` reads that target's code graphs. `doctor` used the config loaded when the server module was imported, which never sees a forwarded `--target`.
52
+
53
+ - `witan-code setup --agent codex` writes Codex's `witan-code` MCP entry as the installed `witan-code serve`, the same CLI its hooks call, instead of a `uvx --from git+…` entry. Which platforms get the CLI entry now follows agent-config-kit's registry: every platform it writes hooks for. Requires agent-config-kit 0.13, the first release with Codex hooks.
54
+ - `witan-code setup` warns when `witan-code` is not on PATH, since the hooks and the `witan-code serve` MCP entry it registers both need it.
55
+
56
+ - `code_repo_dependencies` and the bridge explorer draw the "ol-infrastructure
57
+ deploys repo X" edge again. The extractor has written a repo service anchor
58
+ as the bare repo URI with `sub_kind="repo"` since #7, but the graph builder
59
+ still looked for a `repo:` key prefix and the `all_bindings` read did not
60
+ return `sub_kind`, so no deployed graph ever had a service edge. Image and
61
+ app-name anchors still draw no edge: nothing in the indexed repos yet says
62
+ which repo builds an image.
63
+
64
+ ### Notes
65
+
66
+ - `Symbol.docstring` gains `@index` in `code-schema.pg`. On omnigraph 0.15 both `schema plan` (a local store) and `cluster plan` (a cluster) report it as one supported `add_constraint` step, and the apply indexes the docstrings already stored, so no code graph needs a rebuild. A local store gains the index on its next index, through the schema apply that already runs when the schema file changes. A cluster's `code-<repo>` graphs gain it when an omnigraph-server image built with this schema boots and runs `cluster apply`. Until a store has the index, omnigraph 0.15 refuses the docstring run (`T27`). A client reading through a deployed MCP tier (`code_transport = "mcp"`) older than this release is refused too, because the tier looks the query up in its own bundled `code_read.gq`. In both cases `code_search_symbol` returns name matches only and logs `witan.code.search.docstring_search_unavailable`.
67
+
68
+ ## [0.30.0] - 2026-11-12
69
+
70
+ ### Added
71
+
72
+ - The remote store client names itself `witan-code <version>` in its MCP `clientInfo` instead of the SDK default `mcp 0.1.0`, so the deployment's tool-call logs record which witan-code release made each call.
73
+
74
+ ### Changed
75
+
76
+ - The pending queue is guarded by its own `codegraph-<digest>.pending.lock` file instead of a lock on the queue file, because Windows locks are mandatory and would block the holder's own reads through another handle. A drainer from the previous version still running during an upgrade does not exclude the new lock, so one queued edit can be dropped, once; the next edit to that file reindexes it.
77
+ - Requires witan-core 0.52.0 or later, the first release with `witan_core._filelock`.
78
+
79
+ ### Fixed
80
+
81
+ - `witan-code symbols` with no detectable repo now prints its refusal to stderr and exits 1. It printed to stdout and exited 0, so a consumer parsing `--output-format json|toml|yaml` got a sentence instead of a document and could not tell the refusal from success.
82
+ - `witan-code branches --prune` against a remote deployment, a misconfigured remote (e.g. `WITAN_REMOTE_URL` without `WITAN_OIDC_ISSUER`), and a remote failure on any command (deployment unreachable, credential rejected, tool refused) print to stderr instead of stdout. All of them already exited 1. The umbrella `witan code ...` path prints remote failures through `witan`'s own handler instead, which goes to stderr from witan-council 0.48.0 and to stdout before it.
83
+
84
+ - The code-graph hooks (`session-init`, `reindex-hook` and the drainer they spawn) run on Windows. `witan_code.hooks` imported `fcntl` and `context.state_dir` called `os.getuid`, so every hook command failed there. The queue and checkout locks now go through `witan_core._filelock` (`flock` on POSIX, unchanged; `msvcrt.locking` on Windows). Windows cannot hand a lock to a child process, so there the hook checks the lock is free and the drainer takes it itself. The state directory on Windows is `%LOCALAPPDATA%\witan-code\state`, which only its owner can write to, rather than the temp dir, which `TEMP` can point at a shared directory.
85
+
86
+ - Error messages keep a long path on one line (e.g. the `reindex
87
+ --rebuild` refusal naming a subdirectory).
88
+ Rich hard-wrapped them at 80 columns when no standard stream is a
89
+ terminal (an agent's shell, a CI job), which put a newline inside any
90
+ longer path. Tables still wrap to the width.
91
+
92
+ - The edit and SessionStart hooks skip a repo the cluster does not serve instead of indexing it. Each attempt was refused with `ClusterGraphMissing`, which the hook discarded, but the server logged it and counted it as a failed tool call against its error-ratio alert. The drainer asks the cluster for its served graphs once per process (`code_store_graphs` through the MCP tier, `GET /graphs` direct) and indexes as before when that listing fails or comes back empty. An explicit `witan-code index` still reports the refusal.
93
+
11
94
  ## [0.29.0] - 2026-11-10
12
95
 
13
96
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: witan-code
3
- Version: 0.29.0
3
+ Version: 0.31.0
4
4
  Summary: witan-code — tree-sitter code graph + cross-repo bridge (mounts under `witan code`)
5
5
  Project-URL: Homepage, https://github.com/mitodl/agent-kit/tree/main/mcp/servers/witan-code
6
6
  Project-URL: Repository, https://github.com/mitodl/agent-kit
@@ -10,7 +10,7 @@ License-Expression: BSD-3-Clause
10
10
  Keywords: agent,code-graph,coding-agent,mcp,static-analysis,tree-sitter
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.11
13
- Requires-Dist: agent-config-kit<1,>=0.12
13
+ Requires-Dist: agent-config-kit<1,>=0.13
14
14
  Requires-Dist: cyclopts<6,>=4
15
15
  Requires-Dist: fastmcp<5,>=4
16
16
  Requires-Dist: joserfc<2,>=1.0
@@ -26,7 +26,7 @@ Requires-Dist: tree-sitter-sql<0.4,>=0.3
26
26
  Requires-Dist: tree-sitter-typescript<0.24,>=0.23
27
27
  Requires-Dist: tree-sitter-yaml<0.8,>=0.7
28
28
  Requires-Dist: tree-sitter<0.26,>=0.25
29
- Requires-Dist: witan-core[cli,observability,remote,sentry]<1,>=0.51.1
29
+ Requires-Dist: witan-core[cli,observability,remote,sentry]<1,>=0.52.0
30
30
  Provides-Extra: tasks
31
31
  Requires-Dist: fastmcp-tasks<5,>=4; extra == 'tasks'
32
32
  Description-Content-Type: text/markdown
@@ -246,8 +246,9 @@ file + a capture→kind map), and any new node types to `_DEF_NODE_TYPES`.
246
246
 
247
247
  ## Install
248
248
 
249
- witan-code is usually installed as part of the `witan` umbrella — `witan setup`
250
- wires both servers together via `uvx --from … --with …`. See the
249
+ witan-code is usually installed as part of the `witan` umbrella: one `witan
250
+ serve` mounts witan-code's `code_*` tools whenever witan-code is installed
251
+ alongside it, and `witan setup` registers that one server. See the
251
252
  [witan README](../witan/README.md) for the one-step setup.
252
253
 
253
254
  To use witan-code **standalone** (code graph only, no memory/task tools):
@@ -506,10 +507,10 @@ indexer first).
506
507
  |------|---------|
507
508
  | `code_find_definition(name)` | symbols whose name / qualified name matches |
508
509
  | `code_find_references(symbol_id)` | incoming `References` + `Calls` |
509
- | `code_callers(symbol_id)` | incoming `Calls` |
510
+ | `code_callers(symbol_id, direction="callers")` | incoming `Calls`; `direction="callees"` for outgoing |
510
511
  | `code_impact(symbol_id, max_depth=5, max_nodes=200)` | transitive callers via BFS |
511
512
  | `code_symbols_in_file(path)` | symbols defined in a file |
512
- | `code_search_symbol(query)` | BM25 search over symbol qualified names |
513
+ | `code_search_symbol(query)` | BM25 search over symbol qualified names, then docstrings (name matches first) |
513
514
  | `code_reindex(path=None)` | index/re-index the repo or a subpath |
514
515
 
515
516
  Cross-repo bridge tools (resolve the shared `_bridge.omni` store; return `[]` /
@@ -701,8 +702,9 @@ symlink or copy the directory into the equivalent path for your agent.
701
702
  ## Hooks
702
703
 
703
704
  Four hooks — all bare CLI commands, no wrapper scripts, so they need no
704
- bash or setsid. They do not run on Windows yet: the hook commands' queue
705
- lock and state directory still use POSIX-only calls. Named `witan-code <command>` below (standalone install via
705
+ bash or setsid and run on Windows as well as Linux and macOS (there against
706
+ a remote deployment, since omnigraph publishes no Windows binary for a local
707
+ store). Named `witan-code <command>` below (standalone install via
706
708
  `witan-code setup`); when `witan setup` folds this bundle in instead (see
707
709
  [Install](#install)), they register as `witan code <command>` so only
708
710
  `witan` needs to be on `PATH`. Register manually per
@@ -213,8 +213,9 @@ file + a capture→kind map), and any new node types to `_DEF_NODE_TYPES`.
213
213
 
214
214
  ## Install
215
215
 
216
- witan-code is usually installed as part of the `witan` umbrella — `witan setup`
217
- wires both servers together via `uvx --from … --with …`. See the
216
+ witan-code is usually installed as part of the `witan` umbrella: one `witan
217
+ serve` mounts witan-code's `code_*` tools whenever witan-code is installed
218
+ alongside it, and `witan setup` registers that one server. See the
218
219
  [witan README](../witan/README.md) for the one-step setup.
219
220
 
220
221
  To use witan-code **standalone** (code graph only, no memory/task tools):
@@ -473,10 +474,10 @@ indexer first).
473
474
  |------|---------|
474
475
  | `code_find_definition(name)` | symbols whose name / qualified name matches |
475
476
  | `code_find_references(symbol_id)` | incoming `References` + `Calls` |
476
- | `code_callers(symbol_id)` | incoming `Calls` |
477
+ | `code_callers(symbol_id, direction="callers")` | incoming `Calls`; `direction="callees"` for outgoing |
477
478
  | `code_impact(symbol_id, max_depth=5, max_nodes=200)` | transitive callers via BFS |
478
479
  | `code_symbols_in_file(path)` | symbols defined in a file |
479
- | `code_search_symbol(query)` | BM25 search over symbol qualified names |
480
+ | `code_search_symbol(query)` | BM25 search over symbol qualified names, then docstrings (name matches first) |
480
481
  | `code_reindex(path=None)` | index/re-index the repo or a subpath |
481
482
 
482
483
  Cross-repo bridge tools (resolve the shared `_bridge.omni` store; return `[]` /
@@ -668,8 +669,9 @@ symlink or copy the directory into the equivalent path for your agent.
668
669
  ## Hooks
669
670
 
670
671
  Four hooks — all bare CLI commands, no wrapper scripts, so they need no
671
- bash or setsid. They do not run on Windows yet: the hook commands' queue
672
- lock and state directory still use POSIX-only calls. Named `witan-code <command>` below (standalone install via
672
+ bash or setsid and run on Windows as well as Linux and macOS (there against
673
+ a remote deployment, since omnigraph publishes no Windows binary for a local
674
+ store). Named `witan-code <command>` below (standalone install via
673
675
  `witan-code setup`); when `witan setup` folds this bundle in instead (see
674
676
  [Install](#install)), they register as `witan code <command>` so only
675
677
  `witan` needs to be on `PATH`. Register manually per
@@ -55,9 +55,10 @@ index. See the main [README](../README.md) for the full two-layer table.
55
55
 
56
56
  ## Installation
57
57
 
58
- witan-code is usually installed as part of the `witan` umbrella package —
59
- `witan setup` wires both servers together and installs the shared
60
- `omnigraph` binary in one step. See the [witan README](../../witan/README.md)
58
+ witan-code is usually installed as part of the `witan` umbrella package: one
59
+ `witan serve` mounts witan-code's `code_*` tools whenever witan-code is
60
+ installed alongside it, and `witan setup` registers that one server and
61
+ installs the shared `omnigraph` binary in one step. See the [witan README](../../witan/README.md)
61
62
  for that one-step setup.
62
63
 
63
64
  To use witan-code **standalone** (code graph only, no memory/task tools):
@@ -131,6 +132,7 @@ copy the matching snippet from `config/` into your agent's config — see
131
132
 
132
133
  ```bash
133
134
  code_callers(symbol_id="https://github.com/org/repo#app/client.py::ServiceClient.run")
135
+ code_callers(symbol_id="...", direction="callees") # what it calls
134
136
  code_impact(symbol_id="...", max_depth=5, max_nodes=200) # transitive callers
135
137
  ```
136
138
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "witan-code"
3
- version = "0.29.0"
3
+ version = "0.31.0"
4
4
  description = "witan-code — tree-sitter code graph + cross-repo bridge (mounts under `witan code`)"
5
5
  readme = "README.md"
6
6
  license = "BSD-3-Clause"
@@ -30,7 +30,11 @@ dependencies = [
30
30
  # pi-mcp-adapter is missing when Pi's built-in MCP will load the entry
31
31
  # from 0.12.0. Older resolutions import and run, and print the false
32
32
  # warning.
33
- "agent-config-kit>=0.12,<1",
33
+ # >=0.13: Codex hooks (and the codex platform itself) arrive in 0.13.0.
34
+ # `cli_hook_platforms()` reads them from the registry, so an older
35
+ # resolution writes Codex a uvx MCP entry, and `--agent codex` raises
36
+ # KeyError on the missing platform.
37
+ "agent-config-kit>=0.13,<1",
34
38
  # `remote`: the ADR-0005 client stack (OIDC device grant + MCP-client
35
39
  # proxy) behind `witan-code login` and the read commands' remote mode.
36
40
  # Costs nothing extra in practice — fastmcp is already required here and
@@ -218,7 +222,11 @@ dependencies = [
218
222
  # imports and runs, but batches nodes and edges apart, so every flush adds
219
223
  # a commit to the user's code branch. `_hashes_need_deferring` calls the
220
224
  # same `chunk_records`, so 0.51.0 stays correct, only slower on the graph.
221
- "witan-core[cli,remote,observability,sentry]>=0.51.1,<1",
225
+ #
226
+ # ★ >=0.52 IS AN IMPORT FLOOR: hooks.py imports `witan_core._filelock`
227
+ # (added in witan-core 0.52.0 by #601) at module scope, so 0.51.1 cannot
228
+ # import the hook commands at all.
229
+ "witan-core[cli,remote,observability,sentry]>=0.52.0,<1",
222
230
  "fastmcp>=4,<5",
223
231
  "cyclopts>=4,<6",
224
232
  # [targets.<name>] override models (config.py) — also transitively pulled
@@ -301,7 +309,7 @@ testpaths = ["tests"]
301
309
  packages = ["witan_code"]
302
310
 
303
311
  [tool.bumpversion]
304
- current_version = "0.29.0"
312
+ current_version = "0.31.0"
305
313
  allow_dirty = true
306
314
 
307
315
  [[tool.bumpversion.files]]
@@ -597,6 +597,48 @@ def test_two_writers_on_one_branch_do_not_overwrite_each_other(tmp_path, monkeyp
597
597
  assert not _has("act-bob/feature_shared", "alice_only_symbol")
598
598
 
599
599
 
600
+ @requires_stack
601
+ def test_callees_follow_the_checkouts_branch_view(tmp_path, monkeypatch):
602
+ """`code_callers(direction="callees")` routes by symbol id like the callers
603
+ query does, so on a feature branch it reads that branch's view: a call the
604
+ branch added shows up there and nowhere on main."""
605
+ from witan_code import config as cfg_mod
606
+ from witan_code import indexer
607
+ from witan_code import server as srv
608
+
609
+ monkeypatch.setenv("WITAN_REPO", REPO)
610
+ monkeypatch.setenv("WITAN_CODE_DIR", str(tmp_path / "code"))
611
+ monkeypatch.setattr(srv, "cfg", cfg_mod.load())
612
+
613
+ def reset():
614
+ srv._clients.clear()
615
+ srv._store_branches.clear()
616
+ srv._git_context.clear()
617
+
618
+ reset()
619
+ base = _git_repo(tmp_path / "r")
620
+ (base / "svc.py").write_text(SAMPLE)
621
+ indexer.index_path(base, config=srv.cfg)
622
+
623
+ _git(base, "checkout", "-q", "-b", "feature/x")
624
+ (base / "svc.py").write_text(
625
+ SAMPLE.replace("return helper()", "audit()\n return helper()")
626
+ + "\n\ndef audit():\n return 0\n"
627
+ )
628
+ indexer.index_path(base, config=srv.cfg)
629
+
630
+ run_id = f"{REPO}#svc.py::Service.run"
631
+ monkeypatch.chdir(base)
632
+ reset()
633
+ on_branch = _fn(srv.code_callers)(run_id, direction="callees")
634
+ assert {c["qualified_name"] for c in on_branch} == {"audit", "helper"}
635
+
636
+ _git(base, "checkout", "-q", "main")
637
+ reset()
638
+ on_main = _fn(srv.code_callers)(run_id, direction="callees")
639
+ assert {c["qualified_name"] for c in on_main} == {"helper"}
640
+
641
+
600
642
  @requires_stack
601
643
  def test_a_reader_can_enumerate_every_writers_view_of_a_branch(tmp_path, monkeypatch):
602
644
  """Isolation and visibility are not in tension: the views are separated by
@@ -781,3 +823,93 @@ def test_a_branch_name_with_a_slash_is_not_read_as_a_view_name(tmp_path, monkeyp
781
823
  "slashed_branch_symbol", repo=REPO, branch="feature/new-api"
782
824
  )
783
825
  assert found, "a raw git branch with a slash must map through sanitization"
826
+
827
+
828
+ # ── `branch` on the id- and file-routed tools ─────────────────────
829
+ #
830
+ # Locally, these tools follow the checkout's branch view once it is indexed.
831
+ # A symbol that branch removed is gone from that view, so a caller asking
832
+ # "what did this removal break" needs to read main: `branch="main"`.
833
+
834
+ MAIN_SVC = SAMPLE + (
835
+ '\n\ndef retired():\n return os.environ["SHARED_URL"] or helper()\n'
836
+ )
837
+ BRANCH_SVC = SAMPLE + "\n\ndef fresh():\n return helper()\n"
838
+ PROVIDER = "https://github.com/test/infra"
839
+
840
+
841
+ @pytest.fixture
842
+ def removal_on_an_indexed_branch(tmp_path, monkeypatch):
843
+ """`retired` on main, gone on `feature/x` (indexed), `fresh` added there.
844
+
845
+ `retired` reads SHARED_URL, which a second repo provides, so it has a
846
+ cross-repo surface on main and none in the branch's overlay.
847
+ """
848
+ from witan_code import config as cfg_mod
849
+ from witan_code import indexer
850
+ from witan_code import server as srv
851
+
852
+ monkeypatch.setenv("WITAN_CODE_DIR", str(tmp_path / "code"))
853
+ monkeypatch.setattr(srv, "cfg", cfg_mod.load())
854
+
855
+ infra = tmp_path / "infra"
856
+ infra.mkdir()
857
+ (infra / "Pulumi.QA.yaml").write_text(
858
+ 'config:\n app:env_vars:\n SHARED_URL: "https://x.example.com"\n'
859
+ )
860
+ indexer.index_path(infra, repo_override=PROVIDER, config=srv.cfg)
861
+
862
+ monkeypatch.setenv("WITAN_REPO", REPO)
863
+ base = _git_repo(tmp_path / "r")
864
+ (base / "svc.py").write_text("import os\n" + MAIN_SVC)
865
+ indexer.index_path(base, config=srv.cfg)
866
+ _git(base, "checkout", "-q", "-b", "feature/x")
867
+ (base / "svc.py").write_text("import os\n" + BRANCH_SVC)
868
+ indexer.index_path(base, config=srv.cfg)
869
+
870
+ monkeypatch.chdir(base)
871
+ srv._clients.clear()
872
+ srv._store_branches.clear()
873
+ srv._git_context.clear()
874
+ return srv
875
+
876
+
877
+ @requires_stack
878
+ def test_symbols_in_file_reads_the_named_branchs_view(removal_on_an_indexed_branch):
879
+ srv = removal_on_an_indexed_branch
880
+
881
+ def names(**kwargs):
882
+ rows = _fn(srv.code_symbols_in_file)("svc.py", repo=REPO, **kwargs)
883
+ return {r["qualified_name"] for r in rows}
884
+
885
+ on_branch, on_main = names(), names(branch="main")
886
+ assert "fresh" in on_branch and "retired" not in on_branch
887
+ assert "retired" in on_main and "fresh" not in on_main
888
+
889
+
890
+ @requires_stack
891
+ def test_impact_walks_the_named_branchs_view(removal_on_an_indexed_branch):
892
+ srv = removal_on_an_indexed_branch
893
+ helper = f"{REPO}#svc.py::helper"
894
+
895
+ def callers(**kwargs):
896
+ impact = _fn(srv.code_impact)(helper, max_depth=1, **kwargs)
897
+ return {c["qualified_name"] for c in impact["impacted"]}
898
+
899
+ on_branch, on_main = callers(), callers(branch="main")
900
+ assert "fresh" in on_branch and "retired" not in on_branch
901
+ assert "retired" in on_main and "fresh" not in on_main
902
+
903
+
904
+ @requires_stack
905
+ def test_cross_repo_impact_reads_the_named_branchs_overlay(
906
+ removal_on_an_indexed_branch,
907
+ ):
908
+ srv = removal_on_an_indexed_branch
909
+ retired = f"{REPO}#svc.py::retired"
910
+
911
+ on_branch = _fn(srv.code_cross_repo_impact)(retired)
912
+ assert on_branch["cross_repo"] == [], "the branch's overlay no longer has it"
913
+
914
+ on_main = _fn(srv.code_cross_repo_impact)(retired, branch="main")
915
+ assert {b["repo"] for b in on_main["cross_repo"]} == {PROVIDER}
@@ -9,6 +9,7 @@ regression here fails loudly instead of quietly going local-only.
9
9
 
10
10
  from __future__ import annotations
11
11
 
12
+ import os
12
13
  from types import SimpleNamespace
13
14
 
14
15
  import pytest
@@ -109,7 +110,12 @@ def test_symbols_never_sends_a_directory_name_to_a_deployment(
109
110
 
110
111
  monkeypatch.setattr("witan_code.repo.detect", _detect)
111
112
 
112
- cli_module.symbols()
113
+ if remote:
114
+ with pytest.raises(SystemExit) as exc:
115
+ cli_module.symbols()
116
+ assert exc.value.code == 1
117
+ else:
118
+ cli_module.symbols()
113
119
 
114
120
  # Last, not only: the local path loads config, whose target match detects too.
115
121
  assert seen[-1] is fallback
@@ -284,10 +290,13 @@ def test_branches_prune_is_refused_in_remote_mode(monkeypatch, capsys):
284
290
  monkeypatch.setattr(cli_module, "_srv", lambda: _stub(code_indexed_branches=[]))
285
291
  monkeypatch.setattr(cli_module, "_is_remote", lambda: True)
286
292
 
287
- with pytest.raises(SystemExit):
293
+ with pytest.raises(SystemExit) as exc:
288
294
  cli_module.branches(prune=True)
289
295
 
290
- assert "does not share" in capsys.readouterr().out
296
+ assert exc.value.code == 1
297
+ captured = capsys.readouterr()
298
+ assert "does not share" in captured.err
299
+ assert captured.out == ""
291
300
 
292
301
 
293
302
  def test_branches_prune_is_refused_against_a_shared_store(monkeypatch, capsys):
@@ -354,11 +363,71 @@ def test_rebuild_refuses_a_path_that_is_not_the_repo_root(
354
363
  with pytest.raises(SystemExit):
355
364
  cli_module._rebuild_stores(sub, yes=True, slug="https://github.com/test/cg")
356
365
 
357
- out = capsys.readouterr().out
366
+ # Rich hard-wraps at the console width, and the wrap point moves with the
367
+ # length of tmp_path (i.e. TMPDIR), so compare with whitespace collapsed.
368
+ out = " ".join(capsys.readouterr().out.split())
358
369
  assert "not the repo root" in out
359
370
  assert str(root) in out
360
371
 
361
372
 
373
+ def _no_terminal(monkeypatch):
374
+ """Make Rich see no terminal on any standard stream, with COLUMNS unset.
375
+
376
+ Rich sizes a console from fds 0, 1 and 2 before falling back to 80, so
377
+ clearing COLUMNS alone still picks up a terminal under ``pytest -s``.
378
+ """
379
+ from rich.console import Console
380
+
381
+ def _not_a_terminal(*_args):
382
+ raise OSError
383
+
384
+ monkeypatch.delenv("COLUMNS", raising=False)
385
+ monkeypatch.setattr(os, "get_terminal_size", _not_a_terminal)
386
+ assert Console().width == 80
387
+
388
+
389
+ def test_rebuild_refusal_keeps_a_long_path_on_one_line_when_piped(
390
+ tmp_path, monkeypatch, capsys
391
+ ):
392
+ """With no standard stream a terminal and COLUMNS unset, Rich renders at
393
+ 80 columns, which is how an agent's shell or a CI job sees this CLI. A
394
+ hard-wrapped path longer than that is folded with a newline inside it, so
395
+ the path copied out of the refusal is not the path on disk.
396
+ """
397
+ from witan_code import repo as repo_module
398
+
399
+ _no_terminal(monkeypatch)
400
+ root = (
401
+ tmp_path
402
+ / "a-directory-name-long-enough-to-push-the-whole-path-past-eighty-columns"
403
+ )
404
+ sub = root / "src"
405
+ sub.mkdir(parents=True)
406
+ assert len(str(sub)) > 80
407
+ monkeypatch.setattr(repo_module, "git_toplevel", lambda _p: root)
408
+
409
+ with pytest.raises(SystemExit):
410
+ cli_module._rebuild_stores(sub, yes=True, slug="https://github.com/test/cg")
411
+
412
+ lines = capsys.readouterr().out.splitlines()
413
+ assert any(f"{sub} is not the repo root" in line for line in lines), lines
414
+
415
+
416
+ @pytest.mark.parametrize("stderr", [False, True])
417
+ def test_print_error_keeps_a_long_path_on_one_line_on_either_stream(
418
+ tmp_path, monkeypatch, capsys, stderr
419
+ ):
420
+ _no_terminal(monkeypatch)
421
+ path = tmp_path / ("x" * 80) / "store.omni"
422
+
423
+ cli_module.print_error(f"cannot open [qa] store {path}", stderr=stderr)
424
+
425
+ captured = capsys.readouterr()
426
+ text = captured.err if stderr else captured.out
427
+ assert (captured.out if stderr else captured.err) == ""
428
+ assert any(f"[qa] store {path}" in line for line in text.splitlines()), text
429
+
430
+
362
431
  def test_rebuild_refuses_a_file_path_with_real_git(tmp_path, monkeypatch, capsys):
363
432
  """`index`/`reindex` accept a FILE, and `git -C <file>` exits 128.
364
433
 
@@ -386,4 +455,4 @@ def test_rebuild_refuses_a_file_path_with_real_git(tmp_path, monkeypatch, capsys
386
455
  with pytest.raises(SystemExit):
387
456
  cli_module._rebuild_stores(target, yes=True, slug="https://github.com/test/cg")
388
457
 
389
- assert "not the repo root" in capsys.readouterr().out
458
+ assert "not the repo root" in " ".join(capsys.readouterr().out.split())
@@ -135,3 +135,24 @@ def test_inject_context_cmd_passes_an_explicit_client_through(monkeypatch, clien
135
135
  command(*bound.args, **bound.kwargs)
136
136
 
137
137
  assert seen == [client]
138
+
139
+
140
+ @pytest.mark.parametrize(
141
+ ("argv", "lock_fd"),
142
+ [
143
+ (["_drain-pending", "repo", "7"], 7), # POSIX: the inherited lock
144
+ (["_drain-pending", "repo"], None), # Windows: the drainer locks
145
+ ],
146
+ )
147
+ def test_drain_pending_cmd_takes_an_optional_lock_fd(monkeypatch, argv, lock_fd):
148
+ import witan_code.hooks as hooks_module
149
+
150
+ seen = []
151
+ monkeypatch.setattr(
152
+ hooks_module, "drain_pending", lambda checkout, fd: seen.append(fd)
153
+ )
154
+
155
+ command, bound, _ = cli.app.parse_args(argv)
156
+ command(*bound.args, **bound.kwargs)
157
+
158
+ assert seen == [lock_fd]
@@ -200,6 +200,23 @@ def test_a_bracketed_title_is_not_escaped_in_structured_output(capsys):
200
200
  assert json.loads(capsys.readouterr().out)["title"] == "Symbol table — [local]"
201
201
 
202
202
 
203
+ @pytest.mark.parametrize("fmt", ["json", "toml", "yaml"])
204
+ def test_symbols_with_no_repo_fails_on_stderr(monkeypatch, capsys, fmt):
205
+ """A refusal is not a document: stdout stays empty for the parser and the
206
+ exit status says the command did not run."""
207
+ output_module.set_output_format(fmt)
208
+ monkeypatch.setattr(cli_module, "_is_remote", lambda: True)
209
+ monkeypatch.setattr("witan_code.repo.detect", lambda *a, **kw: None)
210
+
211
+ with pytest.raises(SystemExit) as exc:
212
+ cli_module.symbols()
213
+
214
+ assert exc.value.code == 1
215
+ captured = capsys.readouterr()
216
+ assert captured.out == ""
217
+ assert "No repo detected" in captured.err
218
+
219
+
203
220
  def test_launcher_sets_output_format_and_forwards_tokens(monkeypatch):
204
221
  calls = []
205
222
  monkeypatch.setattr(cli_module, "app", lambda tokens: calls.append(tokens))
@@ -293,8 +293,13 @@ def test_the_bridge_verdict_is_cached_across_processes(tmp_path, monkeypatch):
293
293
  (code_dir / "_bridge.omni").mkdir(parents=True)
294
294
  monkeypatch.setenv("WITAN_CODE_DIR", str(code_dir))
295
295
  monkeypatch.setenv("TMPDIR", str(tmp_path))
296
+ monkeypatch.setattr(tempfile, "tempdir", str(tmp_path))
297
+ monkeypatch.setenv("LOCALAPPDATA", str(tmp_path))
296
298
  cfg = cfg_mod.load()
297
299
 
300
+ # In the private state dir, not the bare temp dir another user can write.
301
+ assert context._bridge_probe_path(cfg).parent == context.state_dir()
302
+
298
303
  probes = []
299
304
 
300
305
  def _probe(ref, config=None, *, bridge=False):
@@ -318,6 +323,33 @@ def test_the_bridge_verdict_is_cached_across_processes(tmp_path, monkeypatch):
318
323
  assert len(probes) == 2
319
324
 
320
325
 
326
+ def test_a_refused_state_dir_probes_uncached(tmp_path, monkeypatch):
327
+ """state_dir() raises when its directory is not ours. The verdict must
328
+ still come back, uncached, rather than the raise blanking the block."""
329
+ from witan_code import config as cfg_mod
330
+
331
+ code_dir = tmp_path / "code"
332
+ (code_dir / "_bridge.omni").mkdir(parents=True)
333
+ monkeypatch.setenv("WITAN_CODE_DIR", str(code_dir))
334
+ cfg = cfg_mod.load()
335
+
336
+ def _refused():
337
+ raise PermissionError("not a directory owned by this user")
338
+
339
+ monkeypatch.setattr(context, "state_dir", _refused)
340
+ probes = []
341
+
342
+ def _probe(ref, config=None, *, bridge=False):
343
+ probes.append(ref)
344
+ return context.store_module.StoreHealth(ref, None, error="stale")
345
+
346
+ monkeypatch.setattr(context.store_module, "store_health", _probe)
347
+
348
+ assert context._bridge_ok(cfg) is False
349
+ assert context._bridge_ok(cfg) is False
350
+ assert len(probes) == 2
351
+
352
+
321
353
  def test_lock_path_does_not_collide_on_sanitization(tmp_path, monkeypatch):
322
354
  monkeypatch.setattr(tempfile, "tempdir", str(tmp_path))
323
355