Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(ingestion): a Spring Boot main is a declared entry point, ranked above filename guesses (#4487)
Raghav Chamadiya5a38b114e0fd
diff --git a/packages/core/src/repowise/core/analysis/kg_curation.py b/packages/core/src/repowise/core/analysis/kg_curation.pyindex ceabc1b90..d88713c06 100644--- a/packages/core/src/repowise/core/analysis/kg_curation.py+++ b/packages/core/src/repowise/core/analysis/kg_curation.py@@ -377,8 +377,9 @@ def _curate_entry_points((a resolver's deep ``index.py``) are dropped from candidacy outright.``project.entry_points`` holds the top few, ``project.entry_candidates`` thefull ranked list. A manifest-declared entry (``FileInfo.is_manifest_entry``)- ranks first and is exempt from the barrel and glue drops: a package's- declared ``src/index.ts`` is its front door whatever its shape or depth.+ or an application main (``FileInfo.is_application_main``) ranks first and+ is exempt from the barrel and glue drops: a package's declared+ ``src/index.ts`` is its front door whatever its shape or depth.When ingestion flagged no entries at all, the strong:func:`score_entry_points` scorers (entry-style filenames) fill in, so theorientation panel never opens empty on repos without a detectable main.@@ -389,7 +390,10 @@ def _curate_entry_points(betweenness = _betweenness(graph_builder)manifest = frozenset(- path for path, pf in pf_by_path.items() if getattr(pf.file_info, "is_manifest_entry", False)+ path+ for path, pf in pf_by_path.items()+ if getattr(pf.file_info, "is_manifest_entry", False)+ or getattr(pf.file_info, "is_application_main", False))paths = _flagged_entry_paths(kg, pf_by_path, manifest)if not paths:diff --git a/packages/core/src/repowise/core/entry_candidacy.py b/packages/core/src/repowise/core/entry_candidacy.pyindex 26d60ac63..7f63f13cb 100644--- a/packages/core/src/repowise/core/entry_candidacy.py+++ b/packages/core/src/repowise/core/entry_candidacy.py@@ -21,6 +21,7 @@ data table — so every rule is unit-testable directly.from __future__ import annotations+import refrom collections.abc import Mappingfrom functools import cachefrom pathlib import PurePosixPath@@ -114,6 +115,38 @@ def not_an_execution_start(path: str, language: str) -> bool:return language in non_code_entry_languages() or is_glue_leaf(path)+# Spring Boot's own start, each form naming the application class it boots:+# ``SpringApplication.run(App.class, args)``, its builder form, and Kotlin's+# ``runApplication<App>()``. The JVM dynamic hints read the same patterns to link+# the call to that class. The annotation must open a line, so a Javadoc+# ``{@link SpringBootApplication}`` does not count.+SPRING_BOOT_RUN_RE = re.compile(r"SpringApplication\.run\s*\(\s*([A-Z]\w*)\s*\.class")+SPRING_BOOT_BUILDER_RE = re.compile(r"new\s+SpringApplicationBuilder\s*\(\s*([A-Z]\w*)\s*\.class")+KOTLIN_RUN_APPLICATION_RE = re.compile(r"\brunApplication\s*<\s*([A-Z]\w*)\s*>")+_SPRING_BOOT_ANNOTATION_RE = re.compile(r"^\s*@SpringBootApplication\b", re.MULTILINE)+_APPLICATION_MAIN_PATTERNS = (+ SPRING_BOOT_RUN_RE,+ SPRING_BOOT_BUILDER_RE,+ KOTLIN_RUN_APPLICATION_RE,+ _SPRING_BOOT_ANNOTATION_RE,+)+#: Languages :func:`boots_application` reads. Ceiling: Spring Boot only;+#: Micronaut's ``Micronaut.run`` or Quarkus's ``@QuarkusMain`` would join here.+APPLICATION_MAIN_LANGUAGES: frozenset[str] = frozenset({"java", "kotlin"})+++def boots_application(language: str, text: str) -> bool:+ """Whether *text*, a file's source, starts a framework application.++ That is where execution starts as surely as a manifest says so, whatever+ the file is named, so the entry-point ranking puts it with the+ manifest-declared entries.+ """+ return language in APPLICATION_MAIN_LANGUAGES and any(+ p.search(text) for p in _APPLICATION_MAIN_PATTERNS+ )++def is_reachability_root(node_data: Mapping[str, Any]) -> bool:"""Whether a file node is reached from outside the graph (dead-code exempt).diff --git a/packages/core/src/repowise/core/generation/entry_points.py b/packages/core/src/repowise/core/generation/entry_points.pyindex 303e327c7..94d068f84 100644--- a/packages/core/src/repowise/core/generation/entry_points.py+++ b/packages/core/src/repowise/core/generation/entry_points.py@@ -30,11 +30,11 @@ and its score reads the ``is_entry_point`` flag itself, which this key neversees. Sharing the key there would decide page selection on filename, depth andcentrality with the one direct piece of evidence dropped.-**Ranking cannot rescue bad candidacy, and the corpus still shows it.** On-``spring-petclinic`` the Spring stamper flags 24 entity and controller classes-and never flags ``PetClinicApplication.java``, so no ordering over that set can-name the front door: the best this key can do is pick a different wrong file.-That is a candidacy gap, tracked separately.+**Ranking cannot rescue bad candidacy.** ``spring-petclinic``'s+``PetClinicApplication.java`` carries no entry-style name, so no ordering over+the filename guesses could name it. Ingestion now flags a file that boots a+framework application (``entry_candidacy.boots_application``) and+``RepoStructure.application_mains`` carries it into the declared tier."""from __future__ import annotations@@ -48,6 +48,7 @@ from repowise.core.entry_candidacy import (conventional_entry_stems,entry_point_depth,)+from repowise.core.support_paths import is_example_pathdef _name_bucket(path: str, conventional_stems: frozenset[str]) -> int:@@ -73,8 +74,11 @@ def entry_point_rank_key(Most significant component first:0. **tier** — a file a package manifest names (``bin``, ``main``,- ``exports["."]``, a console script) is declared, not guessed, so it- outranks every filename guess.+ ``exports["."]``, a console script) or that boots a framework+ application is declared, not guessed, so it outranks every filename+ guess. Example, demo and benchmark code (``is_example_path``) ranks+ after the system's own entries in either case: a sample's+ ``Main.java`` demonstrates the system rather than starting it.1. **name bucket** — a conventional entry name (``main``/``app``/``cli``/``manage``/…) never loses to a generic glue stem (``index``/``mod``),and glue never outranks a real entry.@@ -85,7 +89,7 @@ def entry_point_rank_key(4. **path** — deterministic final tiebreak."""return (- 0 if path in manifest_entries else 1,+ (0 if path in manifest_entries else 1) + (2 if is_example_path(path) else 0),_name_bucket(path, conventional_stems),entry_point_depth(path),-(pagerank + betweenness),@@ -93,7 +97,9 @@ def entry_point_rank_key()-def rank_entry_point_paths(paths: Iterable[str]) -> list[str]:+def rank_entry_point_paths(+ paths: Iterable[str], declared: frozenset[str] = frozenset()+) -> list[str]:"""Rank bare paths, best entry first, with no centrality to break ties.The sibling for callers that hold a set or a query result rather than a@@ -101,9 +107,13 @@ def rank_entry_point_paths(paths: Iterable[str]) -> list[str]:agree on name and depth, and the path component keeps the order total, soomitting it costs nothing but determinism-preserving arbitrariness.Callers that do hold centrality should use :func:`rank_entry_points`.+ *declared* is the tier-0 set :func:`entry_point_rank_key` reads."""stems = conventional_entry_stems()- return sorted(paths, key=lambda p: entry_point_rank_key(p, conventional_stems=stems))+ return sorted(+ paths,+ key=lambda p: entry_point_rank_key(p, conventional_stems=stems, manifest_entries=declared),+ )def orientation_entry_points(repo_structure: Any, *, limit: int | None = None) -> list[str]:@@ -165,7 +175,10 @@ def orientation_entry_points(repo_structure: Any, *, limit: int | None = None) -so a React ``src/components/App.tsx`` is published as an execution entrypoint, as is any ``run.py`` / ``server.ts`` at any depth."""- ranked = rank_entry_point_paths(getattr(repo_structure, "entry_points", None) or [])+ ranked = rank_entry_point_paths(+ getattr(repo_structure, "entry_points", None) or [],+ frozenset(getattr(repo_structure, "application_mains", None) or ()),+ )return ranked if limit is None else ranked[:limit]diff --git a/packages/core/src/repowise/core/generation/onboarding/subkinds/how_it_works.py b/packages/core/src/repowise/core/generation/onboarding/subkinds/how_it_works.pyindex 28a2bcf4d..d8529da35 100644--- a/packages/core/src/repowise/core/generation/onboarding/subkinds/how_it_works.py+++ b/packages/core/src/repowise/core/generation/onboarding/subkinds/how_it_works.py@@ -21,6 +21,7 @@ from typing import Literalimport structlog+from ....support_paths import is_example_pathfrom ...entry_points import orientation_entry_pointsfrom ..registry import SubkindSpec, registerfrom ..signals import OnboardingSignals, file_layer_map@@ -119,9 +120,19 @@ def _classify_archetype(signals: OnboardingSignals) -> tuple[Archetype, list[strpipeline_hits = dep_names & _PIPELINE_HINTSapi_contract_count = sum(1 for pf in signals.parsed_files if pf.file_info.is_api_contract)-- # Service tilt wins if we have either framework deps or API contract files.- if service_hits or api_contract_count > 0:+ # Read from the code, so it holds where no dependency manifest was inventoried.+ # A sample main under examples/ demonstrates the system rather than being it.+ app_mains = [+ p+ for p in getattr(signals.repo_structure, "application_mains", None) or []+ if not is_example_path(p)+ ]++ # Service tilt wins on framework deps, API contract files or an application main.+ if service_hits or api_contract_count > 0 or app_mains:+ if app_mains:+ more = f" and {len(app_mains) - 1} more" if len(app_mains) > 1 else ""+ evidence.append(f"application main: `{app_mains[0]}`{more}")if service_hits:evidence.append(f"service framework(s) detected: {', '.join(sorted(service_hits))}")if api_contract_count:diff --git a/packages/core/src/repowise/core/generation/templates/stub/onboarding/how_it_works.j2 b/packages/core/src/repowise/core/generation/templates/stub/onboarding/how_it_works.j2index a17bef659..8cb997a6a 100644--- a/packages/core/src/repowise/core/generation/templates/stub/onboarding/how_it_works.j2+++ b/packages/core/src/repowise/core/generation/templates/stub/onboarding/how_it_works.j2@@ -10,7 +10,7 @@ Traced from the entry points outward: which files each run touches, in order. Wh## Shape-{#- archetype can come through empty on a repo with no recognised sources;+{# archetype can come through empty on a repo with no recognised sources;indexing it unguarded raises under StrictUndefined and loses the page. -#}`{{ ctx.repo_name }}` looks like {{ "an" if ctx.archetype and ctx.archetype[0] in "aeiou" else "a" }} **{{ ctx.archetype or "codebase" }}**{% if ctx.archetype_evidence %}, based on:{% for e in ctx.archetype_evidence %}diff --git a/packages/core/src/repowise/core/generation/tour.py b/packages/core/src/repowise/core/generation/tour.pyindex 1d593aa2b..bd26f8b10 100644--- a/packages/core/src/repowise/core/generation/tour.py+++ b/packages/core/src/repowise/core/generation/tour.py@@ -96,6 +96,8 @@ def score_entry_points("""Score code files as candidate tour entry points, descending.Scoring (additive):+ * declared by a manifest or an application main .. +6 (code files only;+ more than every guess below adds up to, as the orientation list ranks it)* ``is_entry_point`` ingestion flag .............. +3 (code files only)* filename stem in the entry-name set ............ +3 (code files only)* file at repo root or one level deep ............ +1@@ -132,6 +134,10 @@ def score_entry_points(and infer_layer(path, language) not in ADJACENT_LAYERSand not is_support_path(path))+ if entry_eligible and (+ getattr(fi, "is_manifest_entry", False) or getattr(fi, "is_application_main", False)+ ):+ score += 6.0if entry_eligible and getattr(fi, "is_entry_point", False):score += 3.0if entry_eligible and PurePosixPath(path).stem.lower() in _ENTRY_FILENAME_STEMS:diff --git a/packages/core/src/repowise/core/ingestion/dynamic_hints/jvm.py b/packages/core/src/repowise/core/ingestion/dynamic_hints/jvm.pyindex c504747c5..837b0b340 100644--- a/packages/core/src/repowise/core/ingestion/dynamic_hints/jvm.py+++ b/packages/core/src/repowise/core/ingestion/dynamic_hints/jvm.py@@ -26,6 +26,7 @@ from __future__ import annotationsimport refrom pathlib import Path+from ...entry_candidacy import KOTLIN_RUN_APPLICATION_RE, SPRING_BOOT_RUN_REfrom ..type_names import bare_type_namefrom .base import DynamicEdge, DynamicHintExtractor@@ -45,10 +46,10 @@ _MOCKK_RE = re.compile(r"\b(?:mockk|spyk)\s*<\s*([A-Z]\w*)\s*>")# MapStruct: Mappers.getMapper(XMapper.class)_MAPSTRUCT_RE = re.compile(r"Mappers\.getMapper\s*\(\s*([A-Z]\w*)\s*\.class")-# Spring Boot entry: SpringApplication.run(MyApp.class, args)-_BOOT_RUN_RE = re.compile(r"SpringApplication\.run\s*\(\s*([A-Z]\w*)\s*\.class")-# Kotlin: runApplication<MyApp>(*args)-_KOTLIN_RUN_APP_RE = re.compile(r"\brunApplication\s*<\s*([A-Z]\w*)\s*>")+# Spring Boot entry: SpringApplication.run(MyApp.class, args) and Kotlin's+# runApplication<MyApp>(*args), shared with ingestion's entry-point rule.+_BOOT_RUN_RE = SPRING_BOOT_RUN_RE+_KOTLIN_RUN_APP_RE = KOTLIN_RUN_APPLICATION_RE# Jackson / Gson: objectMapper.readValue(json, X.class) / gson.fromJson(json, X.class)_JSON_READ_RE = re.compile(diff --git a/packages/core/src/repowise/core/ingestion/models.py b/packages/core/src/repowise/core/ingestion/models.pyindex 122f336c7..e47cc84a2 100644--- a/packages/core/src/repowise/core/ingestion/models.py+++ b/packages/core/src/repowise/core/ingestion/models.py@@ -184,6 +184,9 @@ class FileInfo:# Reached from outside the import graph (a runner or loader starts it), so# dead-code analysis never flags it. Read through ``is_reachability_root``.is_reachability_root: bool = False+ # Starts a framework application (``SpringApplication.run``): ranked with+ # the manifest entries, but not a public API the way those are.+ is_application_main: bool = False@dataclass@@ -209,6 +212,9 @@ class RepoStructure:total_files: inttotal_loc: intentry_points: list[str]+ # The entry points that start a framework application, which make the repo+ # a service and lead the orientation list.+ application_mains: list[str] = field(default_factory=list)@dataclassdiff --git a/packages/core/src/repowise/core/ingestion/traverser.py b/packages/core/src/repowise/core/ingestion/traverser.pyindex 09312dc26..dd487dee9 100644--- a/packages/core/src/repowise/core/ingestion/traverser.py+++ b/packages/core/src/repowise/core/ingestion/traverser.py@@ -34,7 +34,12 @@ from pathspec.patterns.gitwildmatch import GitWildMatchPattern, GitWildMatchPattfrom ..code_origin import CONTENT_TEST_SUFFIXES, declares_test, is_generated_headerfrom ..dotnet_test_projects import DotnetTestProjects, read_dotnet_test_projects-from ..entry_candidacy import conventional_entry_stems, not_an_execution_start+from ..entry_candidacy import (+ APPLICATION_MAIN_LANGUAGES,+ boots_application,+ conventional_entry_stems,+ not_an_execution_start,+)from ..owned_paths import MANAGED_FILES, OWNED_PATTERNS, only_repowise_differsfrom ..phpunit_roots import (PHPUNIT_CONFIG_NAMES,@@ -567,11 +572,14 @@ class FileTraverser:lang_counts: dict[str, int] = {}entry_points: list[str] = []+ application_mains: list[str] = []for f in files:lang_counts[f.language] = lang_counts.get(f.language, 0) + 1if f.is_entry_point:entry_points.append(f.path)+ if f.is_application_main:+ application_mains.append(f.path)# Display-only estimate (~40 bytes/line), so no file is opened to count.total_loc = sum(f.size_bytes // 40 for f in files)@@ -588,6 +596,7 @@ class FileTraverser:total_files=len(files),total_loc=total_loc,entry_points=sorted(entry_points),+ application_mains=sorted(application_mains),)# ------------------------------------------------------------------@@ -903,7 +912,9 @@ class FileTraverser:rel_str.lower().endswith(CONTENT_TEST_SUFFIXES)and declares_test(rel_str, _read_head(abs_path)))- entry = _is_entry_point(rel_str, abs_path, language) or manifest_entry+ # A test-scoped ``@SpringBootApplication`` boots a test context, not the system.+ app_main = not is_test and _boots_application(abs_path, language)+ entry = _is_entry_point(rel_str, abs_path, language) or manifest_entry or app_mainreturn FileInfo(path=rel_str,abs_path=str(abs_path),@@ -918,6 +929,7 @@ class FileTraverser:is_entry_point=entry and not is_test,is_manifest_entry=manifest_entry,is_reachability_root=entry,+ is_application_main=app_main,)def _is_package_root_dir(self, rel_dir: str) -> bool:@@ -1314,6 +1326,19 @@ def _is_entry_point(rel_str: str, abs_path: Path, language: str) -> bool:return named_entry and not not_an_execution_start(rel_str, language)+# Ceiling: a bootstrap call past the first 16 KB is missed. An application+# main is a short file; reading every JVM file whole would double the walk's I/O.+_APPLICATION_MAIN_SNIFF_BYTES = 16384+++def _boots_application(abs_path: Path, language: str) -> bool:+ """Whether the file starts a framework application (:func:`boots_application`)."""+ if language not in APPLICATION_MAIN_LANGUAGES:+ return False+ head = _head(abs_path, None, _APPLICATION_MAIN_SNIFF_BYTES)+ return head is not None and boots_application(language, head.decode("utf-8", errors="ignore"))++class ConsoleScriptTables(NamedTuple):"""What one pass over the repo's Python and .NET project configs yields."""diff --git a/tests/unit/generation/test_entry_points.py b/tests/unit/generation/test_entry_points.pyindex 7937a2391..6952e133c 100644--- a/tests/unit/generation/test_entry_points.py+++ b/tests/unit/generation/test_entry_points.py@@ -4,6 +4,7 @@ from __future__ import annotationsfrom repowise.core.entry_candidacy import (GLUE_STEMS,+ boots_application,conventional_entry_stems,entry_point_depth,is_glue_leaf,@@ -11,6 +12,7 @@ from repowise.core.entry_candidacy import ()from repowise.core.generation.entry_points import (entry_point_rank_key,+ rank_entry_point_paths,rank_entry_points,)@@ -171,3 +173,46 @@ def test_entry_stem_not_conventional():assert ranked == ["src/main.ts", "src/entry.ts"]key = entry_point_rank_key("src/entry.ts", conventional_stems=stems)assert key[1] == 1 # neutral name bucket+++def test_boots_application_reads_every_spring_boot_start():+ assert boots_application("java", "SpringApplication.run(PetClinicApplication.class, args);")+ # Fineract's ServerApplication starts through the builder.+ assert boots_application(+ "java", "configure(new SpringApplicationBuilder(ServerApplication.class)).run(args);"+ )+ assert boots_application("kotlin", "fun main(args: Array<String>) { runApplication<App>(*args) }")+ assert boots_application("java", "@SpringBootApplication\npublic class App {}")+++def test_boots_application_ignores_mentions_and_other_languages():+ # A comment naming the method, a Javadoc link, and a servlet initializer's+ # ``configure(SpringApplicationBuilder builder)`` start nothing.+ assert not boots_application("java", "// SpringApplication.run(String...) does a System.exit")+ assert not boots_application("java", "/** See {@link SpringBootApplication}. */")+ assert not boots_application("java", "SpringApplicationBuilder configure(SpringApplicationBuilder b)")+ assert not boots_application("python", "SpringApplication.run(App.class, args)")+++def test_declared_entry_outranks_a_conventional_stem():+ paths = ["lib/misc/Main.java", "provider/src/main/java/org/acme/ServerApplication.java"]+ declared = frozenset({"provider/src/main/java/org/acme/ServerApplication.java"})+ assert rank_entry_point_paths(paths, declared) == [+ "provider/src/main/java/org/acme/ServerApplication.java",+ "lib/misc/Main.java",+ ]+++def test_example_entries_rank_after_the_systems_own():+ # ``main`` is a conventional stem and ``ServerApplication`` is not, but a+ # sample demonstrates the system rather than starting it.+ paths = ["generator/examples/Main.java", "src/org/acme/ServerApplication.java"]+ assert rank_entry_point_paths(paths) == [+ "src/org/acme/ServerApplication.java",+ "generator/examples/Main.java",+ ]+ declared = frozenset({"samples/app/App.java"})+ assert rank_entry_point_paths(["samples/app/App.java", "src/cli.py"], declared) == [+ "src/cli.py",+ "samples/app/App.java",+ ]diff --git a/tests/unit/generation/test_onboarding.py b/tests/unit/generation/test_onboarding.pyindex 2014f992a..46dc16286 100644--- a/tests/unit/generation/test_onboarding.py+++ b/tests/unit/generation/test_onboarding.py@@ -609,6 +609,28 @@ def test_how_it_works_fires_on_service_archetype() -> None:assert ctx.archetype == "service"+def test_how_it_works_reads_an_application_main_as_a_service() -> None:+ # No dependency manifest inventoried (a Gradle repo): the Boot main alone+ # says service.+ from dataclasses import replace++ spec = onboarding.get_spec(SLOT_HOW_IT_WORKS)+ assert spec is not None+ main = "provider/src/main/java/org/acme/ServerApplication.java"+ sig = _signals(files=[_file(main, language="java", is_entry_point=True)])+ sig = replace(sig, repo_structure=replace(sig.repo_structure, application_mains=[main]))+ ctx = spec.build_context(sig)+ assert ctx is not None+ assert ctx.archetype == "service"+ assert ctx.archetype_evidence == [f"application main: `{main}`"]++ # A sample main shipped with a library does not make the repo a service.+ sample = "examples/demo/src/main/java/org/acme/DemoApplication.java"+ sig = replace(sig, repo_structure=replace(sig.repo_structure, application_mains=[sample]))+ ctx = spec.build_context(sig)+ assert ctx is None or ctx.archetype != "service"++def test_how_it_works_fires_on_cli_archetype_via_entry_point() -> None:spec = onboarding.get_spec(SLOT_HOW_IT_WORKS)assert spec is not Nonediff --git a/tests/unit/generation/test_tour.py b/tests/unit/generation/test_tour.pyindex 7110d6a06..bcb49d1be 100644--- a/tests/unit/generation/test_tour.py+++ b/tests/unit/generation/test_tour.py@@ -18,6 +18,7 @@ class _FI:path: stris_entry_point: bool = Falselanguage: str = "python"+ is_application_main: bool = False@dataclass@@ -42,6 +43,19 @@ def test_score_entry_points_rewards_entry_flag_and_filename():assert ranked[0] == "src/main.py" # entry flag + main filename + shallow+def test_score_entry_points_puts_a_declared_entry_above_every_guess():+ # Fineract: a sample's shallow, central ``Main.java`` scores every guess+ # (flag, stem, depth, PageRank) and still follows the Spring Boot main.+ main = "lib/Main.java"+ app = "provider/src/main/java/org/acme/ServerApplication.java"+ files = [+ _PF(_FI(path=main, is_entry_point=True, language="java")),+ _PF(_FI(path=app, is_entry_point=True, language="java", is_application_main=True)),+ ]+ scored = score_entry_points(files, {main: 0.9, app: 0.0})+ assert [p for _, p in scored] == [app, main]++def test_score_entry_points_excludes_zero_score():files = _repo({"deep/nested/pkg/thing.py": False})pr = {"deep/nested/pkg/thing.py": 0.0}diff --git a/tests/unit/ingestion/parser/golden/apex.json b/tests/unit/ingestion/parser/golden/apex.jsonindex 20454745a..998c37207 100644--- a/tests/unit/ingestion/parser/golden/apex.json+++ b/tests/unit/ingestion/parser/golden/apex.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -648,7 +649,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -763,7 +765,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1239,7 +1242,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1727,7 +1731,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -2521,7 +2526,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -2706,7 +2712,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -2911,7 +2918,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/cpp.json b/tests/unit/ingestion/parser/golden/cpp.jsonindex f62d6eb17..f1fb285d8 100644--- a/tests/unit/ingestion/parser/golden/cpp.json+++ b/tests/unit/ingestion/parser/golden/cpp.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -375,7 +376,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -708,7 +710,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/csharp.json b/tests/unit/ingestion/parser/golden/csharp.jsonindex 7e2f3bd2e..0cc32ea94 100644--- a/tests/unit/ingestion/parser/golden/csharp.json+++ b/tests/unit/ingestion/parser/golden/csharp.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -524,7 +525,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -910,7 +912,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1301,7 +1304,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/dart.json b/tests/unit/ingestion/parser/golden/dart.jsonindex 31a0710d2..4963f0c34 100644--- a/tests/unit/ingestion/parser/golden/dart.json+++ b/tests/unit/ingestion/parser/golden/dart.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -86,7 +87,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -347,7 +349,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -448,7 +451,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/go.json b/tests/unit/ingestion/parser/golden/go.jsonindex 509f8e8aa..55c42b629 100644--- a/tests/unit/ingestion/parser/golden/go.json+++ b/tests/unit/ingestion/parser/golden/go.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -110,7 +111,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -187,7 +189,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/java.json b/tests/unit/ingestion/parser/golden/java.jsonindex 524542d28..ccfe21197 100644--- a/tests/unit/ingestion/parser/golden/java.json+++ b/tests/unit/ingestion/parser/golden/java.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -131,7 +132,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -228,7 +230,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/javascript.json b/tests/unit/ingestion/parser/golden/javascript.jsonindex 105b46d27..a8af2450c 100644--- a/tests/unit/ingestion/parser/golden/javascript.json+++ b/tests/unit/ingestion/parser/golden/javascript.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -83,7 +84,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/kotlin.json b/tests/unit/ingestion/parser/golden/kotlin.jsonindex 6de44a7f2..20bff71e2 100644--- a/tests/unit/ingestion/parser/golden/kotlin.json+++ b/tests/unit/ingestion/parser/golden/kotlin.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -375,7 +376,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -751,7 +753,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/lean.json b/tests/unit/ingestion/parser/golden/lean.jsonindex 4bb63a9f0..29bd8d1a6 100644--- a/tests/unit/ingestion/parser/golden/lean.json+++ b/tests/unit/ingestion/parser/golden/lean.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [],"imports": [],@@ -36,7 +37,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [],"imports": [@@ -100,7 +102,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [],"imports": [],@@ -127,7 +130,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [],"imports": [],diff --git a/tests/unit/ingestion/parser/golden/pascal.json b/tests/unit/ingestion/parser/golden/pascal.jsonindex 7af536fd1..38b8a6e5f 100644--- a/tests/unit/ingestion/parser/golden/pascal.json+++ b/tests/unit/ingestion/parser/golden/pascal.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -62,7 +63,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/php.json b/tests/unit/ingestion/parser/golden/php.jsonindex dfdd2d932..08b7cc2a4 100644--- a/tests/unit/ingestion/parser/golden/php.json+++ b/tests/unit/ingestion/parser/golden/php.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -254,7 +255,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -765,7 +767,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -842,7 +845,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/python.json b/tests/unit/ingestion/parser/golden/python.jsonindex 0aeea9b37..f3bbcdd41 100644--- a/tests/unit/ingestion/parser/golden/python.json+++ b/tests/unit/ingestion/parser/golden/python.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -246,7 +247,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -570,7 +572,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -623,7 +626,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -724,7 +728,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -801,7 +806,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -878,7 +884,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1655,7 +1662,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/ruby.json b/tests/unit/ingestion/parser/golden/ruby.jsonindex 11c11ad35..435b2fc94 100644--- a/tests/unit/ingestion/parser/golden/ruby.json+++ b/tests/unit/ingestion/parser/golden/ruby.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -254,7 +255,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -585,7 +587,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -975,7 +978,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/rust.json b/tests/unit/ingestion/parser/golden/rust.jsonindex a1789467e..529e030e9 100644--- a/tests/unit/ingestion/parser/golden/rust.json+++ b/tests/unit/ingestion/parser/golden/rust.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -110,7 +111,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -207,7 +209,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -281,7 +284,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/scala.json b/tests/unit/ingestion/parser/golden/scala.jsonindex f3d06903b..ebfd1f256 100644--- a/tests/unit/ingestion/parser/golden/scala.json+++ b/tests/unit/ingestion/parser/golden/scala.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -248,7 +249,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -741,7 +743,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -932,7 +935,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/shell.json b/tests/unit/ingestion/parser/golden/shell.jsonindex 90650ed0e..2306a78b7 100644--- a/tests/unit/ingestion/parser/golden/shell.json+++ b/tests/unit/ingestion/parser/golden/shell.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -135,7 +136,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -269,7 +271,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -424,7 +427,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [],"imports": [],@@ -468,7 +472,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/swift.json b/tests/unit/ingestion/parser/golden/swift.jsonindex 76e54ebcc..9a49642b7 100644--- a/tests/unit/ingestion/parser/golden/swift.json+++ b/tests/unit/ingestion/parser/golden/swift.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -386,7 +387,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/parser/golden/typescript.json b/tests/unit/ingestion/parser/golden/typescript.jsonindex e3eb12cac..df97feb72 100644--- a/tests/unit/ingestion/parser/golden/typescript.json+++ b/tests/unit/ingestion/parser/golden/typescript.json@@ -9,7 +9,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -732,7 +733,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1030,7 +1032,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1131,7 +1134,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1208,7 +1212,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1432,7 +1437,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -1849,7 +1855,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{@@ -2036,7 +2043,8 @@"is_api_contract": false,"is_entry_point": false,"is_manifest_entry": false,- "is_reachability_root": false+ "is_reachability_root": false,+ "is_application_main": false},"symbols": [{diff --git a/tests/unit/ingestion/test_manifest_entry_points.py b/tests/unit/ingestion/test_manifest_entry_points.pyindex 74b72785f..3f3a2be7d 100644--- a/tests/unit/ingestion/test_manifest_entry_points.py+++ b/tests/unit/ingestion/test_manifest_entry_points.py@@ -320,3 +320,37 @@ def test_grafana_plugin_module_is_reachable_root(tmp_path: Path) -> None:assert idx.graph.nodes["plugins/test-ds/module.ts"].get("is_reachability_root")assert idx.graph.nodes["plugins/sandbox-panel/src/module.tsx"].get("is_reachability_root")++def test_spring_boot_main_is_a_declared_entry(tmp_path: Path) -> None:+ """A file that boots Spring leads the list whatever its name; a sample's+ ``Main.java`` and a test-scoped ``@SpringBootApplication`` do not."""+ repo = _write(+ tmp_path,+ {+ "provider/src/main/java/org/acme/ServerApplication.java": (+ "package org.acme;\n"+ "public class ServerApplication {\n"+ " public static void main(String[] args) {\n"+ " new SpringApplicationBuilder(ServerApplication.class).run(args);\n"+ " }\n}\n"+ ),+ "generator/misc/Main.java": (+ "package demo;\npublic class Main {\n"+ " public static void main(String[] args) {}\n}\n"+ ),+ "provider/src/test/java/org/acme/TestApp.java": (+ "package org.acme;\n@SpringBootApplication\npublic class TestApp {}\n"+ ),+ },+ )+ main = "provider/src/main/java/org/acme/ServerApplication.java"+ traverser = FileTraverser(repo)+ infos = {fi.path: fi for fi in traverser.traverse()}+ assert infos[main].is_application_main and infos[main].is_entry_point+ assert not infos[main].is_manifest_entry # not a public API the way a manifest's is+ assert not infos["provider/src/test/java/org/acme/TestApp.java"].is_application_main+ structure = traverser.get_repo_structure(list(infos.values()))+ assert structure.application_mains == [main]++ idx = _index(repo)+ assert idx.project["entry_points"][0] == main