Skip to content

Commit 5ff9350

Browse files
Claudionor Santosmeta-codesync[bot]
authored andcommitted
Fix gencode indexer to detect unsigned SignedSource files
Summary: The Glean Python gencode indexer's `GENERATED_PATTERN` regex only matched the signed form `generated SignedSource<<HEX>>`, missing ~8,000+ files that have the unsigned placeholder `generated <<SignedSource::TOKEN>>`. These files are legitimately generated but invisible to the `gencode.GenCode` Glean predicate, leaving them unprotected by `DenyIfGleanGeneratedDeadCodeClassifierRule` in the Dead Code Bot classifier pipeline. This was discovered when D99778344 deleted a generated bloks file that should have been blocked. The regex is updated to also match the `<<SignedSource::TOKEN>>` format via an alternation. Files matching this format produce a GenCode fact with no signature (correct — the token is a placeholder, not a real hash). The OCaml/Hack indexer already handled this correctly due to a trailing `.*$` in its regex. Reviewed By: donsbot Differential Revision: D100816292 fbshipit-source-id: fbf48fae587aae613d52106ce38758808b9e32ed
1 parent 1d95b40 commit 5ff9350

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyrefly/lib/report/glean/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl GleanState<'_> {
307307

308308
fn gencode_fact(&mut self) -> Option<gencode::GenCode> {
309309
let generated_pattern = RegexBuilder::new(
310-
r"^.*@(?P<tag>(partially-)?generated)( SignedSource<<(?P<sign>[0-9a-f]+)>>)?$",
310+
r"^.*@(?P<tag>(partially-)?generated)( (?:SignedSource<<(?P<sign>[0-9a-f]+)>>|<<SignedSource::[^>]+>>))?$",
311311
)
312312
.multi_line(true)
313313
.build()

0 commit comments

Comments
 (0)