sourcecode 2.5.11__tar.gz → 2.5.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. {sourcecode-2.5.11 → sourcecode-2.5.12}/CHANGELOG.md +49 -0
  2. {sourcecode-2.5.11 → sourcecode-2.5.12}/PKG-INFO +1 -1
  3. {sourcecode-2.5.11 → sourcecode-2.5.12}/pyproject.toml +1 -1
  4. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/__init__.py +1 -1
  5. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/architecture_analyzer.py +42 -0
  6. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/architecture_summary.py +75 -21
  7. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/classifier.py +1 -1
  8. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/confidence_analyzer.py +14 -0
  9. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/prepare_context.py +24 -0
  10. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/reconciliation.py +187 -37
  11. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_impact.py +35 -4
  12. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/summarizer.py +20 -4
  13. {sourcecode-2.5.11 → sourcecode-2.5.12}/.github/workflows/build-windows.yml +0 -0
  14. {sourcecode-2.5.11 → sourcecode-2.5.12}/.gitignore +0 -0
  15. {sourcecode-2.5.11 → sourcecode-2.5.12}/.ruff.toml +0 -0
  16. {sourcecode-2.5.11 → sourcecode-2.5.12}/CONTRIBUTING.md +0 -0
  17. {sourcecode-2.5.11 → sourcecode-2.5.12}/LICENSE +0 -0
  18. {sourcecode-2.5.11 → sourcecode-2.5.12}/README.md +0 -0
  19. {sourcecode-2.5.11 → sourcecode-2.5.12}/SECURITY.md +0 -0
  20. {sourcecode-2.5.11 → sourcecode-2.5.12}/raw +0 -0
  21. {sourcecode-2.5.11 → sourcecode-2.5.12}/scripts/compare_integration_engines.py +0 -0
  22. {sourcecode-2.5.11 → sourcecode-2.5.12}/scripts/customer_smoke_test.sh +0 -0
  23. {sourcecode-2.5.11 → sourcecode-2.5.12}/scripts/generate_jdk_exports.py +0 -0
  24. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/adaptive_scanner.py +0 -0
  25. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/archetype.py +0 -0
  26. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/ast_extractor.py +0 -0
  27. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/cache.py +0 -0
  28. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/call_surface.py +0 -0
  29. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/caller_metrics.py +0 -0
  30. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/canonical_ir.py +0 -0
  31. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/cir_graphs.py +0 -0
  32. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/cli.py +0 -0
  33. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/code_notes_analyzer.py +0 -0
  34. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/context_cache.py +0 -0
  35. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/context_graph.py +0 -0
  36. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/context_scorer.py +0 -0
  37. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/context_summarizer.py +0 -0
  38. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/contract_model.py +0 -0
  39. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/contract_pipeline.py +0 -0
  40. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/coverage_parser.py +0 -0
  41. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/dependency_analyzer.py +0 -0
  42. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/__init__.py +0 -0
  43. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/base.py +0 -0
  44. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/csproj_parser.py +0 -0
  45. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/dart.py +0 -0
  46. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/dotnet.py +0 -0
  47. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/elixir.py +0 -0
  48. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/go.py +0 -0
  49. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/heuristic.py +0 -0
  50. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/hybrid.py +0 -0
  51. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/java.py +0 -0
  52. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/jvm_ext.py +0 -0
  53. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/nodejs.py +0 -0
  54. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/parsers.py +0 -0
  55. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/php.py +0 -0
  56. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/project.py +0 -0
  57. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/python.py +0 -0
  58. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/ruby.py +0 -0
  59. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/rust.py +0 -0
  60. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/systems.py +0 -0
  61. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/terraform.py +0 -0
  62. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/detectors/tooling.py +0 -0
  63. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/doc_analyzer.py +0 -0
  64. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/dynamic_argument_surface.py +0 -0
  65. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/endpoint_literals.py +0 -0
  66. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/endpoint_metrics.py +0 -0
  67. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/entrypoint_classifier.py +0 -0
  68. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/env_analyzer.py +0 -0
  69. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/error_schema.py +0 -0
  70. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/evidence_provider.py +0 -0
  71. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/explain.py +0 -0
  72. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/file_chunker.py +0 -0
  73. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/file_classifier.py +0 -0
  74. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/format_contract.py +0 -0
  75. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/fqn_utils.py +0 -0
  76. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/git_analyzer.py +0 -0
  77. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/graph_analyzer.py +0 -0
  78. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/graph_evidence.py +0 -0
  79. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/hibernate_strat.py +0 -0
  80. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/jdk_exports.py +0 -0
  81. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/license.py +0 -0
  82. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/__init__.py +0 -0
  83. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/onboarding/__init__.py +0 -0
  84. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/onboarding/applier.py +0 -0
  85. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/onboarding/backup.py +0 -0
  86. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/onboarding/detector.py +0 -0
  87. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/onboarding/planner.py +0 -0
  88. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/orchestrator.py +0 -0
  89. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/registry.py +0 -0
  90. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/runner.py +0 -0
  91. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp/server.py +0 -0
  92. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/mcp_nudge.py +0 -0
  93. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/metrics_analyzer.py +0 -0
  94. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/migrate_check.py +0 -0
  95. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/openapi_surface.py +0 -0
  96. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/output_budget.py +0 -0
  97. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/path_filters.py +0 -0
  98. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/pr_comment_renderer.py +0 -0
  99. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/pr_impact.py +0 -0
  100. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/progress.py +0 -0
  101. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/ranking_engine.py +0 -0
  102. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/redactor.py +0 -0
  103. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/relevance_scorer.py +0 -0
  104. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/rename_refactor.py +0 -0
  105. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/repo_classifier.py +0 -0
  106. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/repository_ir.py +0 -0
  107. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/__init__.py +0 -0
  108. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/context.py +0 -0
  109. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/errors.py +0 -0
  110. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/executor.py +0 -0
  111. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/planner.py +0 -0
  112. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/query.py +0 -0
  113. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/request.py +0 -0
  114. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/resolution.py +0 -0
  115. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/result.py +0 -0
  116. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/retriever.py +0 -0
  117. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/runtime.py +0 -0
  118. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps.py +0 -0
  119. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_endpoint.py +0 -0
  120. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_graph.py +0 -0
  121. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_impact.py +0 -0
  122. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_intf.py +0 -0
  123. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_struct.py +0 -0
  124. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/retrieval/steps_txsec.py +0 -0
  125. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/ris.py +0 -0
  126. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/runtime_classifier.py +0 -0
  127. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/scanner.py +0 -0
  128. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/schema.py +0 -0
  129. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/security_config.py +0 -0
  130. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/security_posture.py +0 -0
  131. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/semantic_analyzer.py +0 -0
  132. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/semantic_impact_engine.py +0 -0
  133. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/semantic_integration_engine.py +0 -0
  134. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/semantic_services.py +0 -0
  135. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/serializer.py +0 -0
  136. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_event_topology.py +0 -0
  137. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_findings.py +0 -0
  138. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_model.py +0 -0
  139. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_security_audit.py +0 -0
  140. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_semantic.py +0 -0
  141. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/spring_tx_analyzer.py +0 -0
  142. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/__init__.py +0 -0
  143. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/config.py +0 -0
  144. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/consent.py +0 -0
  145. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/events.py +0 -0
  146. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/filters.py +0 -0
  147. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/telemetry/transport.py +0 -0
  148. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/tree_utils.py +0 -0
  149. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/type_usage_surface.py +0 -0
  150. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/validation_inference.py +0 -0
  151. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/validation_surface.py +0 -0
  152. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/version_check.py +0 -0
  153. {sourcecode-2.5.11 → sourcecode-2.5.12}/src/sourcecode/workspace.py +0 -0
  154. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/functions/README.md +0 -0
  155. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/functions/get-license/index.ts +0 -0
  156. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/functions/lemonsqueezy-webhook/index.ts +0 -0
  157. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/functions/telemetry/index.ts +0 -0
  158. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/sql/license_event_ordering.sql +0 -0
  159. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/sql/licensing_schema.sql +0 -0
  160. {sourcecode-2.5.11 → sourcecode-2.5.12}/supabase/sql/telemetry_events.sql +0 -0
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.12] — 2026-07-18
4
+
5
+ **F-1 (the Evidence Reconciliation Layer) is closed and its rule core frozen.** This release
6
+ lands the reconciliation gap-fixes accumulated since 2.5.11 and completes INV-F1-4 across
7
+ every surface that narrates an architectural result — the layer's last open honesty debt.
8
+ No new rule, no widened heuristic; the frozen core (`reconciliation.py`) was not touched.
9
+
10
+ ### Fixed
11
+
12
+ - **INV-F1-4 closed across the narrating surfaces** (`architecture_analyzer.py`,
13
+ `prepare_context.py`): `036eaa9` made the producer record every architecture refutation on
14
+ `arch.limitations`, but only the serializer surface transported them — `prepare-context`/
15
+ onboard computed the analysis and threw the refutations away, so ofbiz's pruned modules and
16
+ a refuted layered claim vanished silently there. onboard now runs the analysis once (a
17
+ single owned `sm.architecture`) and carries the refutation lines into `limitations`, the
18
+ same sink the serializer uses. A reader can distinguish *"no architecture"* from *"claim
19
+ refuted"* on every narrating surface. One ownership model governs which surface shows,
20
+ degrades, or only transports a refutation (ADR-0005 §6.5).
21
+
22
+ - **Directory contamination that manufactured phantom refutations** (`architecture_analyzer.py`):
23
+ `flatten_file_tree` emits directory nodes, so `sm.file_paths` carried entries like
24
+ `src/main` that `_detect_layers` counted as jvm-less module members — a directory holding
25
+ all the Java transitively read as "no jvm code" and was refuted (petclinic phantom
26
+ `orchestration`; the directory half of `data`). The layer census now drops ancestor
27
+ (directory) paths; leaf files, including template view-layers, are untouched. Side effect:
28
+ pattern detection on the previously-polluted input is corrected (petclinic → `mvc`).
29
+
30
+ - **The web-pattern cross-check is now an F-1 rule (gap #4)** (`reconciliation.py`,
31
+ `architecture_summary.py`): `_qualify_web_pattern` was an ad-hoc `if`; it is now the seventh
32
+ rule, `web_pattern_endpoint_attestation`. The migration fixed a latent lie — the gate
33
+ degraded at `high < 5`, so a repo with 1–4 real controllers reported *"no HTTP controllers
34
+ detected"*. The honest predicate is `high == 0` (provable absence), and the authority is
35
+ Java-file coverage (`stack == "java"`), not the JVM family.
36
+
37
+ - **A reconciliation rule that raises can no longer read as "no contradiction" (gap #2)**
38
+ (`reconciliation.py` and all six consumers): each entry point wraps rules per-rule; an
39
+ exception yields an execution-error finding routed to a surfaced channel, never silence.
40
+
41
+ - **JVM checks gate on the runtime family, reconciled to one source (gap #3)**
42
+ (`reconciliation.py`, `classifier.py`): `stack_runtime_family` is the single owner; the two
43
+ incomplete `{java,kotlin}` copies are gone. The mvc/rest-api authority gate is separately
44
+ corrected to Java-file coverage, fixing a Kotlin/Scala/Groovy false-negation (INV-F1-1).
45
+
46
+ ### Documentation
47
+
48
+ - **ADR-0005 marked Accepted & FROZEN.** Seven rules, six invariants closed, ownership model
49
+ ratified (§6.5), freeze & re-open conditions recorded (§10). Stale "six rules" / "INV-F1-4
50
+ violated" text removed. Closure report and surface-integration map in `.planning/`.
51
+
3
52
  ## [2.5.11] — 2026-07-17
4
53
 
5
54
  **Two ways a tool can lie by omission: analyze the wrong repository without
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 2.5.11
3
+ Version: 2.5.12
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sourcecode"
7
- version = "2.5.11"
7
+ version = "2.5.12"
8
8
  description = "Persistent structural context and ultra-fast repeated analysis for AI coding agents"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -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.11"
7
+ __version__ = "2.5.12"
@@ -286,6 +286,11 @@ class ArchitectureAnalyzer:
286
286
  # architecture claim". `_detect_layers` and its helpers append the
287
287
  # findings' sink-neutral detail here; drained into `limitations` below.
288
288
  self._refutations: list[str] = []
289
+ # Gap #2 (fail-open): a reconciliation rule that could not be evaluated
290
+ # is NOT a clean result — surfaced here as its own limitation, never as a
291
+ # refutation and never silently, so an unverified pattern cannot ship as
292
+ # confirmed.
293
+ self._reconciliation_errors: list[str] = []
289
294
 
290
295
  # Step 1: filter paths
291
296
  filtered = self._filter_paths(sm.file_paths)
@@ -498,6 +503,14 @@ class ArchitectureAnalyzer:
498
503
  continue
499
504
  _seen.add(_detail)
500
505
  limitations.append(f"Architecture claim refuted on evidence: {_detail}")
506
+ # Fail-open sink: a rule that could not run is surfaced distinctly — the
507
+ # pattern it would have checked is reported UNVERIFIED, never certified.
508
+ _seen_err: set[str] = set()
509
+ for _detail in self._reconciliation_errors:
510
+ if _detail in _seen_err:
511
+ continue
512
+ _seen_err.add(_detail)
513
+ limitations.append(f"Architecture reconciliation could not run: {_detail}")
501
514
 
502
515
  return ArchitectureAnalysis(
503
516
  requested=True,
@@ -644,6 +657,24 @@ class ArchitectureAnalyzer:
644
657
  return domains
645
658
 
646
659
  def _detect_layers(self, paths: list[str]) -> tuple[str, list[ArchitectureLayer]]:
660
+ # Drop directory ENTRIES. `flatten_file_tree` emits every node — files AND
661
+ # the directories above them — so `sm.file_paths` carries `src`, `src/main`,
662
+ # `src/main/java/.../model` … A directory is not a file: counting it as a
663
+ # layer/module member makes it read as jvm-less in `runtime_census` (it holds
664
+ # no file OF ITS OWN, only children), and a directory that transitively holds
665
+ # all the Java is then refuted as "no jvm code" — the demonstrated
666
+ # contamination (petclinic phantom `orchestration` = `src/main`; the
667
+ # directory half of `data` = `.../model`). A path that is an ancestor of
668
+ # another path in the set is such an entry; leaf files (incl. template
669
+ # view-layers) are never ancestors and are kept untouched.
670
+ _norm = [p.replace("\\", "/") for p in paths]
671
+ _ancestors: set[str] = set()
672
+ for _p in _norm:
673
+ _segs = _p.split("/")
674
+ for _k in range(1, len(_segs)):
675
+ _ancestors.add("/".join(_segs[:_k]))
676
+ paths = [p for p, n in zip(paths, _norm) if n not in _ancestors]
677
+
647
678
  # Exclude non-source paths (tests, benchmarks, docs, tooling, vendored assets)
648
679
  # from layer scoring. Also exclude anything under a `resources/` segment: in
649
680
  # Maven/Gradle layouts `src/main/resources/**` is bundled config/assets — e.g.
@@ -721,6 +752,11 @@ class ArchitectureAnalyzer:
721
752
  for _f in reconcile_architecture_evidence(
722
753
  pattern=pattern_name, layer_files=_layer_paths, repo_files=source_paths
723
754
  ):
755
+ if _f.error:
756
+ # A rule that could not run is surfaced always (not tied to
757
+ # whether this candidate wins) and never as a refutation.
758
+ self._reconciliation_errors.append(_f.detail)
759
+ continue
724
760
  _refs.append(_f.detail)
725
761
  if _f.rule == "composition_runtime_split":
726
762
  # A claim that IS a runtime split must show one: JobRunr, a JVM
@@ -922,6 +958,9 @@ class ArchitectureAnalyzer:
922
958
  # pruning here directly shapes the returned result (fewer layers, or a
923
959
  # drop below 2 that falls through to flat/unknown) — surface it.
924
960
  for _f in reconcile_code_modules(layer_files=non_empty, repo_files=paths):
961
+ if _f.error:
962
+ self._reconciliation_errors.append(_f.detail)
963
+ continue
925
964
  for _bad in _f.symbols:
926
965
  non_empty.pop(_bad, None)
927
966
  self._refutations.append(_f.detail)
@@ -957,6 +996,9 @@ class ArchitectureAnalyzer:
957
996
  # eureka "images" (five PNGs). The real modules survive untouched.
958
997
  # INV-F1-4: same as the layered path — surface each refuted module.
959
998
  for _f in reconcile_code_modules(layer_files=meaningful, repo_files=paths):
999
+ if _f.error:
1000
+ self._reconciliation_errors.append(_f.detail)
1001
+ continue
960
1002
  for _bad in _f.symbols:
961
1003
  meaningful.pop(_bad, None)
962
1004
  self._refutations.append(_f.detail)
@@ -210,23 +210,38 @@ class ArchitectureSummarizer:
210
210
  # welds a foreign runtime's framework onto the primary's label. Drop what
211
211
  # the claimed stack does not attest, and never let the TYPE label — which
212
212
  # those same frameworks drove — survive its own evidence (P2-F).
213
- from sourcecode.reconciliation import type_claim_unattested, unattested_frameworks
213
+ from sourcecode.reconciliation import (
214
+ has_execution_error,
215
+ reconcile_headline_evidence,
216
+ type_claim_unattested,
217
+ )
214
218
 
215
- foreign = unattested_frameworks(primary.stack, sm.project_type, sm.stacks)
216
- attested = [name for name in fw_names if name not in foreign]
217
- dropped = [name for name in fw_names if name in foreign]
218
- if dropped and not attested and type_claim_unattested(
219
+ _headline_findings = reconcile_headline_evidence(
219
220
  claimed_stack=primary.stack, project_type=sm.project_type, stacks=sm.stacks
220
- ):
221
- return self._describe_foreign_evidence(sm, stack_label, runtime, dropped)
222
- fw_names = attested
221
+ )
222
+ if has_execution_error(_headline_findings):
223
+ # Fail-open guard (gap #2): the attestation rule could not run, and
224
+ # this prose surface has no gap channel to warn on. Rather than assert
225
+ # an unverified weld ("C#/.NET … using JAX-RS"), withhold the framework
226
+ # clause — the claim is not made when its check did not execute.
227
+ fw_names = []
228
+ else:
229
+ foreign = frozenset(s for f in _headline_findings for s in f.symbols)
230
+ attested = [name for name in fw_names if name not in foreign]
231
+ dropped = [name for name in fw_names if name in foreign]
232
+ if dropped and not attested and type_claim_unattested(
233
+ claimed_stack=primary.stack, project_type=sm.project_type, stacks=sm.stacks
234
+ ):
235
+ return self._describe_foreign_evidence(sm, stack_label, runtime, dropped)
236
+ fw_names = attested
223
237
 
224
238
  fw_str = f" using {', '.join(fw_names)}" if fw_names else ""
225
239
  if runtime:
226
240
  # BUG #4: never assert "rest api" in the headline unless the endpoints
227
- # command actually backs it (Java/Kotlin only — that is where we have an
228
- # authoritative extractor). Degrade to a qualified, consistent phrasing.
229
- if sm.project_type == "api" and primary.stack in {"java", "kotlin"}:
241
+ # command actually backs it. Authority is Java ONLY: extract_java_endpoints
242
+ # reads *.java and is blind to .kt — a Kotlin REST API would otherwise
243
+ # degrade to "only 0 endpoints detected" over routes it cannot see.
244
+ if sm.project_type == "api" and primary.stack == "java":
230
245
  total, high = self._endpoint_support()
231
246
  if high < _MIN_REST_ENDPOINTS_FOR_LABEL:
232
247
  plural = "s" if total != 1 else ""
@@ -310,23 +325,62 @@ class ArchitectureSummarizer:
310
325
 
311
326
  def _qualify_web_pattern(self, arch: Any, arch_line: str, sm: SourceMap) -> str:
312
327
  """BUG #1 (Jenkins field test): the "mvc" pattern is a directory-name
313
- heuristic (dirs matching controller/model/view keywords). On a Java/Kotlin
314
- repo, do not assert "MVC pattern with ... view layers" in prose when the
328
+ heuristic (dirs matching controller/model/view keywords). On a JVM repo,
329
+ do not assert "MVC pattern with ... view layers" in prose when the
315
330
  canonical endpoint extractor finds no HTTP controllers in the same run —
316
331
  Jenkins (Stapler web framework) matches model/view-ish dirs but declares
317
- zero Spring MVC controllers. Cross-check against `endpoints` and degrade to
318
- a consistent, non-committal phrasing instead of a categorical MVC claim."""
332
+ zero Spring MVC controllers.
333
+
334
+ This is a reconciliation rule (layer table × endpoint index), so the
335
+ judgement lives in F-1 (`reconcile_web_pattern_evidence`), not as an
336
+ ad-hoc `if` here (ADR-0005 §6.2/§8.4). The honest predicate is ZERO
337
+ modeled controllers, not `< 5`: with the old threshold, 1–4 real
338
+ controllers still degraded to the categorical "no HTTP controllers
339
+ detected" — a false statement. One controller backs the MVC claim; only
340
+ an empty index contradicts it.
341
+
342
+ **Authority = Java only.** The extractor (`extract_java_endpoints`) reads
343
+ `*.java`; it is blind to `.kt`/`.scala`/`.groovy`. So zero controllers is
344
+ a contradiction ONLY for a Java-primary repo. On Kotlin/Scala/Groovy an
345
+ empty index is the extractor's blindness, not absence of controllers —
346
+ degrading there asserted "no HTTP controllers detected" over real `.kt`
347
+ routes (INV-F1-1: never fire on absence of evidence). Gating the rule on
348
+ the JVM *family* was wrong; the boundary is the extractor's file coverage."""
349
+ from sourcecode.reconciliation import (
350
+ has_execution_error,
351
+ reconcile_web_pattern_evidence,
352
+ )
353
+
319
354
  if not arch_line or arch.pattern not in ("mvc", "spring_mvc_layered"):
320
355
  return arch_line
321
356
  primary = next((s for s in sm.stacks if s.primary), sm.stacks[0] if sm.stacks else None)
322
- if primary is None or primary.stack not in {"java", "kotlin"}:
323
- return arch_line
324
357
  _total, high = self._endpoint_support()
325
- if high >= _MIN_REST_ENDPOINTS_FOR_LABEL:
326
- return arch_line
327
- # No controller backing → the MVC/view claim is unverified. Report the
328
- # directory-derived layers without the framework label or the "view" claim.
358
+ # The endpoint extractor reads .java only — it is authoritative for a
359
+ # Java-primary repo, blind elsewhere.
360
+ _authoritative = bool(primary) and primary.stack == "java"
361
+ _findings = reconcile_web_pattern_evidence(
362
+ pattern=arch.pattern,
363
+ endpoint_evidence_authoritative=_authoritative,
364
+ modeled_endpoint_count=high,
365
+ )
329
366
  layer_names = [l.name for l in arch.layers[:4] if l.name != "view"] if arch.layers else []
367
+ if has_execution_error(_findings):
368
+ # Fail-open guard (gap #2): the cross-check could not run. Withhold the
369
+ # categorical MVC label AND the "no controllers" claim (both unverified);
370
+ # report only the directory-derived layers, or nothing.
371
+ if layer_names:
372
+ return (
373
+ f"Layered code organization ({', '.join(layer_names)}; "
374
+ "directory-based — endpoint cross-check unavailable)."
375
+ )
376
+ return ""
377
+ if not _findings:
378
+ # Non-Java (extractor blind), not a web pattern, or ≥1 controller backs
379
+ # the claim → keep. On Kotlin/Scala/Groovy the MVC label stays
380
+ # unverified rather than falsely negated.
381
+ return arch_line
382
+ # Contradiction: zero modeled controllers. Degrade — the claim is
383
+ # directory names, not routes; the "no HTTP controllers" wording is TRUE.
330
384
  if layer_names:
331
385
  return (
332
386
  f"Layered code organization ({', '.join(layer_names)}; "
@@ -207,7 +207,7 @@ class TypeClassifier:
207
207
  # structured codebase (e.g. JobRunr: core + per-framework adapter modules).
208
208
  # This is checked BEFORE the weak `bin/`-directory CLI heuristic so a build
209
209
  # output / wrapper `bin/` dir does not mislabel a library as a CLI.
210
- if stack_names & {"java", "kotlin", "scala"} and self._is_multi_module(file_tree):
210
+ if stack_names & _JVM_STACKS and self._is_multi_module(file_tree):
211
211
  return "library"
212
212
 
213
213
  # Weak CLI heuristic: a top-level bin/ directory (only when nothing stronger).
@@ -120,6 +120,20 @@ class ConfidenceAnalyzer:
120
120
  project_type=sm.project_type,
121
121
  stacks=sm.stacks,
122
122
  ):
123
+ if _rf.error:
124
+ # Fail-open guard (gap #2): the stack-attestation rule could
125
+ # not run. Never let that read as "primary attests every
126
+ # framework" — record it as an anomaly + gap, not silence.
127
+ anomalies.append(
128
+ "Stack/framework attestation could not be evaluated — "
129
+ "primary-stack attribution is UNVERIFIED"
130
+ )
131
+ gaps.append(AnalysisGap(
132
+ area="framework_stack_attestation",
133
+ reason=_rf.detail,
134
+ impact="medium",
135
+ ))
136
+ continue
123
137
  anomalies.append(
124
138
  f"{', '.join(_rf.symbols)} declared by another runtime, not by the "
125
139
  f"{_primary.stack} primary stack"
@@ -1249,6 +1249,17 @@ class TaskContextBuilder:
1249
1249
  [ws.path for ws in workspace_analysis.workspaces],
1250
1250
  )
1251
1251
 
1252
+ # F-1 single-ownership (ADR-0005 §INV-F1-4): run the architecture analysis
1253
+ # ONCE, here, and keep it on sm.architecture — the single owned analysis.
1254
+ # ArchitectureSummarizer/ContextSummarizer reuse it instead of each computing
1255
+ # (and discarding) a private copy, and its refutations are transported into
1256
+ # `limitations` below (surface #3, F1-SURFACE-INTEGRATION-2026-07-18).
1257
+ from sourcecode.architecture_analyzer import ArchitectureAnalyzer as _ArchAnalyzer
1258
+ try:
1259
+ sm.architecture = _ArchAnalyzer().analyze(self.root, sm)
1260
+ except Exception:
1261
+ sm.architecture = None
1262
+
1252
1263
  project_summary = ProjectSummarizer(self.root).generate(sm)
1253
1264
  architecture_summary = ArchitectureSummarizer(self.root).generate(sm)
1254
1265
 
@@ -1306,6 +1317,19 @@ class TaskContextBuilder:
1306
1317
  key_dependencies: list[dict[str, Any]] = []
1307
1318
  limitations: list[str] = []
1308
1319
 
1320
+ # INV-F1-4 transport: this surface narrates the architecture, so it must
1321
+ # carry the owner's refutations — the same lines surface #1 (serializer)
1322
+ # emits. Only the F-1 refutation / execution-error lines (their fixed
1323
+ # prefixes); pattern-inference notes stay out of the onboard surface. The
1324
+ # analysis is the single owned one (sm.architecture) — no re-run, no re-judge.
1325
+ if sm.architecture is not None:
1326
+ for _arch_lim in (sm.architecture.limitations or []):
1327
+ if _arch_lim.startswith((
1328
+ "Architecture claim refuted on evidence:",
1329
+ "Architecture reconciliation could not run:",
1330
+ )):
1331
+ limitations.append(_arch_lim)
1332
+
1309
1333
  if spec.enable_dependencies:
1310
1334
  from dataclasses import asdict
1311
1335
  from sourcecode.dependency_analyzer import DependencyAnalyzer
@@ -62,17 +62,75 @@ from pathlib import Path
62
62
 
63
63
  @dataclass(frozen=True)
64
64
  class ReconciliationFinding:
65
- """One positively-detected contradiction between two evidence views."""
65
+ """One reconciliation outcome that a consumer must not narrate away.
66
+
67
+ Two kinds ride this one type, distinguished by `error`:
68
+
69
+ - a **detected contradiction** (`error=False`, `symbols` non-empty): two
70
+ views positively disagree; the consumer degrades the claim and names it.
71
+ - an **execution error** (`error=True`, `symbols` empty): a rule could not be
72
+ evaluated. It exists so that a rule that raises is NEVER indistinguishable
73
+ from a rule that ran and found nothing — the fail-open that let an
74
+ exception silently certify the very claim the rule was meant to check.
75
+
76
+ A rule that is *not applicable*, or that ran and found the views consistent,
77
+ yields NO finding: both legitimately mean "no contradiction, the claim may
78
+ stand", and no consumer acts differently on them. Only the error case needed
79
+ a physical state of its own (ADR-0005 §8.2).
80
+ """
66
81
  rule: str # stable rule id, e.g. "endpoint_coverage"
67
82
  symbols: tuple[str, ...] # symbols the contradiction is anchored to
68
83
  detail: str # one-sentence human/agent-readable statement
84
+ error: bool = False # True iff this marks a rule that could not run
69
85
 
70
86
  def to_dict(self) -> dict:
71
- return {
87
+ d = {
72
88
  "rule": self.rule,
73
89
  "symbols": list(self.symbols),
74
90
  "detail": self.detail,
75
91
  }
92
+ # Healthy findings serialize byte-identically to before; the flag appears
93
+ # only when set, so no existing consumer/snapshot shifts.
94
+ if self.error:
95
+ d["error"] = True
96
+ return d
97
+
98
+
99
+ def _execution_error(rule_id: str, exc: Exception) -> ReconciliationFinding:
100
+ """Build the finding that marks a rule which raised instead of running."""
101
+ return ReconciliationFinding(
102
+ rule=rule_id,
103
+ symbols=(),
104
+ error=True,
105
+ detail=(
106
+ f"the {rule_id} reconciliation rule could not be evaluated "
107
+ f"({type(exc).__name__}) — its consistency check did NOT run, so the "
108
+ "claim it guards is UNVERIFIED, not confirmed."
109
+ ),
110
+ )
111
+
112
+
113
+ def _run_rule(rule_id: str, thunk) -> list[ReconciliationFinding]:
114
+ """Run one rule in isolation. On any exception, return an execution-error
115
+ finding instead of swallowing it — the core of the fail-open fix. Per-rule
116
+ (not per-surface) so one rule raising never blanks a sibling rule's finding.
117
+ """
118
+ try:
119
+ return list(thunk())
120
+ except Exception as exc: # noqa: BLE001 — deliberate: convert, never swallow
121
+ return [_execution_error(rule_id, exc)]
122
+
123
+
124
+ def execution_errors(
125
+ findings: "list[ReconciliationFinding]",
126
+ ) -> list[ReconciliationFinding]:
127
+ """The execution-error findings in a batch (empty if every rule ran)."""
128
+ return [f for f in findings if getattr(f, "error", False)]
129
+
130
+
131
+ def has_execution_error(findings: "list[ReconciliationFinding]") -> bool:
132
+ """True iff any rule in the batch could not be evaluated."""
133
+ return any(getattr(f, "error", False) for f in findings)
76
134
 
77
135
 
78
136
  def http_handler_classes(cir) -> frozenset[str]:
@@ -142,14 +200,12 @@ def reconcile_impact_evidence(
142
200
  modeled_classes: classes the endpoint index has ≥1 route for
143
201
  (endpoint_index.controller_fqns).
144
202
  """
145
- findings: list[ReconciliationFinding] = []
146
- try:
147
- findings.extend(
148
- _rule_endpoint_coverage(chain_classes, handler_classes, modeled_classes)
149
- )
150
- except Exception:
151
- pass
152
- return findings
203
+ return _run_rule(
204
+ "endpoint_coverage",
205
+ lambda: _rule_endpoint_coverage(
206
+ chain_classes, handler_classes, modeled_classes
207
+ ),
208
+ )
153
209
 
154
210
 
155
211
  # ---------------------------------------------------------------------------
@@ -387,11 +443,11 @@ def reconcile_code_modules(
387
443
  layer_files: {claimed module -> its files}.
388
444
  repo_files: every source file, supplying the repo's own runtime.
389
445
  """
390
- try:
446
+ def _run() -> list[ReconciliationFinding]:
391
447
  repo_runtimes = runtime_census({"_repo": list(repo_files)})["_repo"]
392
448
  return _rule_layer_code_attestation(runtime_census(layer_files), repo_runtimes)
393
- except Exception:
394
- return []
449
+
450
+ return _run_rule("layer_code_attestation", _run)
395
451
 
396
452
 
397
453
  def unattested_layers(
@@ -422,16 +478,22 @@ def reconcile_architecture_evidence(
422
478
  repo_files: every source file considered — supplies the repo's own
423
479
  runtime, the arbiter of which layers belong to the claim.
424
480
  """
425
- findings: list[ReconciliationFinding] = []
426
481
  try:
427
482
  census = runtime_census(layer_files)
428
483
  repo_runtimes = runtime_census({"_repo": list(repo_files)})["_repo"]
429
- findings.extend(
430
- _rule_layer_language_coherence(pattern, census, repo_runtimes)
431
- )
432
- findings.extend(_rule_composition_runtime_split(pattern, census))
433
- except Exception:
434
- pass
484
+ except Exception as exc:
485
+ # Shared view prep failed — neither rule could run. One error finding,
486
+ # attributed to the primary architecture rule, carries that to the sink.
487
+ return [_execution_error("layer_language_coherence", exc)]
488
+ findings: list[ReconciliationFinding] = []
489
+ findings += _run_rule(
490
+ "layer_language_coherence",
491
+ lambda: _rule_layer_language_coherence(pattern, census, repo_runtimes),
492
+ )
493
+ findings += _run_rule(
494
+ "composition_runtime_split",
495
+ lambda: _rule_composition_runtime_split(pattern, census),
496
+ )
435
497
  return findings
436
498
 
437
499
 
@@ -487,6 +549,19 @@ _STACK_FAMILY: dict[str, str] = {
487
549
  "elixir": "beam", "erlang": "beam",
488
550
  }
489
551
 
552
+
553
+ def stack_runtime_family(stack_id: str) -> str | None:
554
+ """Runtime family of a stack id (``jvm``/``js``/``python``/…), or None.
555
+
556
+ The single source of truth for "which stacks share a runtime". A consumer
557
+ that gates on JVM-ness (a Kotlin, Scala or Groovy repo is the SAME runtime as
558
+ a Java one) reads this instead of hardcoding ``{"java", "kotlin"}`` — which
559
+ silently dropped Scala and Groovy and let an unverified claim ship on them.
560
+ None means "unjudgeable", never a contradiction (INV-F1-1).
561
+ """
562
+ return _STACK_FAMILY.get(stack_id or "")
563
+
564
+
490
565
  # Project types that are SUPPOSED to span runtimes — their headline names a tier
491
566
  # split, so a framework from another runtime is the point, not a contradiction.
492
567
  # Same carve-out (and same names) as `_CROSS_RUNTIME_PATTERNS` for layer claims.
@@ -594,17 +669,13 @@ def reconcile_headline_evidence(
594
669
  """
595
670
  if project_type in _CROSS_RUNTIME_TYPES:
596
671
  return []
597
- findings: list[ReconciliationFinding] = []
598
- try:
599
- findings.extend(
600
- _rule_framework_stack_attestation(
601
- _STACK_FAMILY.get(claimed_stack or ""),
602
- framework_owner_families(stacks),
603
- )
604
- )
605
- except Exception:
606
- pass
607
- return findings
672
+ return _run_rule(
673
+ "framework_stack_attestation",
674
+ lambda: _rule_framework_stack_attestation(
675
+ _STACK_FAMILY.get(claimed_stack or ""),
676
+ framework_owner_families(stacks),
677
+ ),
678
+ )
608
679
 
609
680
 
610
681
  def type_claim_unattested(
@@ -631,6 +702,12 @@ def type_claim_unattested(
631
702
  return False
632
703
  return not any(family in fams for fams in owners.values())
633
704
  except Exception:
705
+ # A bool predicate cannot carry an execution-error finding. It never
706
+ # decides alone: every caller runs `reconcile_headline_evidence` on the
707
+ # SAME stacks first (same `framework_owner_families` call), so an
708
+ # exception here has already surfaced as an execution-error finding
709
+ # there. Returning False adds NO extra clause — it does not certify a
710
+ # claim the paired findings call left unguarded.
634
711
  return False
635
712
 
636
713
 
@@ -646,6 +723,81 @@ def unattested_frameworks(
646
723
  return frozenset(out)
647
724
 
648
725
 
726
+ # ---------------------------------------------------------------------------
727
+ # Narrative reconciliation (web-pattern claim × endpoint index)
728
+ # ---------------------------------------------------------------------------
729
+
730
+ # Patterns that assert an HTTP/view tier. The claim is directory-derived (dirs
731
+ # named controller/model/view); the endpoint index is the authoritative
732
+ # controller evidence for the SAME run. They contradict when the pattern names a
733
+ # web tier but the index modeled NO controller at all — Jenkins (Stapler)
734
+ # matched model/view dirs and declared zero Spring MVC controllers.
735
+ _WEB_PATTERNS: frozenset[str] = frozenset({"mvc", "spring_mvc_layered"})
736
+
737
+
738
+ def _rule_web_pattern_attestation(
739
+ pattern: str, endpoint_evidence_authoritative: bool, modeled_endpoint_count: int
740
+ ) -> list[ReconciliationFinding]:
741
+ """A web/MVC pattern claim that the endpoint index does not back at all.
742
+
743
+ Provable ABSENCE, not a threshold: the rule fires only at ZERO modeled
744
+ controllers (`== 0`), never at "few". One controller backs the claim — the
745
+ pattern has real HTTP evidence and is not contradicted. The "< N is not
746
+ really a web app" judgement is a LABEL heuristic and stays in the consumer
747
+ (ADR-0005 limit 2: a rule may not carry a threshold).
748
+
749
+ **Authority gate (INV-F1-1).** Zero controllers is a CONTRADICTION only where
750
+ the endpoint extractor can actually see the code. The canonical extractor
751
+ reads `*.java` only — so on a Kotlin/Scala/Groovy repo an empty index is
752
+ *absence of evidence* (the extractor is blind to `.kt`/`.scala`/`.groovy`),
753
+ NOT a contradiction, and firing there is a false negative (measured: a Kotlin
754
+ `@RestController` with real routes read "no HTTP controllers detected"). The
755
+ caller passes `endpoint_evidence_authoritative`; when false, the rule stays
756
+ silent. The consumer decides authority (it owns the extractor fact), keeping
757
+ this rule free of any language/extractor coupling.
758
+ """
759
+ if pattern not in _WEB_PATTERNS or not endpoint_evidence_authoritative:
760
+ return []
761
+ if modeled_endpoint_count > 0:
762
+ return []
763
+ return [
764
+ ReconciliationFinding(
765
+ rule="web_pattern_endpoint_attestation",
766
+ symbols=(pattern,),
767
+ detail=(
768
+ f"the '{pattern}' claim names an HTTP/view tier but the endpoint "
769
+ "index modeled no controller — the layers are directory names, "
770
+ "not routes."
771
+ ),
772
+ )
773
+ ]
774
+
775
+
776
+ def reconcile_web_pattern_evidence(
777
+ *,
778
+ pattern: str,
779
+ endpoint_evidence_authoritative: bool,
780
+ modeled_endpoint_count: int,
781
+ ) -> list[ReconciliationFinding]:
782
+ """Run the web-pattern attestation rule. Never raises.
783
+
784
+ Args:
785
+ pattern: the claimed architecture pattern.
786
+ endpoint_evidence_authoritative: True iff the endpoint extractor can see
787
+ this repo's controllers (it reads .java
788
+ only — the consumer owns this fact). When
789
+ False, zero endpoints is absence, not a
790
+ contradiction (INV-F1-1), and no finding.
791
+ modeled_endpoint_count: high-confidence controllers modeled.
792
+ """
793
+ return _run_rule(
794
+ "web_pattern_endpoint_attestation",
795
+ lambda: _rule_web_pattern_attestation(
796
+ pattern, endpoint_evidence_authoritative, modeled_endpoint_count
797
+ ),
798
+ )
799
+
800
+
649
801
  def reconcile_extraction_evidence(
650
802
  *,
651
803
  type_decl_files: frozenset[str],
@@ -657,9 +809,7 @@ def reconcile_extraction_evidence(
657
809
  type_decl_files: files whose masked source declares a Java type.
658
810
  extracted_files: files symbol extraction produced ≥1 symbol for.
659
811
  """
660
- findings: list[ReconciliationFinding] = []
661
- try:
662
- findings.extend(_rule_parse_coverage(type_decl_files, extracted_files))
663
- except Exception:
664
- pass
665
- return findings
812
+ return _run_rule(
813
+ "parse_coverage",
814
+ lambda: _rule_parse_coverage(type_decl_files, extracted_files),
815
+ )