sourcecode 2.5.12__py3-none-any.whl → 2.5.13__py3-none-any.whl

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.

Potentially problematic release.


This version of sourcecode might be problematic. Click here for more details.

sourcecode/__init__.py CHANGED
@@ -4,4 +4,4 @@ ASK Engine is the product. ``ask`` is the canonical CLI command; ``sourcecode``
4
4
  the legacy compatibility alias and the Python/PyPI package name. See
5
5
  docs/PRODUCT_IDENTITY.md (normative)."""
6
6
 
7
- __version__ = "2.5.12"
7
+ __version__ = "2.5.13"
@@ -120,6 +120,54 @@ def is_test_or_fixture_path(path: str) -> bool:
120
120
  return False
121
121
 
122
122
 
123
+ # Infrastructure words that, combined with a delimited "test" token in the same
124
+ # directory segment, identify a module whose code is test scaffolding even though
125
+ # it lives under src/main (e.g. "server-test-utils", "foo-testkit"). Kept narrow
126
+ # on purpose: the "test" token must be present in the SAME segment, so packages
127
+ # named "utils"/"support"/"tools" alone never match.
128
+ _TEST_INFRA_TOKENS = frozenset({
129
+ "util", "utils", "fixture", "fixtures", "support",
130
+ "framework", "kit", "harness", "tools", "tool",
131
+ "helper", "helpers", "mock", "mocks", "stub", "stubs", "dummy",
132
+ })
133
+
134
+ # Glued (non-hyphenated) test-fixture module suffixes.
135
+ _TEST_INFRA_SUFFIXES = (
136
+ "testutils", "testutil", "testkit", "testfixtures", "testfixture",
137
+ "testsupport", "testframework", "testharness", "testtools",
138
+ "testhelpers", "testmocks", "teststubs",
139
+ )
140
+
141
+
142
+ def is_test_fixture_module_path(path: str) -> bool:
143
+ """Return True when *path* belongs to a test-fixture / test-utility MODULE.
144
+
145
+ Structural, name-agnostic: a directory segment must contain a hyphen/underscore
146
+ -delimited ``test`` token together with an infrastructure word (util(s),
147
+ fixture(s), support, framework, kit, harness, tools, helper(s), mock(s),
148
+ stub(s), dummy) — e.g. ``server-test-utils``, ``foo-testkit``,
149
+ ``bar-test-support`` — or match a known test-module segment outright.
150
+
151
+ This is deliberately NARROWER than :func:`is_test_or_fixture_path`: it targets
152
+ modules that ship HTTP resources, JAX-RS ``@Path`` fixtures, or dummy
153
+ controllers under ``src/main`` so they are not misreported as production API
154
+ surface. Requiring both tokens in one segment keeps legitimate ``utils`` /
155
+ ``support`` / ``tools`` packages from ever matching.
156
+ """
157
+ norm = path.replace("\\", "/").lower()
158
+ parts = norm.split("/")
159
+ for part in parts[:-1]: # skip the filename
160
+ bare = part.rstrip("/")
161
+ if bare in _TEST_MODULE_SEGMENTS:
162
+ return True
163
+ if bare.endswith(_TEST_INFRA_SUFFIXES):
164
+ return True
165
+ toks = bare.replace("_", "-").split("-")
166
+ if "test" in toks and any(t in _TEST_INFRA_TOKENS for t in toks):
167
+ return True
168
+ return False
169
+
170
+
123
171
  def is_vendor_path(path: str) -> bool:
124
172
  """Return True when *path* is inside a vendored / third-party directory.
125
173
 
@@ -5584,7 +5584,7 @@ def extract_java_endpoints(root: Path) -> "dict[str, Any]":
5584
5584
  """
5585
5585
  import re as _re
5586
5586
  from typing import Any as _Any
5587
- from sourcecode.path_filters import is_test_path
5587
+ from sourcecode.path_filters import is_test_path, is_test_fixture_module_path
5588
5588
 
5589
5589
  _EXTENDS_FROM_SIG = _re.compile(r'\bextends\s+(\w+)')
5590
5590
 
@@ -5753,6 +5753,16 @@ def extract_java_endpoints(root: Path) -> "dict[str, Any]":
5753
5753
  endpoint_warnings = _recovery["warnings"]
5754
5754
  _openapi_spec_path = _recovery["spec_path"]
5755
5755
 
5756
+ # Map each declared class/interface FQN to its source file so an endpoint can be
5757
+ # traced back to the MODULE that ships it. Used to flag endpoints that originate
5758
+ # in a test-fixture / test-utility module (dummy web services, JAX-RS @Path
5759
+ # fixtures) living under src/main — these are not production API surface.
5760
+ _fqn_to_file: dict[str, str] = {
5761
+ s.symbol: (s.source_file or s.declaring_file)
5762
+ for s in all_symbols
5763
+ if s.type in ("class", "interface")
5764
+ }
5765
+
5756
5766
  endpoints: list[dict] = []
5757
5767
  for route in routes:
5758
5768
  handler = (
@@ -5769,6 +5779,9 @@ def extract_java_endpoints(root: Path) -> "dict[str, Any]":
5769
5779
  "handler": handler,
5770
5780
  "return_type": route.get("return_type", "void"),
5771
5781
  }
5782
+ _src = _fqn_to_file.get(route.get("effective_class", ""), "")
5783
+ if _src and is_test_fixture_module_path(_src):
5784
+ entry["scope"] = "test_util"
5772
5785
  # Use security_annotations already extracted by _build_route_surface
5773
5786
  # via the canonical _route_security_from_sym extractor.
5774
5787
  security_info = route.get("security_annotations")
@@ -5791,6 +5804,14 @@ def extract_java_endpoints(root: Path) -> "dict[str, Any]":
5791
5804
  )
5792
5805
  endpoints = [e for e in endpoints if not _FQN_PATH_RE.search(e.get("path", ""))]
5793
5806
 
5807
+ # Partition test-fixture/test-utility endpoints out of the production surface.
5808
+ # They ship under src/main of a *-test-utils / *-testkit / test-framework module
5809
+ # (dummy web services, JAX-RS @Path fixtures) and must not be reported as, or
5810
+ # counted with, the real API surface — but they are preserved in their own bucket
5811
+ # so nothing is silently dropped and the exclusion is auditable.
5812
+ _test_util_endpoints = [e for e in endpoints if e.get("scope") == "test_util"]
5813
+ endpoints = [e for e in endpoints if e.get("scope") != "test_util"]
5814
+
5794
5815
  # "no_security_signal" = no recognized security annotation at method OR class level.
5795
5816
  # Note: repos may use framework-level security (e.g. Keycloak itself) with no
5796
5817
  # per-endpoint annotations — this count reflects annotation-based coverage only.
@@ -5919,6 +5940,16 @@ def extract_java_endpoints(root: Path) -> "dict[str, Any]":
5919
5940
  # Keep legacy field name for backward compat, now means same as no_security_signal
5920
5941
  "undocumented": no_security_signal,
5921
5942
  }
5943
+ # Surface test-fixture endpoints excluded from the production surface above.
5944
+ # Reported separately (not hidden) so the exclusion is transparent and auditable.
5945
+ if _test_util_endpoints:
5946
+ result["test_util_endpoints"] = _test_util_endpoints
5947
+ result["test_util_excluded"] = len(_test_util_endpoints)
5948
+ result.setdefault("notes", []).append(
5949
+ f"{len(_test_util_endpoints)} endpoint(s) from test-fixture/test-utility "
5950
+ f"module(s) under src/main were excluded from the production surface "
5951
+ f"(see test_util_endpoints)."
5952
+ )
5922
5953
  # Surface incomplete-endpoint warnings (interface-defined controllers) only when
5923
5954
  # present, to keep output backward-compatible for the common case.
5924
5955
  if endpoint_warnings:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 2.5.12
3
+ Version: 2.5.13
4
4
  Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
5
5
  License-File: LICENSE
6
6
  Keywords: agents,ai,codebase,context,developer-tools,llm
@@ -1,4 +1,4 @@
1
- sourcecode/__init__.py,sha256=OYjcfmD8BAbYO_oviKYCufYRUQmu9cFURHhQC4BEofc,309
1
+ sourcecode/__init__.py,sha256=M8eYjrmWCXZgccRJ042BhY9QS6VmNX4SDwD_gMX9cvo,309
2
2
  sourcecode/adaptive_scanner.py,sha256=XffluXKzJUXrMtjEiAOnSNPZnztdIcts17T9ouHeID0,10521
3
3
  sourcecode/archetype.py,sha256=d7yoN6Tj4OBj-VgSMPEKg4WF9H8FypnZ5A6AkUh5oIE,34484
4
4
  sourcecode/architecture_analyzer.py,sha256=GFc4ek-s1IHWM7pl-0L32WahZ93AmDgrAMcOuBKA5Dk,61463
@@ -45,7 +45,7 @@ sourcecode/metrics_analyzer.py,sha256=m0ENgtqKeBL17kUIK3fmGkgo7UfXBNHxCMj0H_Y5K7
45
45
  sourcecode/migrate_check.py,sha256=HJhvHuvXDGTJSRQU9_AMx0L94h2TImC1DCGs3m3RTu0,108199
46
46
  sourcecode/openapi_surface.py,sha256=BTt0K-woZbkbWTN77IkqeBm_Okag9owR0848fmot8sk,16207
47
47
  sourcecode/output_budget.py,sha256=Js9yUlfQtPhqBl9R6wn_9UHVjjJc3GtLcqyfjf5t50Q,9869
48
- sourcecode/path_filters.py,sha256=T1y0SJsmUJBju2Hh_-z40kURAowUEq42FpPgWLbOaY0,6931
48
+ sourcecode/path_filters.py,sha256=809P9hj_QChNLg8wk4HuKcFUZmnDKNz0sKIMbmt_FNE,9138
49
49
  sourcecode/pr_comment_renderer.py,sha256=KmcjMruhR44gjzMDJwjBSkWP9QEvh8xWBLyxzxoRbj0,14542
50
50
  sourcecode/pr_impact.py,sha256=dCDVw83EDbyVf6F9ZmEQmsFz8ruVH7d4mpeKQCIZHM0,16805
51
51
  sourcecode/prepare_context.py,sha256=-Xu33qCETuqw-OFfT3ukvAtxde7krCjQpn7wR3pbdOg,224290
@@ -56,7 +56,7 @@ sourcecode/redactor.py,sha256=SB4hwIvg8h-hvcqKcDWaZvA-aSyn-at-BIRwa0tUv5E,3227
56
56
  sourcecode/relevance_scorer.py,sha256=0AgEt4KrV73nioMqBgjhGjtY7L2C7L7cSyKtj3IKcrw,9408
57
57
  sourcecode/rename_refactor.py,sha256=h6dNFlB9aZ_3q6heeHBkgXQeXaT03nvPSsYH6P8qxFg,12965
58
58
  sourcecode/repo_classifier.py,sha256=FG1vaWKdWXsWdl-S8hjVMiTqcwgaRXkDyvK4rPcOGtQ,22681
59
- sourcecode/repository_ir.py,sha256=F6lRgPoP8oTtnGpRgjoLw-dlxZRXH7XOcehtcNwufEY,309550
59
+ sourcecode/repository_ir.py,sha256=bNSUKkWQEvFQ2wSZPRdn_9cZfx6TRcPzGtM2EgMm49M,311400
60
60
  sourcecode/ris.py,sha256=Hw8TakTQ6hku-Abf2k8954NwkrH_sP73_8wVH8x5khc,22079
61
61
  sourcecode/runtime_classifier.py,sha256=uTAD6BDCiBLUZEDRfqk718kM4RTT_vAbfkcOI2_Xx58,18432
62
62
  sourcecode/scanner.py,sha256=WdOQ78mMzjR1NjmKTlbxdgwinnCTfAhxCVLBEFQiFHU,8899
@@ -137,8 +137,8 @@ sourcecode/telemetry/consent.py,sha256=LIAO9ohJZF8OuZwM4u1VWtALlYfTCCKq4wV3Vwc7i
137
137
  sourcecode/telemetry/events.py,sha256=LtzYfaX9Ilckj5PTvAcTpDa9mLqDsYPDUiDkRa58piY,2580
138
138
  sourcecode/telemetry/filters.py,sha256=NHa5T-6DaZduQPFuC34jOqHWQgSizM-Ygq8aZ4j19ng,5834
139
139
  sourcecode/telemetry/transport.py,sha256=4gGHsq0WeY9VywEZXA3vUxykfiYnw9uuqfjAAec7F8o,1681
140
- sourcecode-2.5.12.dist-info/METADATA,sha256=_ZdJavgYcJbSneqocYtK_QZUZ7nsYc9aJkKevISBgO8,10852
141
- sourcecode-2.5.12.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
142
- sourcecode-2.5.12.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
143
- sourcecode-2.5.12.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
144
- sourcecode-2.5.12.dist-info/RECORD,,
140
+ sourcecode-2.5.13.dist-info/METADATA,sha256=hAqH0Dxo8V6o4vDdpqalzX3njpQNvHIO8-t5zglFo68,10852
141
+ sourcecode-2.5.13.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
142
+ sourcecode-2.5.13.dist-info/entry_points.txt,sha256=-JEAdChrK5We51kZcb7OaDcyil-dHBjBPL-NhuO-QY8,89
143
+ sourcecode-2.5.13.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
144
+ sourcecode-2.5.13.dist-info/RECORD,,