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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
//! Serialization types for the incremental parse cache.
//!
//! All types use bitcode `Encode`/`Decode` for fast binary serialization.
use ;
use crateMemberKind;
/// Cache version, bump when the cache format or cached extraction semantics change.
///
/// Bumped to 89 for issue #475: extraction now strips a leading UTF-8 BOM
/// before hashing and computing line offsets, so pre-fix entries whose source
/// included a BOM carry hashes over the wrong byte sequence and would
/// fast-path into stale `member_accesses` / `exports` for any BOM-bearing
/// file. The bump invalidates user caches once on upgrade; subsequent runs
/// are warm.
///
/// Bumped to 90 for issue #540: CSS Modules class extraction now strips
/// `@layer` and `@import` at-rule preludes before scanning class names, so
/// pre-fix entries for `.module.css` files using nested cascade-layer syntax
/// (`@layer foo.bar { ... }`) carry phantom `bar` / `baz` exports that the
/// new scanner no longer produces.
///
/// Bumped to 91 for issue #549: CSS Modules class extraction now records a
/// real `Span` pointing at each class's declaration position in the source.
/// Pre-fix cache entries for `.module.css` / `.module.scss` files carry
/// `Span::default()` (start=0, end=0) on every export, which renders every
/// finding at line:1 col:0; the new scanner produces real offsets.
///
/// Bumped to 92 for issue #563: feature flag extraction recognizes additional
/// built-in SDK providers (PostHog, Vercel Flags, Optimizely, Eppo, plus more
/// ConfigCat surfaces) and Vercel `flag({ key: "..." })` object arguments, so
/// pre-fix entries can carry stale `flag_uses`.
///
/// Bumped to 93 for issue #589: Node `module.register()` loader calls now
/// emit `DynamicImportInfo.destructured_names` populated with the loader-hook
/// allowlist (current `initialize` / `resolve` / `load` / `globalPreload`
/// plus legacy `getFormat` / `getSource` / `transformSource`) for every
/// relative or `file:` specifier, including specifiers bound via
/// `new URL(..., import.meta.url)`. Pre-fix entries carry empty
/// `destructured_names` for the same source, so they would silently miss
/// the named-export credit until the file is touched.
///
/// Bumped to 94 for issue #586: Playwright helper fixture extraction recognizes
/// helpers with local setup before the final `return base.extend<T>(...)`, so
/// pre-fix entries can miss fixture definition sentinels.
///
/// Bumped to 95 for the Glimmer `<template>` scanner: imported-binding usage
/// and `MemberAccess { object: "this", member }` records for `{{this.foo}}`
/// template references are now folded into the extractor before
/// `into_module_info`. Pre-fix entries for `.gts` / `.gjs` files omit both,
/// so template-only imports surface as `unused-import` and template-only
/// class members as `unused-class-member` until the cache is re-extracted.
///
/// Bumped to 96 for issue #640: generic JSX `<script src>` and
/// `<link rel="stylesheet|modulepreload" href>` attributes no longer emit
/// synthetic `SideEffect` imports, so pre-fix entries can carry stale JSX
/// resource edges that surface as false `unresolved-imports`.
///
/// Bumped to 97 for issue #639: MDX import/export extraction now skips
/// fenced Markdown code blocks, so pre-fix entries can carry stale example
/// imports that surface as false `unresolved-imports`.
///
/// Bumped to 98 for issue #638: statically resolvable `child_process.fork()`
/// targets now emit `DynamicImportInfo` entries for local runner files.
/// Pre-fix entries omit those dynamic imports, so forked script files can be
/// reported as unused until the file is re-extracted.
///
/// Bumped to 99 for issue #605: methods reached via `new Class(...).method()`
/// receivers (direct and fluent-chain) now emit member accesses crediting the
/// constructed class. Pre-fix entries lack those accesses, so such methods can
/// be reported as unused class members until the file is re-extracted.
///
/// Bumped to 100 for issue #608: static Iconify icon strings (`icon="jam:github"`,
/// `name="ic:round-home"`) in markup now populate `iconify_prefixes` so the
/// `@iconify-json/<prefix>` package is credited. Pre-fix entries omit the field,
/// so icon-set packages can be reported as unused until the file is re-extracted.
///
/// Bumped to 101 for issue #704: SFC template tags that match no import now
/// populate `auto_import_candidates` for convention auto-import resolution.
/// Pre-fix entries omit the field, so Nuxt components consumed only via template
/// tags are not edge-credited until the file is re-extracted.
///
/// Bumped to 102 for issue #742: `FunctionComplexity` now carries an
/// `Option<String> source_hash` (content digest of the function's full-span
/// source slice) so runtime-coverage baselines survive line moves. Pre-fix
/// cache entries lack the field, so the hash is absent until re-extraction.
///
/// Bumped to 103 for issue #752: typed destructure bindings
/// (`let { resultState }: Props = $props()`, `function f({ x }: Props)`) now
/// populate `binding_target_names`, which changes the `member_accesses` emitted
/// for those files. Pre-fix cache entries lack the additional member accesses.
///
/// Bumped to 104 for issue #445: MDX, Astro, Vue/Svelte SFC, and CSS/SCSS
/// container extraction now remaps source-authored spans back to the original
/// file byte offsets. Pre-fix entries can carry synthetic extracted-buffer
/// positions, so diagnostics can point at line 1 or compacted MDX lines until
/// the file is re-extracted.
///
/// Bumped to 105 for issue #739: JS/TS and Vue/Svelte SFC script extraction
/// now populates `auto_import_candidates` from unresolved value references.
/// Pre-fix entries omit these candidates, so convention script auto-imports
/// are not edge-credited until the file is re-extracted.
///
/// Bumped to 106 for `fallow security`: JS/TS extraction now stores file-level
/// directives (`"use client"`, `"use server"`) in the parse cache so client
/// boundary detection does not depend on stale cached module info.
///
/// Bumped to 107 for issue #835: Svelte `<script src>` references no longer
/// emit synthetic imports because they are runtime markup, not bundled SFC
/// script modules. Pre-fix entries can carry stale root-relative imports that
/// surface as false `unresolved-imports`.
///
/// Bumped to 108 for three extraction-semantics changes shipping together:
/// - issue #839: `declare` ambient class properties are no longer extracted as
/// class members (they emit no JS and cannot be value-referenced), so pre-fix
/// entries carry phantom members that surface as false `unused-class-member`.
/// - issue #840: extensionless `new URL(specifier, import.meta.url)` dynamic
/// imports now persist `is_speculative = true` so a directory target
/// (`new URL('./services', import.meta.url)`) is silently dropped when the
/// resolver finds no module; pre-fix entries carry `is_speculative = false`
/// and surface as false `unresolved-imports`.
/// - issue #845: a method call on an `instanceof`-narrowed value now emits a
/// member access against the narrowed class, changing the persisted
/// `member_accesses`; pre-fix entries miss the credit and surface as false
/// `unused-class-member`.
///
/// Bumped to 109 for the data-driven security matcher catalogue: JS/TS
/// extraction now captures non-literal sink sites into `security_sinks`, each
/// carrying an `arg_kind` discriminator (template-with-substitution, concat,
/// object, call, other) so the catalogue can require unsafe SQL shapes and
/// exclude safely-parameterized `` sql`${x}` `` templates and object-form
/// `.execute({ sql, args })` arguments. Pre-109 entries lack the field, so their
/// sink sites do not feed the catalogue until the file is re-extracted.
///
/// Bumped to 110 for issue #844: `const svc = useMemo(() => new Svc())` now
/// binds the non-destructured identifier to the constructed class, so method
/// calls on it emit member accesses crediting the class. This changes the
/// persisted `member_accesses` for files using the useMemo factory shape;
/// pre-fix entries miss the credit and surface as false `unused-class-member`.
///
/// Bumped to 111 for issue #859 (untrusted-source modeling): `SinkSite` now
/// carries `arg_idents` (identifiers referenced in the sink argument) and
/// `ModuleInfo`/`CachedModule` carry `tainted_bindings` (local bindings tied to
/// the member-access path they were sourced from), so the security
/// `tainted_sink` detector can back-trace a sink argument to a known untrusted
/// source. Pre-111 entries lack both, so source-to-sink association is unset
/// until the file is re-extracted.
///
/// Bumped to 112 for issue #863 (sanitizer-aware security sinks):
/// `ModuleInfo`/`CachedModule` now carry direct sanitized sink arguments, so
/// the security `tainted_sink` detector can suppress high-confidence
/// DOMPurify-backed HTML sink candidates. Pre-112 entries lack sanitizer
/// metadata until the file is re-extracted.
///
/// Bumped to 113 for issue #863 follow-up: sanitizer metadata gained URL and
/// path domains plus guarded path backpatching. Pre-113 entries may lack those
/// sanitizer domains until the file is re-extracted.
///
/// Bumped to 114 for issue #911: Angular component properties initialized with
/// named-import `inject(Service)` now populate `ClassHeritageInfo.instance_bindings`
/// so external templates can credit service member access through the property.
/// Pre-114 entries miss the binding and can surface false `unused-class-member`
/// findings until the component file is re-extracted.
///
/// Bumped to 115 for issue #910: local typed function calls now credit concrete
/// class members when a direct `new Class()` argument or constructor-bound
/// identifier flows into a structurally typed parameter. Pre-115 entries can
/// miss those synthetic `member_accesses` and surface false
/// `unused-class-member` findings.
///
/// Bumped to 117 for issue #955: Vue SFC script-side Nuxt UI icon strings now
/// populate `iconify_icon_names`, allowing declared `@iconify-json/*`
/// collections used through values like `icon: 'i-simple-icons-github'` to be
/// credited. Pre-116 entries omit those names and can surface false
/// `unused-dependency` findings until the file is re-extracted.
///
/// Bumped to 118 for issue #954: JS/TS extraction now records static
/// `pino({ transport: { target: "pkg" } })` target packages as synthetic
/// dynamic imports so runtime transport dependencies are credited. Pre-118
/// entries can surface false `unused-dependency` findings until the file is
/// re-extracted.
///
/// Bumped to 119 for issue #952: JS/TS extraction now records static package
/// path resolution references so packages consumed via package-root and
/// `pkg/package.json` lookups are credited as dependency usage. Pre-119
/// entries omit those references and can surface false `unused-dependency`
/// findings until the file is re-extracted.
///
/// Bumped to 120 for issue #953: instance methods annotated with TypeScript's
/// `this` return type now count as self-returning for constructor-rooted
/// fluent chains. Pre-120 entries can miss those self-returning flags and
/// surface false `unused-class-member` findings until the file is re-extracted.
///
/// Bumped to 121 for issue #883: framework template HTML injection sinks now
/// flow into `ModuleInfo.security_sinks` for Svelte `{@html ...}`, Vue
/// `v-html`, and Angular `[innerHTML]`. Pre-121 entries omit those sink sites
/// until the file is re-extracted.
///
/// Bumped to 122: `FunctionComplexity` now carries a `contributions` vector
/// (per-decision-point complexity breakdown) and `RequireCallInfo` carries
/// `source_span` (the specifier string-literal span so an `unresolved-import`
/// squiggly anchors under the `'./x'` specifier rather than the `require`
/// keyword). Pre-122 entries lack the breakdown (empty under
/// `health --complexity-breakdown`) and carry `Span::default()` for the
/// require specifier until the file is re-extracted.
///
/// Bumped to 123 for PR #1010: JSDoc import-type extraction now ignores prose
/// examples, including examples that contain ordinary JavaScript brace groups.
/// Pre-123 entries can carry stale type-only imports that surface as false
/// `unresolved-imports` until the file is re-extracted.
///
/// Bumped to 124 for issue #877: static `import.meta.env.SECRET` reads now
/// populate `member_accesses` as `import.meta.env` source reads for the
/// opt-in client/server security candidate detector. Pre-124 entries omit the
/// source and would miss Vite env reads until the file is re-extracted.
///
/// Bumped to 125 for issue #875: `SinkSite` now carries literal argument and
/// object-literal option metadata, allowing security catalogue rows to match
/// deterministic literal sinks such as wildcard postMessage origins,
/// permissive CORS, insecure cookie options, weak crypto algorithms, and
/// alg:none JWT options. Pre-125 entries lack that metadata until the file is
/// re-extracted.
///
/// Bumped to 126 for issue #876: `SinkSite` now carries flattened source paths
/// referenced inside sink arguments, so source-backed logging candidates can
/// match direct expressions such as `process.env.SECRET` without requiring a
/// temporary local binding. Pre-126 entries lack those paths until the file is
/// re-extracted.
///
/// Bumped to 127 for issue #898: `SinkSite` now carries complete top-level
/// object-key metadata so missing-option security rows can distinguish absent
/// keys from non-literal option values. Pre-127 entries lack that metadata until
/// the file is re-extracted.
///
/// Bumped to 128 for issue #895: JS/TS extraction now captures the exact
/// `process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"` literal assignment as a
/// security sink site. Pre-128 entries omit that sink until the file is
/// re-extracted.
///
/// Bumped to 129 for issue #901: JS/TS extraction now captures cleartext
/// request URL literals and `new WebSocket("ws://...")` as security sink sites.
/// Pre-129 entries omit those sinks until the file is re-extracted.
///
/// Bumped to 130 for issue #892: JS/TS extraction now captures static string
/// literals assigned to secret-shaped identifiers or known provider credential
/// prefixes as opt-in hardcoded-secret candidates.
/// Pre-130 entries omit those candidates until the file is re-extracted.
///
/// Bumped to 131 for issue #879: JS/TS extraction now records synthetic
/// source bindings for recognizable framework handler parameters. Pre-131
/// entries omit those bindings and cannot source-rank direct handler params.
///
/// Bumped to 132 for issue #878: JS/TS extraction now records one-hop
/// same-module helper calls that return source-backed expressions as tainted
/// bindings. Pre-132 entries miss the ranking signal until re-extracted.
///
/// Bumped to 133 for issue #901: `SinkSite` now carries integer literal
/// values and nested static object property paths for additional literal-tier
/// security rows. Pre-133 entries omit that metadata until the file is
/// re-extracted.
///
/// Bumped to 134 for issue #928: JS/TS extraction now captures risky literal
/// regex application sites in `security_sinks` so `fallow security` can report
/// source-backed ReDoS candidates. Pre-134 entries omit those sink sites until
/// the file is re-extracted.
///
/// Bumped to 135 for issue #929: JS/TS extraction now skips directly clamped
/// resource-amplification size arguments before catalogue matching. Pre-135
/// entries may retain stale clamped amplification sink candidates until the
/// file is re-extracted.
///
/// Bumped to 136 for issue #899: JS/TS extraction now emits GraphQL resolver
/// args, tRPC procedure input, and exact member source paths for local tainted
/// bindings. Pre-136 entries may miss those source-backed ranking signals until
/// the file is re-extracted.
///
/// Bumped to 137 for issue #888: JS/TS extraction now records defensive
/// security control sites for the attack-surface inventory. Pre-137 entries
/// omit those controls until the file is re-extracted.
///
/// Bumped to 138 for issue #890: `SinkSite` now carries the arg-0 URL literal
/// (`url_arg_literal`) for the secret-to-network destination signal, `import.meta.env`
/// reads are modeled as a source via the new `flatten_member_path` MetaProperty
/// arm, and public-by-convention env vars (`NEXT_PUBLIC_`, `VITE_`, ...) are no
/// longer recorded as secret sources. Pre-138 entries omit the URL signal and may
/// retain stale public-env source bindings until the file is re-extracted.
///
/// Bumped to 139 for issue #1095: JS/TS extraction now records source-backed
/// local bindings when template literals, string concatenation, or object
/// literals embed an untrusted source. Pre-139 entries miss those ranking
/// signals until the file is re-extracted.
///
/// Bumped to 140 for issue #1094: JS/TS extraction now records declarative
/// framework validation boundary controls for security surface output. Pre-140
/// entries can miss route-level validation control sites until re-extracted.
///
/// Bumped to 141 for issue #1093: `TaintedBinding` gains `source_span_start`
/// (the byte offset of the source read) so the analyze layer can anchor a taint
/// trace's source node at the real read line; pre-141 entries lack the offset.
/// Bumped to 142 for issue #1134: JS/TS extraction now stores compact
/// diagnostics for security sink-shaped callees that could not be flattened, so
/// warm-cache `fallow security` runs can report the same blind-spot metadata as
/// cold extraction.
///
/// Bumped to 143 for issue #1138: JS/TS extraction now propagates simple
/// module-scope literal constants into security sink argument metadata and
/// filters public CI metadata env vars before source matching.
///
/// Bumped to 144 for issue #1136: JS/TS sanitizer metadata now recognizes
/// proven local HTML escape helpers, renderer helpers, and SQL identifier
/// quoting helpers. Pre-144 entries can lack those sanitizer domains until the
/// file is re-extracted.
///
/// Bumped to 145 for issue #1137: `SinkSite` now carries URL construction shape
/// metadata for fixed-origin and dynamic-origin URL sink candidates.
///
/// Bumped to 146 for issue #1146: JS/TS extraction now chains tainted local
/// bindings through up to three same-module hops, so warm caches written
/// before the bump lack the chained `tainted_bindings` records.
///
/// Bumped to 147 for issue #1147: JS/TS extraction now captures deduped
/// statically flattenable callee paths (`callee_uses`) for the
/// `boundaries.calls.forbidden` detector, so warm caches written before the
/// bump would report zero forbidden-call findings.
pub const CACHE_VERSION: u32 = 147;
/// Duplication token cache version. Bump when duplicate tokenization,
/// normalization, or the on-disk token cache schema changes.
pub const DUPES_CACHE_VERSION: u32 = 4;
/// Default maximum cache size (256 MB). Overridable per-project via
/// `cache.maxSizeMb` in the config file or `FALLOW_CACHE_MAX_SIZE` env var.
/// Also used as the hard ceiling on load-time deserialization as a defence
/// against pathological on-disk files.
pub const DEFAULT_CACHE_MAX_SIZE: usize = 256 * 1024 * 1024;
/// Trigger LRU eviction when the serialized cache exceeds 80% of the cap.
/// Basis points (1/100 of a percent) for integer arithmetic without floats.
pub const EVICTION_TRIGGER_BPS: usize = 8000;
/// Evict down to 60% of the cap so subsequent saves leave headroom.
pub const EVICTION_TARGET_BPS: usize = 6000;
/// Promote the eviction log from `debug!` to `info!` when at least 25% of
/// entries are removed in a single save. Default-noise concerns mean
/// small-turnover saves should not be visible without `RUST_LOG=debug`.
pub const EVICTION_SIGNIFICANT_BPS: usize = 2500;
/// Import kind discriminant for `CachedImport`:
/// 0 = Named, 1 = Default, 2 = Namespace, 3 = `SideEffect`.
pub const IMPORT_KIND_NAMED: u8 = 0;
pub const IMPORT_KIND_DEFAULT: u8 = 1;
pub const IMPORT_KIND_NAMESPACE: u8 = 2;
pub const IMPORT_KIND_SIDE_EFFECT: u8 = 3;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
assert_cached_type_size!;
/// Cached data for a single module.
/// Cached namespace-object alias.
/// Cached local type declaration.
/// Cached public signature type reference.
/// Cached suppression directive.
/// Cached unknown suppression kind token (see #449).
/// Cached export data for a single export declaration.
/// Cached import data for a single import declaration.
/// Cached dynamic import data.
/// Cached `require()` call data.
/// Cached re-export data.
/// Cached enum or class member data.
/// Cached dynamic import pattern data (template literals, `import.meta.glob`).