codmap 0.0.35__tar.gz → 0.0.36__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.
- {codmap-0.0.35 → codmap-0.0.36}/PKG-INFO +2 -2
- {codmap-0.0.35 → codmap-0.0.36}/README.md +1 -1
- {codmap-0.0.35 → codmap-0.0.36}/codemap/cli.py +27 -2
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/currency.py +6 -0
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/PKG-INFO +2 -2
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/SOURCES.txt +1 -0
- {codmap-0.0.35 → codmap-0.0.36}/pyproject.toml +1 -1
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c91_route_vocabulary.py +4 -1
- codmap-0.0.36/tests/test_r1c92_sidecar_pair.py +126 -0
- {codmap-0.0.35 → codmap-0.0.36}/LICENSE +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/__init__.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/apidiff.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/arch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/diagnostics.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/__init__.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/attrflow.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/behavior.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/dataflow.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/dispatch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/griffe_extractor.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/gsource.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/probe.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/roots.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/extract/union.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/freshness.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/incremental.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/__init__.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/base.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/cocoindex.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/gate.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/gitnexus.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/registry.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/integrations/transport.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/model.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/provenance.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/query.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/scope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/__init__.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/_scip_pb2.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/api_surface.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/apidiff.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/architecture.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/audit.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/check.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/ctags.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/impact.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/limits.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/livingdocs.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/mcp_server.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/mermaid.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/pack.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/rag.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/review.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/scip.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/semantic.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/server.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/session.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/subsystems.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/serve/vault.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/store.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/tomlio.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codemap/watch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/dependency_links.txt +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/entry_points.txt +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/requires.txt +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/codmap.egg-info/top_level.txt +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/setup.cfg +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_epistemic.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_gitnexus_router.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_impact_depth.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_integrations.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_issue3_serve_freshness.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_livingdocs.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m0_api_surface.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m11_argcontract.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m12_dataflow.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m15_review.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m16_architecture.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m17_mcp.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m18_freshness.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m1_5_semantics.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m1_query.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m2_views.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m32_watch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m3_serve.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m4_behavior.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m5_deep.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m6_repo_scope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m7_dispatch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_m9_family.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_pack_honesty.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c13_callgraph_accuracy.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c13_grep_vs_graph.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c16_semantic.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c20_attribute_edges.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c21_flat_layout.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c22_source_visible_refs.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c23_hard_python.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c24_test_mapping.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c25_provenance.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c26_deep_union.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c27_config_honesty.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c28_limit_envelope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c29_lazy_imports.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c2_ctags.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c30_local_import_calls.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c30f1_reexport_calls.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c30f2_check_scope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c31_path_origin.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c32_report_json.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c33_query_signature.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c34_signature_kinds.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c35_contract_location.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c36_target_resolution.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c37_rule_mutation.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c38_tool_drift.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c39_edge_resolution.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c3_arch_contract.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c3_dogfood.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c40_flow_reach.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c41_scope_membership.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c42_deep_tier_stability.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c43_incremental_splice.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c44_absent_answers.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c45_repeat_union.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c46_shadowed_definitions.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c47_incremental_resample.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c48_type_checking_imports.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c49_type_only_cycles.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c4_complexity.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c50_flow_entry_points.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c53_narrowing_declared.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c54_deterministic_rendering.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c55_override_grade.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c56_stub_files.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c57_facade_package.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c58_cycle_tangles.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c59_completeness_drop.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c5_apidiff.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c60_nested_definitions.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c62_phantom_rules.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c63_answer_format.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c64_dependency_probe.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c66_pack_direction.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c68_dotted_imports.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c69_contract_validation.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c6_pack.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c70_check_graph_currency.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c71_attribute_chain_calls.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c72_flat_inference_in_packages.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c73_cli_version.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c74_call_site_conservation.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c75_reexported_class_calls.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c76_contract_table_typo.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c77_gate_probe_battery.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c78_forbidden_chains.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c7_edge_vocab.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c80_tests_through_helpers.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c81_protocol_dispatch.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c82_review_changed_lines.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c83_foreign_graph_paths.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c84_missing_roots.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c85_mcp_graph_currency.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c86_incremental_repo_scope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c87_review_path_base.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c89_review_docs.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c8_deadcode.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c90_currency_without_recipe.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_r1c9_incremental.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_scip_export.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_scope.py +0 -0
- {codmap-0.0.35 → codmap-0.0.36}/tests/test_subsystems.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codmap
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Static analyzer that turns a package's source into a queryable code graph.
|
|
5
5
|
Author-email: kogriv <kogriv@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -44,7 +44,7 @@ and a **SCIP index** for interop with Sourcegraph / Glean and other precise-code
|
|
|
44
44
|
|
|
45
45
|
[](https://github.com/kogriv/codemap/actions/workflows/ci.yml)
|
|
46
46
|
|
|
47
|
-
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **
|
|
47
|
+
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **1278 tests with no failures on
|
|
48
48
|
Python 3.11–3.14** ([in CI](docs/ci.md): the full suite including the dogfood pass, a determinism check, a
|
|
49
49
|
wheel smoke test, and ctags/SCIP interop against the real CLIs), warm serve surface with 31 ops (28 exposed
|
|
50
50
|
as MCP tools), and SCIP export. See **[DESIGN.md](DESIGN.md)** (product design &
|
|
@@ -8,7 +8,7 @@ and a **SCIP index** for interop with Sourcegraph / Glean and other precise-code
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/kogriv/codemap/actions/workflows/ci.yml)
|
|
10
10
|
|
|
11
|
-
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **
|
|
11
|
+
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **1278 tests with no failures on
|
|
12
12
|
Python 3.11–3.14** ([in CI](docs/ci.md): the full suite including the dogfood pass, a determinism check, a
|
|
13
13
|
wheel smoke test, and ctags/SCIP interop against the real CLIs), warm serve surface with 31 ops (28 exposed
|
|
14
14
|
as MCP tools), and SCIP export. See **[DESIGN.md](DESIGN.md)** (product design &
|
|
@@ -219,8 +219,10 @@ def _cmd_build(args) -> int:
|
|
|
219
219
|
cwd=os.getcwd(), target=graph.target, scope=scope,
|
|
220
220
|
roots_base=base)
|
|
221
221
|
if incr_info is not None:
|
|
222
|
+
# R1-C92: a full build that had a reason says it — computed, never shown, before.
|
|
223
|
+
why = f" ({incr_info['reason']})" if incr_info.get("reason") else ""
|
|
222
224
|
print(f"[incremental] {incr_info['mode']}: "
|
|
223
|
-
f"{len(incr_info['affected'])} module(s) recomputed", file=sys.stderr)
|
|
225
|
+
f"{len(incr_info['affected'])} module(s) recomputed{why}", file=sys.stderr)
|
|
224
226
|
print(args.out)
|
|
225
227
|
else:
|
|
226
228
|
print(store.dumps(graph))
|
|
@@ -303,8 +305,12 @@ def _incremental_build(args):
|
|
|
303
305
|
return extract(args.path, deep=args.deep, repeat=getattr(args, "repeat", None) or 1), \
|
|
304
306
|
{"mode": "full", "affected": []}
|
|
305
307
|
old_graph = store.load(args.out)
|
|
306
|
-
new_scope = resolve_scope(args.path)
|
|
307
308
|
repeat = getattr(args, "repeat", None) or 1
|
|
309
|
+
why = _sidecar_mismatch(old_meta, old_graph)
|
|
310
|
+
if why:
|
|
311
|
+
return extract(args.path, deep=args.deep, repeat=repeat), \
|
|
312
|
+
{"mode": "full", "affected": [], "reason": why}
|
|
313
|
+
new_scope = resolve_scope(args.path)
|
|
308
314
|
if old_graph.target != Path(args.path).resolve().name:
|
|
309
315
|
return extract(args.path, deep=args.deep, repeat=repeat), {"mode": "full", "affected": []}
|
|
310
316
|
return update_graph(old_graph, args.path, old_scope, new_scope, deep=args.deep,
|
|
@@ -334,6 +340,22 @@ def _core_subgraph(graph, offset: str = ""):
|
|
|
334
340
|
return core
|
|
335
341
|
|
|
336
342
|
|
|
343
|
+
def _sidecar_mismatch(old_meta, old_graph) -> str | None:
|
|
344
|
+
"""R1-C92 D1: the sidecar is the incremental baseline only if it describes this graph.
|
|
345
|
+
|
|
346
|
+
`meta.scope` and the graph's `provenance.scope_id` are written by one build and are
|
|
347
|
+
equal for a pair that belongs together. A graph replaced from outside (an atomic `mv`
|
|
348
|
+
of a fresh build) with the old sidecar left beside it made the next incremental build
|
|
349
|
+
diff against another tree: a graph 0 next to meta 1 missed every edit between 0 and 1
|
|
350
|
+
and still said `incremental`.
|
|
351
|
+
"""
|
|
352
|
+
meta_id = ((old_meta or {}).get("scope") or {}).get("scope_id")
|
|
353
|
+
graph_id = (old_graph.provenance or {}).get("scope_id")
|
|
354
|
+
if meta_id and graph_id and meta_id != graph_id:
|
|
355
|
+
return "the sidecar describes another build than the graph"
|
|
356
|
+
return None
|
|
357
|
+
|
|
358
|
+
|
|
337
359
|
def _incremental_core(args, repeat):
|
|
338
360
|
"""Update the core of an existing repo-scoped graph at ``args.out`` (R1-C86 D1).
|
|
339
361
|
|
|
@@ -351,6 +373,9 @@ def _incremental_core(args, repeat):
|
|
|
351
373
|
if old_graph.target != Path(args.path).resolve().name or \
|
|
352
374
|
not (old_graph.provenance or {}).get("roots"):
|
|
353
375
|
return None, {"mode": "full", "affected": []}
|
|
376
|
+
why = _sidecar_mismatch(old_meta, old_graph)
|
|
377
|
+
if why:
|
|
378
|
+
return None, {"mode": "full", "affected": [], "reason": why}
|
|
354
379
|
from codemap.extract.roots import _rel_to
|
|
355
380
|
consumers, docs = tuple(args.consumer or ()), tuple(args.docs or ())
|
|
356
381
|
new_scope = resolve_scope(args.path, consumers=consumers, docs=docs)
|
|
@@ -88,6 +88,12 @@ def graph_currency(graph_path: str, graph_scope_id: str | None, *, roots: dict |
|
|
|
88
88
|
if not meta or not meta.get("argv"):
|
|
89
89
|
return _via_roots(graph_scope_id, roots, target, base,
|
|
90
90
|
"no build recipe beside the graph")
|
|
91
|
+
# R1-C92 D2: a sidecar left beside a replaced graph describes another build — its
|
|
92
|
+
# recipe and its baseline would answer for a tree this graph never saw.
|
|
93
|
+
meta_id = (meta.get("scope") or {}).get("scope_id")
|
|
94
|
+
if meta_id and meta_id != graph_scope_id:
|
|
95
|
+
return _via_roots(graph_scope_id, roots, target, base,
|
|
96
|
+
"the sidecar describes another build than the graph")
|
|
91
97
|
cwd = meta.get("cwd")
|
|
92
98
|
if not cwd or not os.path.isdir(cwd):
|
|
93
99
|
return _via_roots(graph_scope_id, roots, target, base,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codmap
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Static analyzer that turns a package's source into a queryable code graph.
|
|
5
5
|
Author-email: kogriv <kogriv@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -44,7 +44,7 @@ and a **SCIP index** for interop with Sourcegraph / Glean and other precise-code
|
|
|
44
44
|
|
|
45
45
|
[](https://github.com/kogriv/codemap/actions/workflows/ci.yml)
|
|
46
46
|
|
|
47
|
-
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **
|
|
47
|
+
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **1278 tests with no failures on
|
|
48
48
|
Python 3.11–3.14** ([in CI](docs/ci.md): the full suite including the dogfood pass, a determinism check, a
|
|
49
49
|
wheel smoke test, and ctags/SCIP interop against the real CLIs), warm serve surface with 31 ops (28 exposed
|
|
50
50
|
as MCP tools), and SCIP export. See **[DESIGN.md](DESIGN.md)** (product design &
|
|
@@ -163,6 +163,7 @@ tests/test_r1c89_review_docs.py
|
|
|
163
163
|
tests/test_r1c8_deadcode.py
|
|
164
164
|
tests/test_r1c90_currency_without_recipe.py
|
|
165
165
|
tests/test_r1c91_route_vocabulary.py
|
|
166
|
+
tests/test_r1c92_sidecar_pair.py
|
|
166
167
|
tests/test_r1c9_incremental.py
|
|
167
168
|
tests/test_scip_export.py
|
|
168
169
|
tests/test_scope.py
|
|
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
|
|
9
9
|
# version. README says this plainly, since `pip install codmap` / `import codemap` is a
|
|
10
10
|
# seam a reader will otherwise hit by surprise.
|
|
11
11
|
name = "codmap"
|
|
12
|
-
version = "0.0.
|
|
12
|
+
version = "0.0.36"
|
|
13
13
|
description = "Static analyzer that turns a package's source into a queryable code graph."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
# M20/D1: measured, not assumed. Each release of the declared range runs the full suite in
|
|
@@ -96,7 +96,10 @@ def test_E3_unknown_routes_are_listed_with_counts(repo):
|
|
|
96
96
|
graph = _build(repo)
|
|
97
97
|
e = next(e for e in graph.edges if e.extras.get("resolution") == "imported")
|
|
98
98
|
e.extras["resolution"] = "future"
|
|
99
|
-
|
|
99
|
+
# Read the reader's version from the graph itself: a literal here went stale the moment
|
|
100
|
+
# the package version moved past it, and the graph then read as "newer" (0.0.36 release CI).
|
|
101
|
+
built = graph.provenance["tool"]["version"]
|
|
102
|
+
d = newer_tool_diagnostic(graph, running=built)
|
|
100
103
|
assert d["unrecognised"] == {f"{e.type}:future": 1}
|
|
101
104
|
assert "rebuild it with this codemap" in d["message"], "not newer: the remedy is a rebuild"
|
|
102
105
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""R1-C92 — a graph and its sidecar must describe one build, or the sidecar is not used.
|
|
2
|
+
|
|
3
|
+
Design `docs/design/sidecar_pair.md` (pre-registered 8f525ea).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import shutil
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from codemap import store
|
|
15
|
+
from codemap.cli import main
|
|
16
|
+
from codemap.serve.session import Session
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _write(root: Path, files: dict):
|
|
20
|
+
for rel, body in files.items():
|
|
21
|
+
p = root / rel
|
|
22
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
p.write_text(body)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
BASE = {"pkg/__init__.py": "", **{f"pkg/m{i}.py": f"def f{i}():\n return {i}\n" for i in range(1, 7)}}
|
|
27
|
+
STATE1 = {"pkg/m1.py": "from pkg.m3 import f3\n\n\ndef f1():\n return f3()\n"}
|
|
28
|
+
EDIT = {"pkg/m2.py": "def f2():\n return 22\n"}
|
|
29
|
+
CALL = ("calls", "pkg.m1.f1", "pkg.m3.f3")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _build(out: Path, *extra) -> str:
|
|
33
|
+
return main(["build", "pkg", "-o", str(out), *extra])
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _pair(dst: Path, graph: Path, meta_of: Path):
|
|
37
|
+
shutil.copy(graph, dst)
|
|
38
|
+
shutil.copy(str(meta_of) + ".meta.json", str(dst) + ".meta.json")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _edges(path: Path):
|
|
42
|
+
return {(e["type"], e["source"], e["target"]) for e in json.loads(path.read_text())["edges"]}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _same(a: Path, b: Path) -> bool:
|
|
46
|
+
x, y = json.loads(a.read_text()), json.loads(b.read_text())
|
|
47
|
+
for g in (x, y):
|
|
48
|
+
g["provenance"].pop("incremental", None)
|
|
49
|
+
return x == y
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@pytest.fixture
|
|
53
|
+
def tree(tmp_path, monkeypatch):
|
|
54
|
+
root = tmp_path / "t"
|
|
55
|
+
_write(root, BASE)
|
|
56
|
+
monkeypatch.chdir(root)
|
|
57
|
+
g0, g1 = tmp_path / "g0.json", tmp_path / "g1.json"
|
|
58
|
+
assert _build(g0) == 0
|
|
59
|
+
_write(root, STATE1)
|
|
60
|
+
assert _build(g1) == 0
|
|
61
|
+
return root, tmp_path, g0, g1
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_E1_graph_older_than_its_sidecar_is_rebuilt_in_full(tree, capsys):
|
|
65
|
+
root, tmp, g0, g1 = tree
|
|
66
|
+
g = tmp / "g.json"
|
|
67
|
+
_pair(g, g0, g1)
|
|
68
|
+
_write(root, EDIT)
|
|
69
|
+
capsys.readouterr()
|
|
70
|
+
assert _build(g, "--incremental") == 0
|
|
71
|
+
err = capsys.readouterr().err
|
|
72
|
+
assert "[incremental] full" in err and "the sidecar describes another build" in err
|
|
73
|
+
full = tmp / "full.json"
|
|
74
|
+
assert _build(full) == 0
|
|
75
|
+
assert CALL in _edges(g), "the edit between graph and sidecar must not be lost"
|
|
76
|
+
assert _same(g, full)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_E2_graph_newer_than_its_sidecar_is_rebuilt_in_full(tree, capsys):
|
|
80
|
+
root, tmp, g0, g1 = tree
|
|
81
|
+
g = tmp / "g.json"
|
|
82
|
+
_pair(g, g1, g0)
|
|
83
|
+
_write(root, EDIT)
|
|
84
|
+
capsys.readouterr()
|
|
85
|
+
assert _build(g, "--incremental") == 0
|
|
86
|
+
assert "the sidecar describes another build" in capsys.readouterr().err
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_E3_a_matched_pair_stays_incremental(tree, capsys):
|
|
90
|
+
root, tmp, g0, g1 = tree
|
|
91
|
+
_write(root, EDIT)
|
|
92
|
+
capsys.readouterr()
|
|
93
|
+
assert _build(g1, "--incremental") == 0
|
|
94
|
+
err = capsys.readouterr().err
|
|
95
|
+
assert "[incremental] incremental: 1 module(s) recomputed\n" in err
|
|
96
|
+
full = tmp / "full.json"
|
|
97
|
+
assert _build(full) == 0
|
|
98
|
+
assert _same(g1, full)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_E4_repo_scoped_mismatch_is_rebuilt_in_full(tmp_path, monkeypatch, capsys):
|
|
102
|
+
root = tmp_path / "t"
|
|
103
|
+
_write(root, {**BASE, "tests/test_m.py": "from pkg.m1 import f1\n\n\ndef test_f1():\n f1()\n"})
|
|
104
|
+
monkeypatch.chdir(root)
|
|
105
|
+
flags = ("--consumer", "tests", "--mode", "full")
|
|
106
|
+
g0, g1, g = tmp_path / "g0.json", tmp_path / "g1.json", tmp_path / "g.json"
|
|
107
|
+
assert _build(g0, *flags) == 0
|
|
108
|
+
_write(root, STATE1)
|
|
109
|
+
assert _build(g1, *flags) == 0
|
|
110
|
+
_pair(g, g0, g1)
|
|
111
|
+
_write(root, EDIT)
|
|
112
|
+
capsys.readouterr()
|
|
113
|
+
assert _build(g, *flags, "--incremental") == 0
|
|
114
|
+
assert "the sidecar describes another build" in capsys.readouterr().err
|
|
115
|
+
assert CALL in _edges(g)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def test_E5_currency_does_not_use_a_foreign_sidecar(tree):
|
|
119
|
+
root, tmp, g0, g1 = tree
|
|
120
|
+
g = tmp / "g.json"
|
|
121
|
+
_pair(g, g0, g1)
|
|
122
|
+
c = Session(store.load(str(g)), graph_path=str(g), currency_ttl=0,
|
|
123
|
+
source_root=str(root)).handle({"op": "stats"})["currency"]
|
|
124
|
+
assert c["status"] == "behind"
|
|
125
|
+
assert c["via"].startswith("provenance roots under"), c
|
|
126
|
+
assert "changed" not in c, "no counts from another build's baseline"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|