devtime-ei 0.6.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/PKG-INFO +15 -4
  2. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/README.md +13 -2
  3. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/pyproject.toml +2 -2
  4. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/__init__.py +1 -1
  5. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/cli.py +46 -0
  6. devtime_ei-0.7.0/src/devtime/intelligence/review.py +179 -0
  7. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/verification.py +36 -4
  8. devtime_ei-0.7.0/src/devtime/output/review.py +154 -0
  9. devtime_ei-0.7.0/src/devtime/review_flow.py +171 -0
  10. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/base.py +64 -0
  11. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/python.py +9 -1
  12. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/typescript.py +7 -1
  13. devtime_ei-0.7.0/src/devtime/snapshots.py +226 -0
  14. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/PKG-INFO +15 -4
  15. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/SOURCES.txt +4 -0
  16. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/LICENSE +0 -0
  17. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/setup.cfg +0 -0
  18. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/ai/__init__.py +0 -0
  19. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/ai/local.py +0 -0
  20. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/ai/prompts.py +0 -0
  21. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/ai/providers.py +0 -0
  22. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/assets/devtimeignore.starter +0 -0
  23. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/config.py +0 -0
  24. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/db/__init__.py +0 -0
  25. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/db/connection.py +0 -0
  26. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/db/migrations.py +0 -0
  27. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/db/repository.py +0 -0
  28. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/db/schema.sql +0 -0
  29. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/demo.py +0 -0
  30. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/fixtures/__init__.py +0 -0
  31. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/fixtures/assertions.py +0 -0
  32. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/fixtures/loader.py +0 -0
  33. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/fixtures/runner.py +0 -0
  34. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/__init__.py +0 -0
  35. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/claims.py +0 -0
  36. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/concepts.py +0 -0
  37. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/context_pack.py +0 -0
  38. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/evidence.py +0 -0
  39. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/lineage.py +0 -0
  40. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/risk.py +0 -0
  41. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/intelligence/scoring.py +0 -0
  42. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/mcp/__init__.py +0 -0
  43. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/mcp/schemas.py +0 -0
  44. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/mcp/server.py +0 -0
  45. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/mcp/tools.py +0 -0
  46. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/mcp/transport.py +0 -0
  47. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/output/__init__.py +0 -0
  48. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/output/json_export.py +0 -0
  49. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/output/markdown.py +0 -0
  50. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/output/terminal.py +0 -0
  51. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/paths.py +0 -0
  52. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/privacy.py +0 -0
  53. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/.devtimeignore +0 -0
  54. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/README.md +0 -0
  55. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/docs/decisions/0001-use-jwt.md +0 -0
  56. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/package.json +0 -0
  57. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/admin/permissions.ts +0 -0
  58. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/auth/login.ts +0 -0
  59. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/auth/middleware.ts +0 -0
  60. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/auth/tokens.ts +0 -0
  61. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/billing/stripe-webhook.ts +0 -0
  62. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/billing/subscription-service.ts +0 -0
  63. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/export/export-csv.ts +0 -0
  64. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/jobs/email-worker.ts +0 -0
  65. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/src/jobs/queues.ts +0 -0
  66. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/tests/auth-login.test.ts +0 -0
  67. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/resources/demo-saas/tests/stripe-signature.test.ts +0 -0
  68. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/__init__.py +0 -0
  69. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/__init__.py +0 -0
  70. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/config_files.py +0 -0
  71. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/docs.py +0 -0
  72. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/nextjs.py +0 -0
  73. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/extractors/tests.py +0 -0
  74. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/file_walker.py +0 -0
  75. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/ignore.py +0 -0
  76. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/language.py +0 -0
  77. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime/scanner/signals.py +0 -0
  78. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/dependency_links.txt +0 -0
  79. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/entry_points.txt +0 -0
  80. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/requires.txt +0 -0
  81. {devtime_ei-0.6.0 → devtime_ei-0.7.0}/src/devtime_ei.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devtime-ei
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Local-first Engineering Intelligence for software repositories
5
5
  Author-email: Aviad Shakargi <aviad94@gmail.com>
6
6
  Maintainer-email: Aviad Shakargi <aviad94@gmail.com>
@@ -8,7 +8,7 @@ License: Apache-2.0
8
8
  Project-URL: Homepage, https://github.com/Shakargy/devtime
9
9
  Project-URL: Repository, https://github.com/Shakargy/devtime
10
10
  Project-URL: Issues, https://github.com/Shakargy/devtime/issues
11
- Project-URL: Release Notes, https://github.com/Shakargy/devtime/releases/tag/v0.6.0
11
+ Project-URL: Release Notes, https://github.com/Shakargy/devtime/releases/tag/v0.7.0
12
12
  Project-URL: Demo, https://youtu.be/1Hiu3Y9J_SI
13
13
  Keywords: devtools,cli,static-analysis,repository-analysis,engineering-intelligence,local-first
14
14
  Classifier: Development Status :: 3 - Alpha
@@ -152,8 +152,18 @@ actually verify in your repository, and when nothing applies it says what would
152
152
  make a claim verifiable instead of dead-ending.
153
153
 
154
154
  Truth and freshness are separate: when a file behind a verified claim changes,
155
- the claim goes STALE and names the file. `dtc risk --diff` reports which verified
156
- claims a diff destabilizes.
155
+ the claim goes STALE and names the file.
156
+
157
+ To review a change, compare claims at two commits:
158
+
159
+ ```bash
160
+ dtc review --base origin/main
161
+ ```
162
+
163
+ It reports what the change did to each claim (a regression, a claim that newly
164
+ applies, evidence that changed under a claim that held) from isolated snapshots
165
+ of both commits, without touching your working tree. It runs in GitHub Actions
166
+ as an advisory job summary.
157
167
 
158
168
  See **[VERIFICATION.md](VERIFICATION.md)** for the full model and its limits.
159
169
 
@@ -256,6 +266,7 @@ Anything outside these six is out of scope for now. See [LIMITATIONS.md](LIMITAT
256
266
  | `dtc risk --diff` | Review a git diff for risky changes using local evidence (advisory). |
257
267
  | `dtc decision add` | Add a local decision record that can reduce uncertainty. |
258
268
  | `dtc verify [claim]` | Verify repository claims against evidence: status, contradictions, freshness (experimental). |
269
+ | `dtc review --base <ref>` | Compare claims at two commits and report what the change did to them (advisory). |
259
270
 
260
271
  (Also available: `dtc evidence`, `dtc debt`, `dtc status`, `dtc doctor --privacy`,
261
272
  `dtc export`, `dtc reset`, `dtc mcp start`.)
@@ -113,8 +113,18 @@ actually verify in your repository, and when nothing applies it says what would
113
113
  make a claim verifiable instead of dead-ending.
114
114
 
115
115
  Truth and freshness are separate: when a file behind a verified claim changes,
116
- the claim goes STALE and names the file. `dtc risk --diff` reports which verified
117
- claims a diff destabilizes.
116
+ the claim goes STALE and names the file.
117
+
118
+ To review a change, compare claims at two commits:
119
+
120
+ ```bash
121
+ dtc review --base origin/main
122
+ ```
123
+
124
+ It reports what the change did to each claim (a regression, a claim that newly
125
+ applies, evidence that changed under a claim that held) from isolated snapshots
126
+ of both commits, without touching your working tree. It runs in GitHub Actions
127
+ as an advisory job summary.
118
128
 
119
129
  See **[VERIFICATION.md](VERIFICATION.md)** for the full model and its limits.
120
130
 
@@ -217,6 +227,7 @@ Anything outside these six is out of scope for now. See [LIMITATIONS.md](LIMITAT
217
227
  | `dtc risk --diff` | Review a git diff for risky changes using local evidence (advisory). |
218
228
  | `dtc decision add` | Add a local decision record that can reduce uncertainty. |
219
229
  | `dtc verify [claim]` | Verify repository claims against evidence: status, contradictions, freshness (experimental). |
230
+ | `dtc review --base <ref>` | Compare claims at two commits and report what the change did to them (advisory). |
220
231
 
221
232
  (Also available: `dtc evidence`, `dtc debt`, `dtc status`, `dtc doctor --privacy`,
222
233
  `dtc export`, `dtc reset`, `dtc mcp start`.)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devtime-ei"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "Local-first Engineering Intelligence for software repositories"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -50,7 +50,7 @@ dev = [
50
50
  Homepage = "https://github.com/Shakargy/devtime"
51
51
  Repository = "https://github.com/Shakargy/devtime"
52
52
  Issues = "https://github.com/Shakargy/devtime/issues"
53
- "Release Notes" = "https://github.com/Shakargy/devtime/releases/tag/v0.6.0"
53
+ "Release Notes" = "https://github.com/Shakargy/devtime/releases/tag/v0.7.0"
54
54
  Demo = "https://youtu.be/1Hiu3Y9J_SI"
55
55
 
56
56
  [project.scripts]
@@ -1,6 +1,6 @@
1
1
  """DevTime - local-first Engineering Intelligence for repository memory."""
2
2
 
3
- __version__ = "0.6.0"
3
+ __version__ = "0.7.0"
4
4
 
5
5
  # Version metadata (Builder Edition, Chapter 20).
6
6
  EVIDENCE_MODEL = "2026.06.1"
@@ -5,6 +5,10 @@ The CLI is the first product surface. It must make trust visible.
5
5
  Exit codes (Appendix A):
6
6
  0 success | 1 general error | 2 not initialized | 3 scan failed
7
7
  4 migration failed | 5 privacy boundary violation | 6 fixture assertion failed
8
+ 7 review found a regression (only with `dtc review --fail-on-regression`)
9
+
10
+ `dtc review` exits 1 when the review could not run (bad ref, shallow clone,
11
+ failed snapshot scan). A review that could not run is never reported as clean.
8
12
  """
9
13
 
10
14
  from __future__ import annotations
@@ -509,6 +513,48 @@ def risk(
509
513
  raise typer.Exit(code=1)
510
514
 
511
515
 
516
+ @app.command()
517
+ def review(
518
+ base: str = typer.Option(..., "--base", help="Base ref, e.g. origin/main."),
519
+ head: str = typer.Option("HEAD", "--head", help="Head ref to review."),
520
+ fmt: str = typer.Option("text", "--format", help="text, json, or markdown."),
521
+ json_out: Path = typer.Option(
522
+ None, "--json-out", help="Also write the JSON report to this file."
523
+ ),
524
+ fail_on_regression: bool = typer.Option(
525
+ False,
526
+ "--fail-on-regression",
527
+ help="Exit 7 when a claim regresses. Off by default: reviews are advisory.",
528
+ ),
529
+ ) -> None:
530
+ """Compare claims at two commits and report what the change did to them."""
531
+ import json as _json
532
+
533
+ from devtime.output.review import render_markdown, render_text
534
+ from devtime.review_flow import has_regression, run_review
535
+
536
+ if fmt not in ("text", "json", "markdown"):
537
+ console.print("[red]--format must be text, json, or markdown.[/red]")
538
+ raise typer.Exit(code=1)
539
+
540
+ report = run_review(Path.cwd(), base, head)
541
+
542
+ if json_out is not None:
543
+ json_out.write_text(_json.dumps(report, indent=2) + "\n", encoding="utf-8")
544
+
545
+ if fmt == "json":
546
+ typer.echo(_json.dumps(report, indent=2))
547
+ elif fmt == "markdown":
548
+ typer.echo(render_markdown(report))
549
+ else:
550
+ typer.echo(render_text(report))
551
+
552
+ if report["status"] != "completed":
553
+ raise typer.Exit(code=1)
554
+ if fail_on_regression and has_regression(report):
555
+ raise typer.Exit(code=7)
556
+
557
+
512
558
  # --------------------------------------------------------------------------- #
513
559
  # AI workflow
514
560
  # --------------------------------------------------------------------------- #
@@ -0,0 +1,179 @@
1
+ """Claim transitions between two snapshots (v0.7.0).
2
+
3
+ A change is not interesting because it touched files. It is interesting when it
4
+ moves what the repository can support: a claim that was supported and no
5
+ longer is, a claim that newly applies, or a claim whose evidence changed even
6
+ though its conclusion held.
7
+
8
+ This module is pure: it takes two lists of verification results and the set of
9
+ changed paths, and returns transitions. It does no git, filesystem, or database
10
+ work, so its behavior is fully determined by its inputs.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from dataclasses import dataclass, field
16
+
17
+ from devtime.intelligence import verification as ver
18
+
19
+ # Transition kinds, in reporting order (most important first).
20
+ REGRESSION = "regression"
21
+ NEWLY_APPLICABLE = "newly_applicable"
22
+ NO_LONGER_APPLICABLE = "no_longer_applicable"
23
+ IMPROVEMENT = "improvement"
24
+ EVIDENCE_CHANGED = "evidence_changed"
25
+ UNCHANGED = "unchanged"
26
+
27
+ _ORDER = {
28
+ REGRESSION: 0,
29
+ NEWLY_APPLICABLE: 1,
30
+ NO_LONGER_APPLICABLE: 2,
31
+ IMPROVEMENT: 3,
32
+ EVIDENCE_CHANGED: 4,
33
+ UNCHANGED: 5,
34
+ }
35
+
36
+ # How strongly a status supports its claim. Used only to tell a regression from
37
+ # an improvement; NOT_APPLICABLE is handled separately because it is not a
38
+ # weaker form of support, it is the absence of a surface.
39
+ _RANK = {
40
+ ver.CONTRADICTED: 0,
41
+ ver.UNKNOWN: 1,
42
+ ver.WEAK: 1,
43
+ ver.SUPPORTED: 2,
44
+ }
45
+
46
+ _NOTES = {
47
+ REGRESSION: "The change reduced what the repository can support for this claim.",
48
+ NEWLY_APPLICABLE: "The change introduced a surface this claim now applies to.",
49
+ NO_LONGER_APPLICABLE: (
50
+ "The surface this claim applied to is no longer detected. It may have "
51
+ "been removed, renamed, or moved outside scanner coverage."
52
+ ),
53
+ IMPROVEMENT: "The change added evidence for this claim.",
54
+ EVIDENCE_CHANGED: (
55
+ "Files this claim depends on changed. The status held, but the evidence "
56
+ "behind it is different and may be worth a look."
57
+ ),
58
+ UNCHANGED: "",
59
+ }
60
+
61
+
62
+ @dataclass
63
+ class Transition:
64
+ claim_id: str
65
+ claim_name: str
66
+ kind: str
67
+ base_status: str
68
+ head_status: str
69
+ base_summary: str
70
+ head_summary: str
71
+ changed_evidence: list[str] = field(default_factory=list)
72
+ head_missing: list[str] = field(default_factory=list)
73
+ note: str = ""
74
+
75
+ def to_dict(self) -> dict:
76
+ return {
77
+ "claim_id": self.claim_id,
78
+ "claim_name": self.claim_name,
79
+ "kind": self.kind,
80
+ "base_status": self.base_status,
81
+ "head_status": self.head_status,
82
+ "base_summary": self.base_summary,
83
+ "head_summary": self.head_summary,
84
+ "changed_evidence": self.changed_evidence,
85
+ "head_missing_evidence": self.head_missing,
86
+ "note": self.note,
87
+ }
88
+
89
+
90
+ def _summary(result) -> str:
91
+ return result.why[0] if result.why else ""
92
+
93
+
94
+ def _classify(base_status: str, head_status: str) -> str | None:
95
+ """Kind for a status change, or None when the status did not change."""
96
+ if base_status == head_status:
97
+ return None
98
+ if base_status == ver.NOT_APPLICABLE:
99
+ return NEWLY_APPLICABLE
100
+ if head_status == ver.NOT_APPLICABLE:
101
+ return NO_LONGER_APPLICABLE
102
+ if head_status == ver.CONTRADICTED:
103
+ return REGRESSION
104
+ if _RANK.get(head_status, 1) < _RANK.get(base_status, 1):
105
+ return REGRESSION
106
+ if _RANK.get(head_status, 1) > _RANK.get(base_status, 1):
107
+ return IMPROVEMENT
108
+ # WEAK <-> UNKNOWN: same strength, different reason. Report it as a change
109
+ # of evidence rather than inventing a direction.
110
+ return EVIDENCE_CHANGED
111
+
112
+
113
+ def compute_transitions(
114
+ base_results: list, head_results: list, changed_paths: set[str]
115
+ ) -> list[Transition]:
116
+ """Every claim's transition from base to head, most important first.
117
+
118
+ `changed_paths` must contain both the new and the old path of a rename, so a
119
+ claim that depended on a renamed file is recognized as affected.
120
+ """
121
+ base_by_id = {r.claim_slug: r for r in base_results}
122
+ head_by_id = {r.claim_slug: r for r in head_results}
123
+ transitions: list[Transition] = []
124
+
125
+ for claim_id in sorted(set(base_by_id) | set(head_by_id)):
126
+ base = base_by_id.get(claim_id)
127
+ head = head_by_id.get(claim_id)
128
+ base_status = base.status if base else ver.NOT_APPLICABLE
129
+ head_status = head.status if head else ver.NOT_APPLICABLE
130
+
131
+ deps: set[str] = set()
132
+ for r in (base, head):
133
+ if r is None:
134
+ continue
135
+ deps |= set(r.dependencies)
136
+ deps |= {e.path for e in r.supporting}
137
+ touched = sorted(deps & changed_paths)
138
+
139
+ kind = _classify(base_status, head_status)
140
+ base_summary = _summary(base) if base else ""
141
+ head_summary = _summary(head) if head else ""
142
+ if kind is None:
143
+ both_not_applicable = base_status == ver.NOT_APPLICABLE
144
+ if not both_not_applicable and (touched or base_summary != head_summary):
145
+ kind = EVIDENCE_CHANGED
146
+ else:
147
+ kind = UNCHANGED
148
+
149
+ ref = head or base
150
+ transitions.append(
151
+ Transition(
152
+ claim_id=claim_id,
153
+ claim_name=ref.claim_name if ref else claim_id,
154
+ kind=kind,
155
+ base_status=base_status,
156
+ head_status=head_status,
157
+ base_summary=base_summary,
158
+ head_summary=head_summary,
159
+ changed_evidence=touched[:20],
160
+ head_missing=list(head.missing) if head else [],
161
+ note=_NOTES[kind],
162
+ )
163
+ )
164
+
165
+ transitions.sort(key=lambda t: (_ORDER[t.kind], t.claim_id))
166
+ return transitions
167
+
168
+
169
+ def summarize(transitions: list[Transition]) -> dict:
170
+ counts = {kind: 0 for kind in _ORDER}
171
+ for t in transitions:
172
+ counts[t.kind] += 1
173
+ return counts
174
+
175
+
176
+ def reportable(transitions: list[Transition]) -> list[Transition]:
177
+ """Transitions worth showing. Unchanged, unaffected claims are only counted,
178
+ so a review does not repeat low-value observations on every run."""
179
+ return [t for t in transitions if t.kind != UNCHANGED]
@@ -378,17 +378,27 @@ def _verify_billing_webhook_signature(
378
378
 
379
379
  if kind == "webhook_signature_verification":
380
380
  verification_rows.append(row)
381
- if not _is_test_path(row["path"]):
381
+ if not _is_non_app_path(row["path"]):
382
382
  verify_files.add(row["path"])
383
383
  verifications.append(
384
384
  _ref(row, "Verifies the provider's webhook signature.", "strong")
385
385
  )
386
- elif kind == "route" and "webhook" in hay and _is_billingish(hay):
386
+ elif (
387
+ kind == "route"
388
+ and "webhook" in hay
389
+ and _is_billingish(hay)
390
+ and not _is_non_app_path(row["path"])
391
+ ):
387
392
  webhook_route_rows.append(row)
388
393
  webhook_routes.append(
389
394
  _ref(row, "Billing webhook route is handled here.", "moderate")
390
395
  )
391
- elif kind == "disabled_endpoint" and "webhook" in hay and _is_billingish(hay):
396
+ elif (
397
+ kind == "disabled_endpoint"
398
+ and "webhook" in hay
399
+ and _is_billingish(hay)
400
+ and not _is_non_app_path(row["path"])
401
+ ):
392
402
  stub_webhooks.append(
393
403
  _ref(
394
404
  row,
@@ -401,7 +411,14 @@ def _verify_billing_webhook_signature(
401
411
  signature_tests.append(
402
412
  _ref(row, "Test exercises webhook signature behavior.", "moderate")
403
413
  )
404
- elif kind == "dependency" and any(p in hay for p in _PROVIDER_TOKENS):
414
+ elif (
415
+ kind == "dependency"
416
+ and not _is_non_app_path(row["path"])
417
+ # The dependency's own name, never the file it appears in: an
418
+ # `import express` inside stripe-webhook.ts is not a Stripe
419
+ # dependency (v0.7.0, same class of bug as the v0.5.1 admin fix).
420
+ and any(p in str(row["name"] or "").lower() for p in _PROVIDER_TOKENS)
421
+ ):
405
422
  provider_deps.append(
406
423
  _ref(row, "Payment provider dependency is declared.", "weak")
407
424
  )
@@ -499,6 +516,17 @@ def _verify_billing_webhook_signature(
499
516
  inventory=inventory,
500
517
  )
501
518
 
519
+ # No webhook route was extracted. A verification call in application code
520
+ # can still stand in for its own handler (for example a default-exported
521
+ # handler function), but a call inside a test, example, or fixture cannot
522
+ # protect production code (v0.7.0: this fallback previously used every
523
+ # verification signal in the repository).
524
+ verifications = [
525
+ ref
526
+ for ref, row in zip(verifications, verification_rows)
527
+ if not _is_non_app_path(row["path"])
528
+ ]
529
+
502
530
  if stub_webhooks and not verifications:
503
531
  for stub in stub_webhooks:
504
532
  contradictions.append(
@@ -1042,6 +1070,10 @@ def _verify_admin_authorization(
1042
1070
  for row in rows:
1043
1071
  if row["kind"] != "route":
1044
1072
  continue
1073
+ # Test, example, and fixture routes are not the application's surface
1074
+ # (v0.7.0: applied to every claim, not only route test association).
1075
+ if _is_non_app_path(row["path"]):
1076
+ continue
1045
1077
  meta = _meta(row)
1046
1078
  route_path = str(meta.get("path") or row["name"] or "").lower()
1047
1079
  if any(t in route_path for t in _ADMIN_TOKENS):
@@ -0,0 +1,154 @@
1
+ """Human and Markdown rendering for `dtc review` (v0.7.0).
2
+
3
+ Presentation only: every fact rendered here comes from the report produced by
4
+ devtime.review_flow. Markdown is written for a GitHub step summary, so a
5
+ reviewer can read the result without opening raw job logs.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ _LABEL = {
11
+ "regression": "Regression",
12
+ "newly_applicable": "Newly applicable",
13
+ "no_longer_applicable": "No longer applicable",
14
+ "improvement": "Improvement",
15
+ "evidence_changed": "Evidence changed",
16
+ }
17
+
18
+
19
+ def _short(commit: str | None) -> str:
20
+ return (commit or "")[:12]
21
+
22
+
23
+ def _unchanged_count(report: dict) -> int:
24
+ return int(report.get("summary", {}).get("unchanged", 0))
25
+
26
+
27
+ def render_text(report: dict) -> str:
28
+ if report.get("status") != "completed":
29
+ err = report.get("error") or {}
30
+ lines = [
31
+ "DevTime review could not be completed.",
32
+ f" reason: {err.get('reason', 'unknown error')}",
33
+ ]
34
+ if err.get("hint"):
35
+ lines.append(f" hint: {err['hint']}")
36
+ lines.append("This is a failed review, not a clean one. No findings were produced.")
37
+ return "\n".join(lines)
38
+
39
+ base, head = report["base"], report["head"]
40
+ lines = [
41
+ "DevTime review",
42
+ f" base {base['ref']} (merge base {_short(base.get('merge_base'))})",
43
+ f" head {head['ref']} ({_short(head.get('commit'))})",
44
+ f" scope {report.get('scope', '.')} "
45
+ f"{report.get('changed_files_total', 0)} file(s) changed",
46
+ "",
47
+ ]
48
+ for w in report.get("warnings", []):
49
+ lines += [f"Warning: {w}", ""]
50
+
51
+ transitions = report.get("transitions", [])
52
+ if not transitions:
53
+ lines.append(
54
+ "No claim changed status, and no evidence behind an applicable claim "
55
+ "changed."
56
+ )
57
+ lines.append("")
58
+ for t in transitions:
59
+ label = _LABEL.get(t["kind"], t["kind"])
60
+ lines.append(
61
+ f"{label}: {t['claim_id']} {t['base_status']} -> {t['head_status']}"
62
+ )
63
+ if t.get("base_summary"):
64
+ lines.append(f" base: {t['base_summary']}")
65
+ if t.get("head_summary") and t["head_summary"] != t.get("base_summary"):
66
+ lines.append(f" head: {t['head_summary']}")
67
+ for p in t.get("changed_evidence", [])[:5]:
68
+ lines.append(f" changed evidence: {p}")
69
+ if t["kind"] == "regression":
70
+ for m in t.get("head_missing_evidence", [])[:3]:
71
+ lines.append(f" missing now: {m}")
72
+ if t.get("note"):
73
+ lines.append(f" {t['note']}")
74
+ lines.append("")
75
+
76
+ unchanged = _unchanged_count(report)
77
+ if unchanged:
78
+ lines.append(f"{unchanged} claim(s) unchanged and unaffected by this change.")
79
+ lines.append(
80
+ "Advisory: statuses come from static analysis. They are not a merge gate "
81
+ "or proof of runtime behavior."
82
+ )
83
+ return "\n".join(lines)
84
+
85
+
86
+ def _cell(text: str) -> str:
87
+ return (text or "").replace("|", "\\|").replace("\n", " ")
88
+
89
+
90
+ def render_markdown(report: dict) -> str:
91
+ if report.get("status") != "completed":
92
+ err = report.get("error") or {}
93
+ out = [
94
+ "### DevTime review: failed",
95
+ "",
96
+ f"**Reason:** {_cell(err.get('reason', 'unknown error'))}",
97
+ ]
98
+ if err.get("hint"):
99
+ out.append(f"**Hint:** {_cell(err['hint'])}")
100
+ out += ["", "_This review did not run. It is not a clean result._"]
101
+ return "\n".join(out)
102
+
103
+ base, head = report["base"], report["head"]
104
+ out = [
105
+ "### DevTime review",
106
+ "",
107
+ f"`{base['ref']}` (merge base `{_short(base.get('merge_base'))}`) -> "
108
+ f"`{head['ref']}` (`{_short(head.get('commit'))}`), "
109
+ f"{report.get('changed_files_total', 0)} file(s) changed",
110
+ "",
111
+ ]
112
+ for w in report.get("warnings", []):
113
+ out += [f"> {_cell(w)}", ""]
114
+
115
+ transitions = report.get("transitions", [])
116
+ if not transitions:
117
+ out += [
118
+ "No claim changed status, and no evidence behind an applicable claim "
119
+ "changed.",
120
+ "",
121
+ ]
122
+ else:
123
+ out += [
124
+ "| Change | Claim | Base | Head | Now |",
125
+ "|---|---|---|---|---|",
126
+ ]
127
+ for t in transitions:
128
+ out.append(
129
+ f"| {_LABEL.get(t['kind'], t['kind'])} | `{t['claim_id']}` | "
130
+ f"{t['base_status']} | {t['head_status']} | "
131
+ f"{_cell(t.get('head_summary') or t.get('base_summary', ''))} |"
132
+ )
133
+ out.append("")
134
+ detailed = [t for t in transitions if t.get("changed_evidence") or t.get("note")]
135
+ if detailed:
136
+ out += ["<details><summary>Evidence behind these changes</summary>", ""]
137
+ for t in detailed:
138
+ out.append(f"**`{t['claim_id']}`**: {_cell(t.get('note', ''))}")
139
+ for p in t.get("changed_evidence", [])[:10]:
140
+ out.append(f"- changed: `{p}`")
141
+ if t["kind"] == "regression":
142
+ for m in t.get("head_missing_evidence", [])[:3]:
143
+ out.append(f"- missing now: {_cell(m)}")
144
+ out.append("")
145
+ out += ["</details>", ""]
146
+
147
+ unchanged = _unchanged_count(report)
148
+ if unchanged:
149
+ out += [f"{unchanged} claim(s) unchanged and unaffected by this change.", ""]
150
+ out.append(
151
+ "_Advisory: statuses come from static analysis. They are not a merge gate "
152
+ "or proof of runtime behavior._"
153
+ )
154
+ return "\n".join(out)