codecortex 0.28.0__tar.gz → 0.29.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.
- {codecortex-0.28.0/src/codecortex.egg-info → codecortex-0.29.0}/PKG-INFO +7 -7
- {codecortex-0.28.0 → codecortex-0.29.0}/README.md +6 -6
- {codecortex-0.28.0 → codecortex-0.29.0/src/codecortex.egg-info}/PKG-INFO +7 -7
- codecortex-0.29.0/src/codeintel/__init__.py +1 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/__main__.py +5 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/query.py +1 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/gateway.py +15 -3
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_answer.py +2 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_changed.py +29 -5
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_ops.py +47 -21
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/provider.py +3 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/providers/graph.py +22 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/server.py +19 -5
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_qualified.py +36 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_changed_range.py +71 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_docs_ci_claims.py +39 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_mcp_answer_size.py +20 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_null_reason_and_ripple.py +50 -0
- codecortex-0.28.0/src/codeintel/__init__.py +0 -1
- {codecortex-0.28.0 → codecortex-0.29.0}/LICENSE +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/pyproject.toml +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/setup.cfg +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codecortex.egg-info/SOURCES.txt +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codecortex.egg-info/dependency_links.txt +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codecortex.egg-info/entry_points.txt +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codecortex.egg-info/requires.txt +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codecortex.egg-info/top_level.txt +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/agent_prompt.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/auth.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/c4.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/c4_check.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/c4_layers.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/cache.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/changed_range.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/__init__.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/_common.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/c4.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/doctor.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/gen_token.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/graph.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/index.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/install.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/map.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/prompt.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/reset.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/serve.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/serve_http.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/setup.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/status.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/commands/uninstall.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/config.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/containment.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/doctor.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/filelock.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_backend.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_confidence.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_dispatch.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_edges.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_render.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_resolution.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/graph_targets.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/grapher.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/http_server.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/indexer.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/injector.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/installer.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/lang_config.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/loc.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/logconfig.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/mapper.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/metrics.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/onboarding.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/outcome.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/paths.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/per_thread.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/policy.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/progress.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/providers/__init__.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/providers/lsp.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/providers/none.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/providers/semantic.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/py.typed +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/qualifier_scan.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/query_ops.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/redact.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/reindexer.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/reset.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/searcher.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/semantic_db.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/source_kind.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/symbol_diff.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/term.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/verify.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/viewer/__init__.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/viewer/graph_template.html +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/src/codeintel/wire_text.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_agent_prompt.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_backend_failure_detail.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_backend_reaper.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_background_index_failure.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_corpus_typed.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_gate.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_graphify.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_oracle.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_bench_oracle_ts.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_c4.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_c4_check.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_c4_layers.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_c4_model.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_c4_output.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cache.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_chunking.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cli_commands.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cli_help.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cli_install_dry_run.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cli_install_offer_injection.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_cold_process.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_config.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_corpus.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_could_not_ask_semantic.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_dispatch_callers.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_docs_deadcode_withdrawal.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_docs_trust_claims.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_doctor.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_e2e.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_edge_confidence.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_edge_endpoint_cap.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_engine_adoption.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_enterprise.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_gateway.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_graph_failure_population.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_graph_provider.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_graph_real.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_graph_stdin.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_grapher.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_hard_exit.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_hardening.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_http_auth.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_http_server.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_incompleteness.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_index_failure_reason.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_index_incompleteness.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_index_progress.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_indexer_binary.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_installer.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_integration.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_lang_config.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_loc_census.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_lsp_language_coverage.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_lsp_provider.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_lsp_real.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_mapper.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_mcp_handshake.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_mcp_server.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_missing_target.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_model_dimension.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_never_raise.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_onboarding.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_per_thread.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_qualifier_scan.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_query_budget.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_rbac.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_redaction_boundary.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_reindex_lock.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_reindexer.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_rerank.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_reset.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_semantic_provider.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_source_kind.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_staleness.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_summary_integrity.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_symbol_context.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_symbol_diff.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_term.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_treesitter.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_uninstall.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_upgrade_path.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_verify.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_verify_call.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_version_skew.py +0 -0
- {codecortex-0.28.0 → codecortex-0.29.0}/tests/test_wire_text.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codecortex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.29.0
|
|
4
4
|
Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
|
|
5
5
|
Author: Shammai Hamilton
|
|
6
6
|
License-Expression: MIT
|
|
@@ -597,7 +597,7 @@ An honest picture, so you can decide what to trust this with.
|
|
|
597
597
|
|
|
598
598
|
**What's solid.** The suite is large and real — more test code than source, a coverage floor
|
|
599
599
|
enforced in CI, and fault-injection tests behind the never-raise contract. CI runs lint, `mypy`,
|
|
600
|
-
and the full suite on Python 3.11/3.12/3.13, then builds the wheel, installs it into a clean
|
|
600
|
+
and the full suite on Python 3.11/3.12/3.13/3.14, then builds the wheel, installs it into a clean
|
|
601
601
|
environment, and runs a **release canary** that registers the build with Codex and Claude Code in a
|
|
602
602
|
throwaway `HOME`, boots the server those configs name, and asserts on the answer text of a real
|
|
603
603
|
`code.query`. A release that installs into a file no host reads, or that boots and answers nothing,
|
|
@@ -629,10 +629,10 @@ skip and those engines run against hand-authored mocks rather than the real wire
|
|
|
629
629
|
jobs cover the contract itself: `graph-contract` installs the pinned `codebase-memory-mcp` and runs
|
|
630
630
|
the live graph tests — and **fails if they skipped**, because a silently-skipped contract test is
|
|
631
631
|
how a total backend outage stayed green here once — while the nightly corpus job runs that same
|
|
632
|
-
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
the
|
|
632
|
+
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
633
|
+
against the exact serena commit the provider launches (`providers/lsp.py`'s `_SERENA_REV`), and it
|
|
634
|
+
**gates**: a serena regression turns CI red, and moving to a newer serena means bumping that pin
|
|
635
|
+
with the contract job green against it. The release canary — the only check that
|
|
636
636
|
asserts on real answer text from a built wheel — still covers **the semantic engine only**.
|
|
637
637
|
|
|
638
638
|
Line coverage measures how much of the intended behavior runs, not how much of reality it has met.
|
|
@@ -697,7 +697,7 @@ git clone https://github.com/hamilton-sky/codeintel.git
|
|
|
697
697
|
cd codeintel
|
|
698
698
|
pip install -e .[dev]
|
|
699
699
|
|
|
700
|
-
pytest tests/ -q # ~
|
|
700
|
+
pytest tests/ -q # ~2,200 tests, a few minutes; fails under 83% coverage
|
|
701
701
|
ruff check src tests bench # lint
|
|
702
702
|
mypy # types (src/ only)
|
|
703
703
|
```
|
|
@@ -556,7 +556,7 @@ An honest picture, so you can decide what to trust this with.
|
|
|
556
556
|
|
|
557
557
|
**What's solid.** The suite is large and real — more test code than source, a coverage floor
|
|
558
558
|
enforced in CI, and fault-injection tests behind the never-raise contract. CI runs lint, `mypy`,
|
|
559
|
-
and the full suite on Python 3.11/3.12/3.13, then builds the wheel, installs it into a clean
|
|
559
|
+
and the full suite on Python 3.11/3.12/3.13/3.14, then builds the wheel, installs it into a clean
|
|
560
560
|
environment, and runs a **release canary** that registers the build with Codex and Claude Code in a
|
|
561
561
|
throwaway `HOME`, boots the server those configs name, and asserts on the answer text of a real
|
|
562
562
|
`code.query`. A release that installs into a file no host reads, or that boots and answers nothing,
|
|
@@ -588,10 +588,10 @@ skip and those engines run against hand-authored mocks rather than the real wire
|
|
|
588
588
|
jobs cover the contract itself: `graph-contract` installs the pinned `codebase-memory-mcp` and runs
|
|
589
589
|
the live graph tests — and **fails if they skipped**, because a silently-skipped contract test is
|
|
590
590
|
how a total backend outage stayed green here once — while the nightly corpus job runs that same
|
|
591
|
-
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
the
|
|
591
|
+
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
592
|
+
against the exact serena commit the provider launches (`providers/lsp.py`'s `_SERENA_REV`), and it
|
|
593
|
+
**gates**: a serena regression turns CI red, and moving to a newer serena means bumping that pin
|
|
594
|
+
with the contract job green against it. The release canary — the only check that
|
|
595
595
|
asserts on real answer text from a built wheel — still covers **the semantic engine only**.
|
|
596
596
|
|
|
597
597
|
Line coverage measures how much of the intended behavior runs, not how much of reality it has met.
|
|
@@ -656,7 +656,7 @@ git clone https://github.com/hamilton-sky/codeintel.git
|
|
|
656
656
|
cd codeintel
|
|
657
657
|
pip install -e .[dev]
|
|
658
658
|
|
|
659
|
-
pytest tests/ -q # ~
|
|
659
|
+
pytest tests/ -q # ~2,200 tests, a few minutes; fails under 83% coverage
|
|
660
660
|
ruff check src tests bench # lint
|
|
661
661
|
mypy # types (src/ only)
|
|
662
662
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codecortex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.29.0
|
|
4
4
|
Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
|
|
5
5
|
Author: Shammai Hamilton
|
|
6
6
|
License-Expression: MIT
|
|
@@ -597,7 +597,7 @@ An honest picture, so you can decide what to trust this with.
|
|
|
597
597
|
|
|
598
598
|
**What's solid.** The suite is large and real — more test code than source, a coverage floor
|
|
599
599
|
enforced in CI, and fault-injection tests behind the never-raise contract. CI runs lint, `mypy`,
|
|
600
|
-
and the full suite on Python 3.11/3.12/3.13, then builds the wheel, installs it into a clean
|
|
600
|
+
and the full suite on Python 3.11/3.12/3.13/3.14, then builds the wheel, installs it into a clean
|
|
601
601
|
environment, and runs a **release canary** that registers the build with Codex and Claude Code in a
|
|
602
602
|
throwaway `HOME`, boots the server those configs name, and asserts on the answer text of a real
|
|
603
603
|
`code.query`. A release that installs into a file no host reads, or that boots and answers nothing,
|
|
@@ -629,10 +629,10 @@ skip and those engines run against hand-authored mocks rather than the real wire
|
|
|
629
629
|
jobs cover the contract itself: `graph-contract` installs the pinned `codebase-memory-mcp` and runs
|
|
630
630
|
the live graph tests — and **fails if they skipped**, because a silently-skipped contract test is
|
|
631
631
|
how a total backend outage stayed green here once — while the nightly corpus job runs that same
|
|
632
|
-
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
the
|
|
632
|
+
real backend against pinned third-party repositories. `lsp-contract` runs the live serena tests
|
|
633
|
+
against the exact serena commit the provider launches (`providers/lsp.py`'s `_SERENA_REV`), and it
|
|
634
|
+
**gates**: a serena regression turns CI red, and moving to a newer serena means bumping that pin
|
|
635
|
+
with the contract job green against it. The release canary — the only check that
|
|
636
636
|
asserts on real answer text from a built wheel — still covers **the semantic engine only**.
|
|
637
637
|
|
|
638
638
|
Line coverage measures how much of the intended behavior runs, not how much of reality it has met.
|
|
@@ -697,7 +697,7 @@ git clone https://github.com/hamilton-sky/codeintel.git
|
|
|
697
697
|
cd codeintel
|
|
698
698
|
pip install -e .[dev]
|
|
699
699
|
|
|
700
|
-
pytest tests/ -q # ~
|
|
700
|
+
pytest tests/ -q # ~2,200 tests, a few minutes; fails under 83% coverage
|
|
701
701
|
ruff check src tests bench # lint
|
|
702
702
|
mypy # types (src/ only)
|
|
703
703
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.29.0"
|
|
@@ -448,6 +448,11 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
448
448
|
"base ref (`main`, `HEAD~3`) — empty means uncommitted edits only. Ignored (and "
|
|
449
449
|
"safe to omit) by `overview`/`hotspots`.",
|
|
450
450
|
)
|
|
451
|
+
query_parser.add_argument(
|
|
452
|
+
"--offset", type=int, default=0,
|
|
453
|
+
help="For `changed` with a base ref: skip this many changed symbols (most severe first) — "
|
|
454
|
+
"the page cursor a capped answer names as `page.next_offset`. Default 0.",
|
|
455
|
+
)
|
|
451
456
|
query_parser.add_argument(
|
|
452
457
|
"--engine", choices=QUERY_ENGINES, default="auto",
|
|
453
458
|
help="Which engine answers (default: auto — picks the right engine per op)",
|
|
@@ -501,6 +501,7 @@ class Gateway:
|
|
|
501
501
|
budget,
|
|
502
502
|
project_root,
|
|
503
503
|
engine_str: str,
|
|
504
|
+
offset: int = 0,
|
|
504
505
|
) -> Result:
|
|
505
506
|
# Both arms short-circuit BEFORE `build_result`, so the provider's own unavailable-hint is
|
|
506
507
|
# never reached from here — which is exactly how the documented contract ("safe-nulls with
|
|
@@ -521,7 +522,12 @@ class Gateway:
|
|
|
521
522
|
or f"the {engine_str} engine is not available — run `codeintel doctor` for why",
|
|
522
523
|
)
|
|
523
524
|
try:
|
|
524
|
-
|
|
525
|
+
# Only `changed` pages, and only the graph engine answers it; the other providers keep
|
|
526
|
+
# the five-argument `build_result` of the `Provider` protocol.
|
|
527
|
+
paged = bool(offset) and op_str in _UNCACHED_OPS and engine_str == "graph"
|
|
528
|
+
r = (provider.build_result(op_str, target_str, [], budget or 0, project_root or "",
|
|
529
|
+
offset=offset) if paged
|
|
530
|
+
else provider.build_result(op_str, target_str, [], budget or 0, project_root or ""))
|
|
525
531
|
if r is not None:
|
|
526
532
|
return r
|
|
527
533
|
return safe_null_result(op_str, target_str, engine=engine_str, reason="no-result")
|
|
@@ -554,14 +560,18 @@ class Gateway:
|
|
|
554
560
|
role: str = "",
|
|
555
561
|
budget=None,
|
|
556
562
|
project_root=None,
|
|
563
|
+
offset: int = 0,
|
|
557
564
|
) -> Result:
|
|
558
565
|
"""Answer one question. Never raises.
|
|
559
566
|
|
|
567
|
+
`offset` is `changed <ref>`'s page cursor into its capped symbol lookup; every other op
|
|
568
|
+
ignores it.
|
|
569
|
+
|
|
560
570
|
A thin wrapper over `_query`, existing so that redaction has exactly ONE seam to cover.
|
|
561
571
|
Every leak found in the evaluation was in a field some renderer built and no one swept —
|
|
562
572
|
the scope note inside `result`, the "index it standalone with:" command inside `hint`. Both
|
|
563
573
|
are downstream of here, and so is anything added later."""
|
|
564
|
-
result = self._query(op, target, engine, role, budget, project_root)
|
|
574
|
+
result = self._query(op, target, engine, role, budget, project_root, offset)
|
|
565
575
|
try:
|
|
566
576
|
return redact(result) # type: ignore[return-value]
|
|
567
577
|
except Exception as exc:
|
|
@@ -576,6 +586,7 @@ class Gateway:
|
|
|
576
586
|
role: str = "",
|
|
577
587
|
budget=None,
|
|
578
588
|
project_root=None,
|
|
589
|
+
offset: int = 0,
|
|
579
590
|
) -> Result:
|
|
580
591
|
try:
|
|
581
592
|
op_str = str(op or "")
|
|
@@ -738,7 +749,8 @@ class Gateway:
|
|
|
738
749
|
# stale answer were the three that stayed silent about it.
|
|
739
750
|
return _mark_reindexing({**cached_result, "cached": True}, reindexing)
|
|
740
751
|
provider = self._provider_for(engine_str)
|
|
741
|
-
result = self._dispatch_single(
|
|
752
|
+
result = self._dispatch_single(
|
|
753
|
+
provider, op_str, target_str, budget, project_root, engine_str, offset)
|
|
742
754
|
|
|
743
755
|
# overview auto-fallback (F4 Story 2): when auto-routed to graph but graph can't serve
|
|
744
756
|
# it — the backend is unavailable, OR this repo simply isn't in the graph — try lsp,
|
|
@@ -308,13 +308,37 @@ class ChangedSince(AnswerRendering):
|
|
|
308
308
|
key=lambda e: (SEVERITY[e.change.change], _is_class_body(e.change),
|
|
309
309
|
self._looks_like_test(e.path, e.bare),
|
|
310
310
|
e.path, e.change.new_line or e.change.old_line or 0))
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
# One PAGE of the severity-ordered list is looked up: the cap keeps an answer one that an
|
|
312
|
+
# MCP client can take, and `offset` (D5) is how the rest is reached — a bigger cap would
|
|
313
|
+
# grow the `result` text, which is never cut, past the client's limit again.
|
|
314
|
+
cap, total = self._RANGE_SYMBOL_CAP, len(candidates)
|
|
315
|
+
start = min(self._changed_offset, total)
|
|
316
|
+
before, looked = candidates[:start], candidates[start: start + cap]
|
|
317
|
+
after = candidates[start + cap:]
|
|
318
|
+
skipped = before + after
|
|
319
|
+
next_offset = start + cap if after else None
|
|
320
|
+
self._pending_page = {"offset": start, "limit": cap, "total": total,
|
|
321
|
+
"next_offset": next_offset}
|
|
322
|
+
more = (f" — re-ask with `offset={next_offset}` for the next {min(cap, len(after))}"
|
|
323
|
+
if next_offset is not None else "")
|
|
324
|
+
if self._changed_offset >= total and self._changed_offset > 0:
|
|
325
|
+
gaps.append((
|
|
326
|
+
"symbols-truncated",
|
|
327
|
+
f"offset={self._changed_offset} is past the last of the {total} changed symbols, "
|
|
328
|
+
f"so none was looked up — pages start at 0 and step by {cap}"))
|
|
329
|
+
elif start:
|
|
330
|
+
gaps.append((
|
|
331
|
+
"symbols-truncated",
|
|
332
|
+
f"this page looked up symbols {start + 1} to {start + len(looked)} of {total} "
|
|
333
|
+
f"(offset={start}, {cap} per page, most severe first); the {len(before)} before it "
|
|
334
|
+
f"and {len(after)} after it were not looked up in this answer{more}"))
|
|
335
|
+
elif skipped:
|
|
313
336
|
gaps.append((
|
|
314
337
|
"symbols-truncated",
|
|
315
|
-
f"{len(skipped)} of {
|
|
316
|
-
f"lookup is capped at {
|
|
317
|
-
f"signature, then body), so what was dropped is the least consequential tail"
|
|
338
|
+
f"{len(skipped)} of {total} changed symbols were not looked up — the "
|
|
339
|
+
f"lookup is capped at {cap}, most severe first (removed, then "
|
|
340
|
+
f"signature, then body), so what was dropped is the least consequential tail"
|
|
341
|
+
f"{more}"))
|
|
318
342
|
|
|
319
343
|
# --------------------------------------------------------------------- look them up
|
|
320
344
|
deadline = time.monotonic() + self._RANGE_LOOKUP_BUDGET_S
|
|
@@ -44,6 +44,14 @@ from codeintel.graph_targets import _parse_symbol_target, _SymbolTarget
|
|
|
44
44
|
from codeintel.source_kind import is_code_path
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
def _is_name_guess(row: tuple[str, str, float | None, str, str]) -> bool:
|
|
48
|
+
"""A ripple row whose only support is a name match (or a score below the confidence floor on a
|
|
49
|
+
backend that reports no strategy)."""
|
|
50
|
+
_, _, conf, _, evidence = row
|
|
51
|
+
return evidence == "name-guess" or (not evidence and conf is not None
|
|
52
|
+
and conf < _EDGE_CONFIDENCE_FLOOR)
|
|
53
|
+
|
|
54
|
+
|
|
47
55
|
class GraphOps(DispatchCallers, ChangedSince):
|
|
48
56
|
"""One method per graph op. Mixed into `GraphProvider`.
|
|
49
57
|
|
|
@@ -630,6 +638,13 @@ class GraphOps(DispatchCallers, ChangedSince):
|
|
|
630
638
|
since = (target or "").strip()
|
|
631
639
|
if since:
|
|
632
640
|
return self._answer_changed_since(since, project, timeout_ms, root)
|
|
641
|
+
if self._changed_offset:
|
|
642
|
+
# Nothing here is paged: the uncommitted answer lists files and impacted symbols, not a
|
|
643
|
+
# capped symbol lookup. Saying so beats an answer that reads as "page 2".
|
|
644
|
+
self._add_gap(
|
|
645
|
+
"changed", "offset-not-applied",
|
|
646
|
+
f"offset={self._changed_offset} was ignored: only `changed` with a base ref as "
|
|
647
|
+
"`target` pages its symbol lookup; this is the uncommitted-edits answer, whole")
|
|
633
648
|
try:
|
|
634
649
|
raw = self._run("detect_changes", {"project": project}, max(timeout_ms, 15000))
|
|
635
650
|
if not isinstance(raw, dict):
|
|
@@ -689,11 +704,17 @@ class GraphOps(DispatchCallers, ChangedSince):
|
|
|
689
704
|
return ("## Changes impact\n(no source changes — the working tree's "
|
|
690
705
|
f"{dropped} uncommitted change(s) are all non-source files)")
|
|
691
706
|
return "## Changes impact\n(working tree clean — no uncommitted changes)"
|
|
692
|
-
|
|
707
|
+
everyone, ripple_truncated = self._changed_ripple(files, project, timeout_ms)
|
|
708
|
+
# A caller found only by its name is a candidate, not a finding: the headline counts the
|
|
709
|
+
# resolved ones and says how many more there are, and the name matches are listed apart.
|
|
710
|
+
# Nothing is dropped — over-reporting a risk is the safer error, hiding one is not.
|
|
711
|
+
ripple = [r for r in everyone if not _is_name_guess(r)]
|
|
712
|
+
by_name = [r for r in everyone if _is_name_guess(r)]
|
|
693
713
|
walked_hdr = any(h > 0 for _, _, h in syms)
|
|
694
714
|
parts = [f"## Changes impact ({len(files)} files → {len(syms)} "
|
|
695
715
|
+ ("symbols impacted" if walked_hdr else "symbols defined in them")
|
|
696
|
-
+ f" → {len(ripple)} callers elsewhere
|
|
716
|
+
+ f" → {len(ripple)} callers elsewhere"
|
|
717
|
+
+ (f" (+{len(by_name)} matched by name only)" if by_name else "") + ")"]
|
|
697
718
|
if files:
|
|
698
719
|
parts.append(f"### Changed files ({len(files)})")
|
|
699
720
|
parts.extend(f"- {f}" for f in files[:40])
|
|
@@ -717,11 +738,8 @@ class GraphOps(DispatchCallers, ChangedSince):
|
|
|
717
738
|
parts.append(f"- {label}{hop_s}{tail}")
|
|
718
739
|
if len(syms) > 40:
|
|
719
740
|
parts.append(f"… (+{len(syms) - 40} more)")
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
parts.append("_This is the blast radius: symbols outside the changed files whose "
|
|
723
|
-
"behaviour can move because of this edit._")
|
|
724
|
-
for label, fp, conf, kind, evidence in ripple[:40]:
|
|
741
|
+
def _ripple_lines(rows: list[tuple[str, str, float | None, str, str]]) -> None:
|
|
742
|
+
for label, fp, conf, kind, evidence in rows[:40]:
|
|
725
743
|
tail = f" ({fp})" if fp and fp != label else ""
|
|
726
744
|
# The relationship comes first: "registered" and "calls" are different things
|
|
727
745
|
# to check, and a reviewer triages on that before they weigh confidence.
|
|
@@ -738,28 +756,36 @@ class GraphOps(DispatchCallers, ChangedSince):
|
|
|
738
756
|
else:
|
|
739
757
|
mark = ""
|
|
740
758
|
parts.append(f"- {label or fp}{kind_s}{mark}{tail}")
|
|
741
|
-
if len(
|
|
742
|
-
parts.append(f"… (+{len(
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
759
|
+
if len(rows) > 40:
|
|
760
|
+
parts.append(f"… (+{len(rows) - 40} more)")
|
|
761
|
+
|
|
762
|
+
if ripple:
|
|
763
|
+
parts.append(f"### Callers elsewhere that reach into them ({len(ripple)})")
|
|
764
|
+
parts.append("_This is the blast radius: symbols outside the changed files whose "
|
|
765
|
+
"behaviour can move because of this edit._")
|
|
766
|
+
_ripple_lines(ripple)
|
|
746
767
|
indirect = sum(1 for r in ripple if r[3] != _DIRECT_KIND)
|
|
747
|
-
notes = []
|
|
748
768
|
if indirect:
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
f"code at all")
|
|
754
|
-
if notes:
|
|
755
|
-
parts.append("\n_" + "; ".join(notes) + "._")
|
|
756
|
-
elif files:
|
|
769
|
+
parts.append(f"\n_{indirect} of {len(ripple)} reach this code without calling "
|
|
770
|
+
"it (registered as a callback, or referenced) — they can still "
|
|
771
|
+
"break._")
|
|
772
|
+
elif files and not by_name:
|
|
757
773
|
# An empty ripple is a real and useful answer — but only if it cannot be confused
|
|
758
774
|
# with one that was never computed.
|
|
759
775
|
parts.append("### Callers elsewhere that reach into them (0)")
|
|
760
776
|
parts.append("_No symbol outside the changed files calls into them, by the graph's "
|
|
761
777
|
"CALLS edges. Framework dispatch and calls through a value are not "
|
|
762
778
|
"edges, so this is not proof that nothing else is affected._")
|
|
779
|
+
elif files:
|
|
780
|
+
parts.append("### Callers elsewhere that reach into them (0)")
|
|
781
|
+
parts.append("_No caller was RESOLVED to the changed code; the candidates found "
|
|
782
|
+
"only by name are below, and they are not proof either way._")
|
|
783
|
+
if by_name:
|
|
784
|
+
parts.append(f"### Matched by name only — may not reach this code ({len(by_name)})")
|
|
785
|
+
parts.append(f"_{len(by_name)} were resolved by name matching and may not reach "
|
|
786
|
+
"this code at all (a same-named symbol elsewhere is a hit). Check "
|
|
787
|
+
"before relying on or ignoring them._")
|
|
788
|
+
_ripple_lines(by_name)
|
|
763
789
|
if ripple_truncated:
|
|
764
790
|
self._add_gap(
|
|
765
791
|
"changed", "ripple-truncated",
|
|
@@ -65,6 +65,9 @@ class Result(TypedDict):
|
|
|
65
65
|
# `total > returned` and `truncated` is still true.
|
|
66
66
|
rows: NotRequired[list[dict[str, Any]]]
|
|
67
67
|
evidence: NotRequired[dict[str, Any]]
|
|
68
|
+
# `changed <ref>` only: which page of its capped, severity-ordered symbol lookup this answer
|
|
69
|
+
# covered — `{offset, limit, total, next_offset}`, `next_offset` null on the last page.
|
|
70
|
+
page: NotRequired[dict[str, Any]]
|
|
68
71
|
# What this answer can be USED for, in one word — `evidence`, `discovery` or `advisory`. The
|
|
69
72
|
# readiness doc's "distinguish discovery from proof", as a field rather than as a convention a
|
|
70
73
|
# reader has to have absorbed. Stamped on every answered envelope by `attach_confidence`.
|
|
@@ -560,6 +560,19 @@ class GraphProvider(GraphOps):
|
|
|
560
560
|
_pending_withheld: PerThread[int] = PerThread(0)
|
|
561
561
|
# The body carries `- ` lines that are not result rows, so no row summary of it can be true.
|
|
562
562
|
_pending_nonrow_lines: PerThread[bool] = PerThread(False)
|
|
563
|
+
# `changed <ref>`'s page cursor: where in the severity-ordered list of changed symbols this
|
|
564
|
+
# answer's capped lookup starts. Set from `build_result(offset=)` on every call, so it never
|
|
565
|
+
# outlives the question it came with.
|
|
566
|
+
_changed_offset: PerThread[int] = PerThread(0)
|
|
567
|
+
# The page this answer covered — `{offset, limit, total, next_offset}` — published as the
|
|
568
|
+
# envelope's `page` so a caller can ask for the next one without parsing the gap's prose.
|
|
569
|
+
_pending_page: PerThread[dict[str, Any] | None] = PerThread(None)
|
|
570
|
+
|
|
571
|
+
def _page_published(self) -> dict[str, Any] | None:
|
|
572
|
+
"""The page this answer covered, read through a call so the reset at the top of
|
|
573
|
+
`build_result` does not narrow it to `None` for the type checker."""
|
|
574
|
+
page = self._pending_page
|
|
575
|
+
return dict(page) if page is not None else None
|
|
563
576
|
|
|
564
577
|
def _clear_failure(self) -> None:
|
|
565
578
|
self._backend._clear_failure()
|
|
@@ -695,11 +708,17 @@ class GraphProvider(GraphOps):
|
|
|
695
708
|
files: Any,
|
|
696
709
|
budget: Any,
|
|
697
710
|
project_root: Any,
|
|
711
|
+
offset: Any = 0,
|
|
698
712
|
) -> Result:
|
|
699
713
|
try:
|
|
700
714
|
op_str = str(op or "")
|
|
701
715
|
target_str = str(target or "")
|
|
702
716
|
root_str = str(project_root or "")
|
|
717
|
+
try:
|
|
718
|
+
self._changed_offset = max(0, int(offset or 0))
|
|
719
|
+
except (TypeError, ValueError):
|
|
720
|
+
self._changed_offset = 0
|
|
721
|
+
self._pending_page = None
|
|
703
722
|
|
|
704
723
|
if not self.available:
|
|
705
724
|
return safe_null_result(
|
|
@@ -934,6 +953,9 @@ class GraphProvider(GraphOps):
|
|
|
934
953
|
if evidence is not None:
|
|
935
954
|
envelope["rows"] = list(self._pending_rows)
|
|
936
955
|
envelope["evidence"] = evidence
|
|
956
|
+
page = self._page_published()
|
|
957
|
+
if page is not None:
|
|
958
|
+
envelope["page"] = page
|
|
937
959
|
return attach_confidence(envelope, self._pending_gaps)
|
|
938
960
|
except Exception as exc:
|
|
939
961
|
log_swallowed("GraphProvider.build_result", exc)
|
|
@@ -138,7 +138,7 @@ def _size(obj: object) -> int:
|
|
|
138
138
|
return len(json.dumps(obj, default=str).encode("utf-8"))
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
def compact_for_mcp(env: dict, op: str, target: str) -> dict:
|
|
141
|
+
def compact_for_mcp(env: dict, op: str, target: str, offset: int = 0) -> dict:
|
|
142
142
|
"""*env* as an MCP client can take it: unchanged when it fits the byte budget; otherwise with
|
|
143
143
|
`rows` cut to the leading rows that fit, and the cut counted (`rows_total`, `rows_omitted`)
|
|
144
144
|
and explained (`rows_note`, with the command that prints them all).
|
|
@@ -151,7 +151,8 @@ def compact_for_mcp(env: dict, op: str, target: str) -> dict:
|
|
|
151
151
|
if not isinstance(rows, list) or not rows or _size(env) <= MCP_ENVELOPE_BUDGET_BYTES:
|
|
152
152
|
return env
|
|
153
153
|
cmd = (f"codeintel query --op {shlex.quote(op)}"
|
|
154
|
-
+ (f" --target {shlex.quote(target)}" if target else "")
|
|
154
|
+
+ (f" --target {shlex.quote(target)}" if target else "")
|
|
155
|
+
+ (f" --offset {int(offset)}" if offset else "") + " --json")
|
|
155
156
|
out = dict(env)
|
|
156
157
|
out["rows"] = []
|
|
157
158
|
out["rows_total"] = len(rows)
|
|
@@ -219,7 +220,12 @@ def code_query_handler(args: dict) -> Result:
|
|
|
219
220
|
and bool(args.get("allow_cwd_default", True))
|
|
220
221
|
and gw.allows_root(role, project_root)):
|
|
221
222
|
project_root = os.getcwd()
|
|
222
|
-
|
|
223
|
+
try:
|
|
224
|
+
offset = max(0, int(args.get("offset", 0) or 0))
|
|
225
|
+
except (TypeError, ValueError):
|
|
226
|
+
offset = 0
|
|
227
|
+
return gw.query(op=op, target=target, engine=engine, role=role, project_root=project_root,
|
|
228
|
+
offset=offset)
|
|
223
229
|
except Exception:
|
|
224
230
|
return safe_null_result("", "", reason="handler-error")
|
|
225
231
|
|
|
@@ -548,6 +554,12 @@ _PROJECT_ROOT_FIELD_DESCRIPTION = (
|
|
|
548
554
|
"role-based access control a blank value is rejected rather than defaulted — so pass it "
|
|
549
555
|
"explicitly whenever you know it."
|
|
550
556
|
)
|
|
557
|
+
_OFFSET_FIELD_DESCRIPTION = (
|
|
558
|
+
"Page cursor for `changed` with a base ref as `target`, ignored by every other op. Such an "
|
|
559
|
+
"answer looks up at most 40 changed symbols, most severe first; when there are more, its "
|
|
560
|
+
"`page.next_offset` (and the `symbols-truncated` gap) names the offset that looks up the next "
|
|
561
|
+
"40. Leave it 0 for the first page."
|
|
562
|
+
)
|
|
551
563
|
_ENGINE_FIELD_DESCRIPTION = "Which engine answers. Leave as `auto` — it already picks the right engine per op."
|
|
552
564
|
_ROLE_FIELD_DESCRIPTION = (
|
|
553
565
|
"Reserved for the HTTP transport, which sets it server-side from the caller's auth token and "
|
|
@@ -568,6 +580,7 @@ def run() -> None:
|
|
|
568
580
|
project_root: Annotated[str, Field(description=_PROJECT_ROOT_FIELD_DESCRIPTION)] = "",
|
|
569
581
|
engine: Annotated[_QueryEngine, Field(description=_ENGINE_FIELD_DESCRIPTION)] = "auto",
|
|
570
582
|
role: Annotated[str, Field(description=_ROLE_FIELD_DESCRIPTION)] = "",
|
|
583
|
+
offset: Annotated[int, Field(description=_OFFSET_FIELD_DESCRIPTION)] = 0,
|
|
571
584
|
) -> dict:
|
|
572
585
|
# MUST stay `dict`, not `Result`. FastMCP derives this tool's output schema from the return
|
|
573
586
|
# annotation, and it validates a TypedDict's NotRequired keys (`reason`, `hint`) as
|
|
@@ -575,8 +588,9 @@ def run() -> None:
|
|
|
575
588
|
# `isError: true`. Guarded by test_mcp_server.py::test_no_tool_advertises_the_optional_*.
|
|
576
589
|
# Bounded for the MCP client (`compact_for_mcp`); the CLI's `--json` keeps every row.
|
|
577
590
|
return compact_for_mcp(dict(code_query_handler(
|
|
578
|
-
{"op": op, "target": target, "project_root": project_root, "engine": engine, "role": role
|
|
579
|
-
|
|
591
|
+
{"op": op, "target": target, "project_root": project_root, "engine": engine, "role": role,
|
|
592
|
+
"offset": offset}
|
|
593
|
+
)), op, target, offset)
|
|
580
594
|
|
|
581
595
|
async def _code_status(
|
|
582
596
|
project_root: Annotated[str, Field(description=_PROJECT_ROOT_FIELD_DESCRIPTION)] = "",
|
|
@@ -155,3 +155,39 @@ def test_the_gate_still_reads_graph_verified_and_nothing_else():
|
|
|
155
155
|
|
|
156
156
|
assert 'direct["graph_verified"]' in inspect.getsource(score.run)
|
|
157
157
|
assert "graph_qualified" not in inspect.getsource(score._gate)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _ambiguous_then_narrowed(monkeypatch, *, def_file):
|
|
161
|
+
"""Stub the engine the way it answered `_broadcast` on pathly-adapters: a bare name three
|
|
162
|
+
functions share comes back with every one's callers and a `target-ambiguous` gap, and the
|
|
163
|
+
narrowed `name@file` question comes back with only the asked-about symbol's callers."""
|
|
164
|
+
other = _row("scheduler_loop", evidence="resolved", seen=None, verified=True, file="src/other.ts")
|
|
165
|
+
mine = _row("tail_events", evidence="resolved", seen=None, verified=True)
|
|
166
|
+
asked: list[str] = []
|
|
167
|
+
|
|
168
|
+
def run(_root, _op, target, _engine, _exe):
|
|
169
|
+
asked.append(target)
|
|
170
|
+
if "@" in target:
|
|
171
|
+
return {"result": _body([mine]), "rows": [mine], "gaps": []}
|
|
172
|
+
return {"result": _body([other, mine]), "rows": [other, mine],
|
|
173
|
+
"gaps": [{"kind": "target-ambiguous", "section": "callers",
|
|
174
|
+
"detail": "2 distinct symbols named `Chain.resolve` match this target"}]}
|
|
175
|
+
|
|
176
|
+
monkeypatch.setattr(score, "_run_codeintel", run)
|
|
177
|
+
return score.graph_answer("/root", "Chain.resolve", "codeintel", def_file=def_file), asked
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_an_ambiguous_target_is_asked_again_by_the_file_the_oracle_labelled(monkeypatch):
|
|
181
|
+
# The gap names the remedy (`name@<file>`), and the benchmark knows the file, so it follows
|
|
182
|
+
# the remedy the way an agent reading the gap would. Scoring the bare answer charged the engine
|
|
183
|
+
# a false positive for every verified caller of a DIFFERENT function sharing the name.
|
|
184
|
+
(graph, verified, qualified), asked = _ambiguous_then_narrowed(monkeypatch, def_file=FILE)
|
|
185
|
+
assert asked == ["Chain.resolve", f"Chain.resolve@{FILE}"]
|
|
186
|
+
for arm in (graph, verified, qualified):
|
|
187
|
+
assert _names(arm) == {"tail_events"}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_without_a_definition_file_the_ambiguous_answer_is_scored_as_given(monkeypatch):
|
|
191
|
+
(_, verified, _), asked = _ambiguous_then_narrowed(monkeypatch, def_file=None)
|
|
192
|
+
assert asked == ["Chain.resolve"]
|
|
193
|
+
assert _names(verified) == {"scheduler_loop", "tail_events"}
|
|
@@ -1625,3 +1625,74 @@ def test_a_react_components_inner_functions_rewritten_with_the_callee_land_under
|
|
|
1625
1625
|
assert _status_of(env, "runnerFile") == {
|
|
1626
1626
|
scope + "downloadPlan": "also-changed", scope + "exportPlan": "also-changed",
|
|
1627
1627
|
scope + "printPlan": "untouched"}, env["result"]
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
# ================================ D5: the symbol cap can be paged past, not only disclosed
|
|
1631
|
+
|
|
1632
|
+
def _ask_page(p: GraphProvider, repo: Path, offset: int, target: str = "main") -> dict[str, Any]:
|
|
1633
|
+
return p.build_result("changed", target, [], 30000, str(repo), offset=offset)
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
def test_the_first_page_says_how_to_ask_for_the_next(monkeypatch, tmp_path, repo):
|
|
1637
|
+
""""103 of 143 changed symbols were not looked up" and code.query had no way to ask for them.
|
|
1638
|
+
The gap now names the offset that looks the next ones up, and `page` carries it as data."""
|
|
1639
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1640
|
+
p._RANGE_SYMBOL_CAP = 2
|
|
1641
|
+
env = _ask(p, repo)
|
|
1642
|
+
gap = next(g for g in env["gaps"] if g["kind"] == "symbols-truncated")
|
|
1643
|
+
assert "offset=2" in gap["detail"], gap
|
|
1644
|
+
assert env["page"] == {"offset": 0, "limit": 2, "total": 4, "next_offset": 2}, env.get("page")
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
def test_an_offset_looks_up_the_next_page_of_symbols(monkeypatch, tmp_path, repo):
|
|
1648
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1649
|
+
p._RANGE_SYMBOL_CAP = 2
|
|
1650
|
+
env = _ask_page(p, repo, 2)
|
|
1651
|
+
body = env["result"]
|
|
1652
|
+
assert "#### `rewrite` — body" in body and "`use_resig`" in body.split("### Not looked up")[0], body
|
|
1653
|
+
assert "#### `gone`" not in body and "#### `resig`" not in body, "page 1's symbols are not repeated"
|
|
1654
|
+
assert env["page"] == {"offset": 2, "limit": 2, "total": 4, "next_offset": None}, env["page"]
|
|
1655
|
+
gap = next(g for g in env["gaps"] if g["kind"] == "symbols-truncated")
|
|
1656
|
+
assert "symbols 3 to 4 of 4" in gap["detail"] and "2 before" in gap["detail"], gap
|
|
1657
|
+
assert env["confidence"] == "partial", "one page of several is never the whole answer"
|
|
1658
|
+
assert env.get("evidence", {}).get("safe_for_destructive") is not True
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
def test_an_offset_past_the_end_looks_up_nothing_and_says_so(monkeypatch, tmp_path, repo):
|
|
1662
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1663
|
+
env = _ask_page(p, repo, 99)
|
|
1664
|
+
gap = next(g for g in env["gaps"] if g["kind"] == "symbols-truncated")
|
|
1665
|
+
assert "past the last of the 4 changed symbols" in gap["detail"], gap
|
|
1666
|
+
assert env["page"]["next_offset"] is None and env["confidence"] == "partial"
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
def test_a_negative_offset_is_the_first_page(monkeypatch, tmp_path, repo):
|
|
1670
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1671
|
+
assert _ask_page(p, repo, -5)["page"]["offset"] == 0
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
def test_an_offset_does_not_outlive_its_own_question(monkeypatch, tmp_path, repo):
|
|
1675
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1676
|
+
p._RANGE_SYMBOL_CAP = 2
|
|
1677
|
+
_ask_page(p, repo, 2)
|
|
1678
|
+
assert _ask(p, repo)["page"]["offset"] == 0
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
def test_an_offset_on_uncommitted_changed_is_reported_as_not_applied(monkeypatch, tmp_path, repo):
|
|
1682
|
+
"""With no base ref `changed` lists files and impacted symbols, not a capped symbol lookup, so
|
|
1683
|
+
there is nothing to page. Ignoring the parameter silently would read as "this is page 2"."""
|
|
1684
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1685
|
+
monkeypatch.setattr(p, "_run", lambda method, payload, timeout_ms: (
|
|
1686
|
+
{"projects": [{"name": PROJECT, "root_path": str(repo)}]} if method == "list_projects"
|
|
1687
|
+
else {"changed_files": ["pkg/core.py"], "impacted_symbols": []}))
|
|
1688
|
+
monkeypatch.setattr(p, "_query_rows", lambda cypher, project, timeout_ms: [])
|
|
1689
|
+
env = _ask_page(p, repo, 40, target="")
|
|
1690
|
+
assert "offset-not-applied" in _gap_kinds(env), env.get("gaps")
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
def test_the_gateway_hands_the_offset_to_the_graph_engine(monkeypatch, tmp_path, repo):
|
|
1694
|
+
p = _provider(monkeypatch, tmp_path, repo, _standard_graph())
|
|
1695
|
+
p._RANGE_SYMBOL_CAP = 2
|
|
1696
|
+
gw = Gateway(graph=p, lsp=None, semantic=None, oneshot=True)
|
|
1697
|
+
env = gw.query(op="changed", target="main", budget=30000, project_root=str(repo), offset=2)
|
|
1698
|
+
assert env["page"]["offset"] == 2, env.get("page")
|