Commit be76612
authored
Feat/coverage external bucket and swift methods (#77)
* feat(coverage): bucket external calls + widen Swift method inference
Cross-repo coverage counted every unresolved client call as an internal
blind spot, conflating genuine gaps with calls to hardcoded third-party
hosts. Split those out and improve Swift verb detection so fewer internal
calls are missed.
- Swift URLSession method inference: scan a symmetric window (the verb is
often set before the path is appended) and recognize enum / .rawValue /
leading-dot `.method = .x` forms, validated against the verb set; GET only
as a last resort.
- Swift external detection: tag a client route whose base URL is a hardcoded
absolute host with external=true + host (internal/extractors/swiftextractor).
- Linker: httpCoverage gains an `external` tally; external client calls are
bucketed out of unresolved and produce no cross-repo edge
(internal/linkers/crossrepo).
- Metric: CoverageSummary.ExternalEdges; unresolved_edges is now internal-only;
surfaced in the coverage explainer, coverage_report, and the global receipt.
- Bump extractor cacheVersion v88 -> v89 (Swift facts change) and register the
cachecov guard entry for v89.
Totals reconcile per service: detected = resolved + unresolved + external.
* feat(coverage): make unresolved client calls queryable + safe extractor wins
Aggregate coverage counts couldn't tell which client calls were unresolved,
so every fix was guesswork. Add a per-call verdict and land the no-risk
extractor gaps, so the residual can be triaged from data.
- crossrepo: UnmatchedClientRouteKeys mirrors linkHTTP's resolution exactly;
shared indexServerRoutes keeps the verdict in lockstep.
- engine: flagUnmatchedRoutes tags client call sites unmatched_by_server +
unmatched_reason (no_method | generic_path | no_match), recomputed each link.
- kotlin/retrofit: absolute-URL annotations tagged external=true + host.
- ruby routes: `match ... via:` verbs and `scope`/`namespace path:` prefixes.
- Bump extractor cacheVersion v89 -> v90 and register the cachecov guard entry.
* feat(coverage): resolve Rails PUT updates + split no_match reason
Rails routes both PATCH and PUT to a resources `update` action, but the Ruby
extractor modeled only PATCH — so mobile clients calling PUT for updates had no
server route to match, despite the endpoint being served.
- ruby routes: resources/resource update emits both PATCH and PUT
(restfulActions + restfulActionsSingular); only:/except: keep them together.
- crossrepo: split the client-side no_match verdict into method_mismatch (a
server route shares the path suffix but not the verb) vs path_unknown (no
server serves the path), via a method-agnostic suffix index — so the residual
triages itself.
- Bump extractor cacheVersion v90 -> v91 and register the cachecov guard entry.
Measured on a 3-repo graph: unresolved client calls dropped 97 -> 59 (38 PUT
updates recovered); the remainder splits 51 path_unknown / 7 method_mismatch / 1
generic_path.
* feat(coverage): extract Rails symbol-path, scope-symbol, and resource path: routes
The Ruby route extractor missed three common Rails DSL forms, so real backend
endpoints weren't modeled and mobile clients calling them couldn't resolve.
- get/post/match now accept a symbol path arg (`get :cities_by_zip`) via a new
positional-only path helper that also avoids mistaking a `to:` handler string
for the path.
- `scope :users` (bare positional symbol) applies the path prefix, like
`scope path: 'users'`.
- `resource(s) ..., path: 'x'` overrides the URL segment (the resource name
still drives props and the nested member param).
- Bump extractor cacheVersion v91 -> v92 and register the cachecov guard entry.
* feat(coverage): read Swift endpoint methods that defaulted to GET
The Swift endpoint extractor derived the HTTP method only from a `method`
switch parsed one line at a time, so two common shapes silently fell back to
GET — making real POST/PUT/DELETE calls miss their backend route:
- multi-line case-label lists: `switchReturns` read labels only from the line
starting with `case `, dropping continuation-line labels
(`case .a,\n .b: return .post`). Accumulate labels across lines until the `:`.
- single-value method properties: `var method: HTTPMethod { return .post }`
(no switch) yielded no cases; read its lone verb and apply it to every case.
- Bump extractor cacheVersion v92 -> v94 (two distinct re-extraction triggers)
and register the cachecov guard entries.
* Fixing vuln check1 parent 49e8afb commit be76612
25 files changed
Lines changed: 1018 additions & 109 deletions
File tree
- .github/workflows
- internal
- cachecov
- engine
- testdata/golden
- explainers/coverage
- extractors
- kotlinextractor
- rubyextractor
- swiftextractor
- facts
- linkers/crossrepo
- server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
233 | 253 | | |
234 | 254 | | |
235 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
403 | 405 | | |
404 | | - | |
405 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
406 | 409 | | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
410 | | - | |
411 | | - | |
| 413 | + | |
| 414 | + | |
412 | 415 | | |
413 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
414 | 425 | | |
415 | 426 | | |
416 | | - | |
| 427 | + | |
417 | 428 | | |
418 | 429 | | |
419 | 430 | | |
420 | 431 | | |
421 | | - | |
| 432 | + | |
422 | 433 | | |
423 | 434 | | |
424 | 435 | | |
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
428 | | - | |
429 | | - | |
| 439 | + | |
| 440 | + | |
430 | 441 | | |
431 | 442 | | |
432 | 443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
146 | | - | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments