Commit 2510e55
committed
fix: address review on the folded-migration round
Six findings from Copilot + Cursor on commit df89604, all valid
per the sub-agent eval pass. Three structural fixes, three doc/code
hygiene.
Code:
- workflows.ts: split proxyActivities into separate configs for sync
and derive. Sync keeps the 5-min heartbeatTimeout (matches the
per-1000-record heartbeat in the sync activity). Derive has no
heartbeatTimeout — it's a single tight loop with no per-page
heartbeat, and sharing the sync config would silently cancel the
activity at Tier 2 scale (~600-700k packages). 1-hour
startToCloseTimeout gives generous headroom over the ~5-min observed
derive duration. Cursor caught this (CRITICAL).
- parseOsvRecord.ts: when an OSV record provides only an enumerated
versions[] list (no ranges[]), convert each version into a degenerate
range {introduced: v, fixed: null, last_affected: v} so isInRange
matches exact-version vulnerability. Previously we kept the
advisory_package row but wrote zero ranges, silently breaking the
version-in-range check downstream. Copilot caught it (HIGH). Two new
tests cover the conversion and the ranges-wins-over-versions case
when both are present.
- upsertAdvisory.ts: scope the per-pass DELETE to rows where
range_raw IS NULL AND unaffected_raw IS NULL. The deps.dev BQ ingest
worker (future) will write rows with only the raw text columns
populated; OSV's unconditional DELETE would wipe them on every
pass. Copilot caught it (HIGH).
Cleanup:
- types.ts: drop the unused OsvConfig interface. Leftover from the
pre-Temporal standalone-bin shape; the activity reads env on demand
via requirePositiveInt in activities.ts. Misleading + dead code.
- V1779710880: rewrite the comment above advisory_affected_ranges.
The previous comment said the structured boundary columns "are
populated by a future range-parsing workstream" — that's no longer
true; OSV ingest writes them now. The new comment captures the
OSV-vs-deps.dev split and the DELETE-filter contract that keeps the
two sources from clobbering each other.
- PR body: rewritten to describe the single-consolidated-migration
shape instead of the three-additive-migrations shape the earlier
draft assumed.
All 72 unit tests pass. Schema reapplied locally from a fresh
volume to confirm correctness.
Signed-off-by: Joan Reyero <joan@reyero.io>1 parent df89604 commit 2510e55
6 files changed
Lines changed: 91 additions & 17 deletions
File tree
- backend/src/osspckgs/migrations
- services/apps/packages_worker/src/osv
- __tests__
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
618 | 624 | | |
619 | | - | |
620 | | - | |
621 | 625 | | |
622 | 626 | | |
623 | 627 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 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 | + | |
205 | 245 | | |
206 | 246 | | |
207 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
119 | 129 | | |
120 | 130 | | |
121 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | 1 | | |
13 | 2 | | |
14 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
90 | 100 | | |
91 | 101 | | |
92 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
| |||
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
| |||
0 commit comments