witan-code 0.12.0__tar.gz → 0.12.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. {witan_code-0.12.0 → witan_code-0.12.1}/CHANGELOG.md +21 -0
  2. {witan_code-0.12.0 → witan_code-0.12.1}/PKG-INFO +2 -2
  3. {witan_code-0.12.0 → witan_code-0.12.1}/pyproject.toml +9 -8
  4. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_remote_store.py +46 -0
  5. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/remote/store.py +9 -1
  6. {witan_code-0.12.0 → witan_code-0.12.1}/.gitignore +0 -0
  7. {witan_code-0.12.0 → witan_code-0.12.1}/README.md +0 -0
  8. {witan_code-0.12.0 → witan_code-0.12.1}/config/claude.json +0 -0
  9. {witan_code-0.12.0 → witan_code-0.12.1}/config/copilot.json +0 -0
  10. {witan_code-0.12.0 → witan_code-0.12.1}/config/pi.json +0 -0
  11. {witan_code-0.12.0 → witan_code-0.12.1}/docs/BRANCH_INDEXING.md +0 -0
  12. {witan_code-0.12.0 → witan_code-0.12.1}/docs/CLI_REFERENCE.md +0 -0
  13. {witan_code-0.12.0 → witan_code-0.12.1}/docs/EDGE_PRECISION_TIERS.md +0 -0
  14. {witan_code-0.12.0 → witan_code-0.12.1}/docs/PACKAGE_MAP.md +0 -0
  15. {witan_code-0.12.0 → witan_code-0.12.1}/docs/STAGE2_STITCHING.md +0 -0
  16. {witan_code-0.12.0 → witan_code-0.12.1}/docs/SYMBOL_FORMAT.md +0 -0
  17. {witan_code-0.12.0 → witan_code-0.12.1}/docs/SYMBOL_TABLE.md +0 -0
  18. {witan_code-0.12.0 → witan_code-0.12.1}/docs/USER_GUIDE.md +0 -0
  19. {witan_code-0.12.0 → witan_code-0.12.1}/install.sh +0 -0
  20. {witan_code-0.12.0 → witan_code-0.12.1}/tests/__init__.py +0 -0
  21. {witan_code-0.12.0 → witan_code-0.12.1}/tests/conftest.py +0 -0
  22. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_batched_deletes.py +0 -0
  23. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_branches.py +0 -0
  24. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_bridge.py +0 -0
  25. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_chunked_load.py +0 -0
  26. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_cli_dispatch.py +0 -0
  27. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_cli_hooks.py +0 -0
  28. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_cli_output_format.py +0 -0
  29. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_config.py +0 -0
  30. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_config_targets.py +0 -0
  31. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_context.py +0 -0
  32. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_crossrepo.py +0 -0
  33. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_edges.py +0 -0
  34. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_elicit.py +0 -0
  35. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_enrichment.py +0 -0
  36. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_github_app.py +0 -0
  37. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_graph.py +0 -0
  38. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_hooks.py +0 -0
  39. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_identity.py +0 -0
  40. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_indexer.py +0 -0
  41. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_indexer_scope.py +0 -0
  42. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_ingest.py +0 -0
  43. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_languages.py +0 -0
  44. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_maintenance.py +0 -0
  45. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_package_map.py +0 -0
  46. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_reaper.py +0 -0
  47. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_remote_proxy.py +0 -0
  48. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_repo.py +0 -0
  49. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_server.py +0 -0
  50. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_setup.py +0 -0
  51. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_stitch.py +0 -0
  52. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_store.py +0 -0
  53. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_symbol_table.py +0 -0
  54. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_tasks.py +0 -0
  55. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_views.py +0 -0
  56. {witan_code-0.12.0 → witan_code-0.12.1}/tests/test_visualize.py +0 -0
  57. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/__init__.py +0 -0
  58. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/__main__.py +0 -0
  59. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/bridge.py +0 -0
  60. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/bridge_extractors.py +0 -0
  61. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/cli.py +0 -0
  62. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/config.py +0 -0
  63. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/context.py +0 -0
  64. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/edges.py +0 -0
  65. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/elicit.py +0 -0
  66. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/extensions/pi/codegraph.ts +0 -0
  67. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/github_app.py +0 -0
  68. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/graph.py +0 -0
  69. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/hooks.py +0 -0
  70. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/identity.py +0 -0
  71. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/indexer.py +0 -0
  72. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/ingest.py +0 -0
  73. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/maintenance.py +0 -0
  74. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/output.py +0 -0
  75. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/package_map.py +0 -0
  76. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries/bridge.gq +0 -0
  77. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries/code_mutations.gq +0 -0
  78. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries/code_read.gq +0 -0
  79. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries/delete.gq +0 -0
  80. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/bash.scm +0 -0
  81. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/hcl.scm +0 -0
  82. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/python.scm +0 -0
  83. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/sql.scm +0 -0
  84. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/typescript.scm +0 -0
  85. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/queries_ts/yaml.scm +0 -0
  86. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/reaper.py +0 -0
  87. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/remote/__init__.py +0 -0
  88. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/remote/oidc.py +0 -0
  89. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/remote/proxy.py +0 -0
  90. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/repo.py +0 -0
  91. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/schema/bridge-schema.pg +0 -0
  92. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/schema/code-schema.pg +0 -0
  93. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/server.py +0 -0
  94. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/setup.py +0 -0
  95. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/skills/witan-code/SKILL.md +0 -0
  96. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/stitch.py +0 -0
  97. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/store.py +0 -0
  98. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/views.py +0 -0
  99. {witan_code-0.12.0 → witan_code-0.12.1}/witan_code/visualize.py +0 -0
@@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/) (pre-1.0:
7
7
  a MINOR bump may include breaking changes).
8
8
 
9
+ ## [0.12.1] - 2026-08-07
10
+
11
+ ### Fixed
12
+
13
+ - **`RemoteStoreClient.load` sized its batches by the wrong ceiling.** The same
14
+ defect found in witan's `migrate merge`, latent here: `load` defaulted to
15
+ `LOAD_MAX_BYTES` (omnigraph's 8 MiB buffered-body budget) while this transport
16
+ ships records as a JSON tool parameter, where the MCP SDK caps request bodies
17
+ at 4 MiB. A large enough index over `code_transport = "mcp"` would have failed
18
+ with `413 Request body too large` — from the SDK rather than from omnigraph.
19
+ Now defaults to `witan_core.chunking.MCP_LOAD_MAX_BYTES`.
20
+
21
+ Not hit in practice before now, which is why it is recorded as a fix rather
22
+ than a regression: the deployed indexer does not use this transport.
23
+
24
+ ### Changed
25
+
26
+ - **Requires `witan-core>=0.11`** — `remote/store.py` evaluates
27
+ `MCP_LOAD_MAX_BYTES` as a default argument, so it resolves at import time and
28
+ 0.10 does not export it.
29
+
9
30
  ## [0.12.0] - 2026-08-07
10
31
 
11
32
  > Also covers 0.11.0 and 0.11.1, published from the workspace without their own
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: witan-code
3
- Version: 0.12.0
3
+ Version: 0.12.1
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
@@ -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]<1,>=0.10
29
+ Requires-Dist: witan-core[cli,observability,remote]<1,>=0.11
30
30
  Provides-Extra: tasks
31
31
  Requires-Dist: fastmcp-tasks<5,>=4.0.0b1; extra == 'tasks'
32
32
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "witan-code"
3
- version = "0.12.0"
3
+ version = "0.12.1"
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"
@@ -15,15 +15,16 @@ dependencies = [
15
15
  # proxy) behind `witan-code login` and the read commands' remote mode.
16
16
  # Costs nothing extra in practice — fastmcp is already required here and
17
17
  # itself depends on httpx2, the extra's only other dependency.
18
- # >=0.10: graph.py and remote/store.py import witan_core.chunking and call
19
- # OmnigraphClient.load_batch at module scope — both moved up from this
20
- # package into witan-core so a code index and a memory merge share one
21
- # split rule, so 0.9 has neither. A looser floor lets an external install
22
- # resolve a witan-core the server cannot even import. (>=0.9 was already
23
- # required for witan_core.observability.middleware; >=0.8 for
18
+ # >=0.11: remote/store.py evaluates witan_core.chunking.MCP_LOAD_MAX_BYTES
19
+ # as a default argument — so it resolves at import time, and 0.10 does not
20
+ # export it. A looser floor lets an external install resolve a witan-core
21
+ # the server cannot even import; that is what this pin is for, and it has
22
+ # now been tripped twice.
23
+ # (>=0.10 was already required for witan_core.chunking + load_batch, both
24
+ # moved up from this package; >=0.9 for observability.middleware; >=0.8 for
24
25
  # OmnigraphClient.change_many with chunk_size on the batched reindex
25
26
  # deletes.)
26
- "witan-core[cli,remote,observability]>=0.10,<1",
27
+ "witan-core[cli,remote,observability]>=0.11,<1",
27
28
  "fastmcp>=3.4.2,<5",
28
29
  "cyclopts>=4,<5",
29
30
  # [targets.<name>] override models (config.py) — also transitively pulled
@@ -365,6 +365,52 @@ def test_cluster_side_operations_are_refused_not_faked(call):
365
365
  call(RemoteStoreClient(REPO, session))
366
366
 
367
367
 
368
+ def test_load_chunks_against_the_mcp_budget_not_omnigraph_s():
369
+ """Regression: records ride as a JSON tool parameter, so the SDK cap binds.
370
+
371
+ `load` defaulted to `LOAD_MAX_BYTES` — omnigraph's 8 MiB buffered-body
372
+ budget — while this transport's real ceiling is the MCP Python SDK's 4 MiB
373
+ request cap. A large enough index would have failed here exactly as `witan
374
+ migrate merge` did against the deployment: `413 Request body too large`,
375
+ from the SDK rather than from omnigraph.
376
+
377
+ Asserts on the request bodies these batches actually become, not on the
378
+ batch count, so the JSONL-vs-envelope accounting difference cannot quietly
379
+ eat the margin.
380
+ """
381
+ import json
382
+
383
+ from mcp.server.streamable_http_manager import DEFAULT_MAX_REQUEST_BODY_SIZE
384
+
385
+ log: list = []
386
+ session = StoreSession("http://x/mcp", lambda: "jwt", lambda _t: _FakeClient(log))
387
+
388
+ # ~6 MiB of records: over the SDK cap, under omnigraph's 8 MiB budget, so
389
+ # the old default produced a single request the deployment would refuse.
390
+ records = [
391
+ {"type": "Symbol", "data": {"slug": f"sym-{i}", "body": "x" * 4096}}
392
+ for i in range(1500)
393
+ ]
394
+ RemoteStoreClient(REPO, session).load(records)
395
+
396
+ loads = [args for name, args in log if name == "code_store_load"]
397
+ assert len(loads) > 1, "should have split; a single call is the old bug"
398
+
399
+ for args in loads:
400
+ body = json.dumps(
401
+ {
402
+ "jsonrpc": "2.0",
403
+ "id": 1,
404
+ "method": "tools/call",
405
+ "params": {"name": "code_store_load", "arguments": args},
406
+ }
407
+ )
408
+ assert len(body.encode()) < DEFAULT_MAX_REQUEST_BODY_SIZE
409
+
410
+ # Nothing dropped on the way through the splitter.
411
+ assert sum(len(args["records"]) for args in loads) == len(records)
412
+
413
+
368
414
  # ── Batched mutation ──────────────────────────────────────────────────────────
369
415
  #
370
416
  # `change_many` was the last per-row writer in witan-code: every other write
@@ -336,7 +336,7 @@ class RemoteStoreClient:
336
336
  records: list[dict],
337
337
  mode: str = "merge",
338
338
  *,
339
- max_bytes: int = chunking.LOAD_MAX_BYTES,
339
+ max_bytes: int = chunking.MCP_LOAD_MAX_BYTES,
340
340
  ) -> None:
341
341
  """Bulk-load records through the MCP tier's ``code_store_load``.
342
342
 
@@ -347,6 +347,14 @@ class RemoteStoreClient:
347
347
  records ride as a JSON tool parameter over the MCP session — which the
348
348
  byte budget bounds as well.
349
349
 
350
+ ★ That second ceiling is the tighter one and the default reflects it:
351
+ ``MCP_LOAD_MAX_BYTES``, not ``LOAD_MAX_BYTES``. The MCP Python SDK
352
+ rejects request bodies over 4 MiB before parsing them. This defaulted to
353
+ the omnigraph budget (8 MiB) until 2026-08-07, which made a large enough
354
+ index fail here exactly as ``migrate merge`` did against the deployment
355
+ — ``413 Request body too large``, from the SDK rather than from
356
+ omnigraph.
357
+
350
358
  ``overwrite`` is not chunked here either; see the note there.
351
359
  """
352
360
  if not records:
File without changes
File without changes
File without changes
File without changes