1 # Dependency-Update PR Review
2
3 How to review a PR that bumps dependency versions (Dependabot, Renovate, or a
4 manual dependency bump). The goal is **not** to nag the author for a filled-in
5 PR template or to block on lockfile churn. The goal is to:
6
7 1. Enumerate exactly which packages changed and their version deltas.
8 2. Retrieve each package's release notes / changelog across the bumped range.
9 3. Classify each change: hard breaking change, behavior change, or safe.
10 4. Map anything non-trivial to **how Medusa actually uses the package**, so the
11 summary tells maintainers what to specifically test.
12
13 This produces an informative, low-noise review: usually `initial-approval` with a clear
14 "areas to test" note, and `needs-changes` / `requires-team` only when a real
15 breaking change lands in code Medusa depends on.
16
17 ## When this flow applies
18
19 Treat a PR as a dependency-update PR when **any** of these hold:
20
21 - The author is a dependency bot: `dependabot[bot]` or `renovate[bot]`.
22 - The PR carries the `dependencies` label.
23 - The diff only touches dependency manifests / lockfiles: `package.json`,
24 `yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`.
25
26 For these PRs, **skip template-compliance and massive-change checks** (bots
27 don't fill the template, and lockfile diffs are legitimately huge). Still run
28 the supply-chain security checks (see below).
29
30 ## Step A — Enumerate the changed packages
31
32 Get the version deltas from two sources and reconcile them:
33
34 - **PR body** (`get_pr.sh`): Dependabot/Renovate include a table of
35 `Package | From | To` plus links to each package's release notes / changelog /
36 commits, and the source GitHub repo (e.g. `[ajv](https://github.com/ajv-validator/ajv)`).
37 Grouped security PRs also list `dependency-type` (`direct:production`,
38 `direct:development`, or `indirect`) — note it, direct-production bumps matter
39 most.
40 - **Diff** (`get_pr_diff.sh`): confirm which `package.json` files changed (direct
41 deps of published `@medusajs/*` packages) versus lockfile-only changes
42 (transitive). A dep that changes only in `yarn.lock` is transitive; a dep that
43 changes in a `packages/**/package.json` is a direct dependency of that package.
44
45 Build a working list: `name`, `from`, `to`, direct-or-transitive, and the
46 GitHub repo slug (from the PR body links).
47
48 ## Step B — Retrieve release notes for each package
49
50 Use the read-only helper (GitHub API only):
51
52 ```bash
53 bash scripts/get_dependency_releases.sh <owner/repo> [changelog_path]
54 ```
55
56 - Pass the `owner/repo` extracted from the PR body's package link.
57 - If the PR body's "Changelog" link points at a file (e.g.
58 `.../blob/master/CHANGELOG.md`, `History.md`), pass that filename as the
59 second argument — some packages keep a CHANGELOG file instead of GitHub
60 Releases (e.g. js-yaml, qs, minimatch), and `joi` has no GitHub Releases at
61 all.
62 - Read every entry **between `from` (exclusive) and `to` (inclusive)**. Ignore
63 entries for later/pre-release versions the PR does not adopt (e.g. a `3.0.0`
64 alpha when the bump is `2.0.2 -> 2.2.0`).
65
66 Prioritise by blast radius: **direct:production** deps that Medusa calls
67 directly first, then direct:development, then transitive. For a large grouped
68 PR, it's fine to give the high-blast-radius packages a full read and summarise
69 the low-risk patch bumps briefly.
70
71 If the helper returns nothing for a package (no releases, no changelog path)
72 and the PR body has no usable notes, say so explicitly in the summary rather
73 than guessing — do not invent release-note content.
74
75 ## Step C — Classify each package's changes
76
77 For each package, land on one verdict:
78
79 - **Hard breaking change** — removed/renamed/retyped public API, or a changed
80 default that alters existing call sites. Rare in patch/minor bumps.
81 - **Behavior change** — same API, different runtime behavior (stricter parsing,
82 new default limits, changed output format, new validation that rejects
83 previously-accepted input). These are the ones that bite silently.
84 - **Safe** — pure bug/security/perf fix with no observable behavior change for
85 how Medusa uses it.
86
87 Security fixes frequently **tighten** previously-permissive behavior (e.g.
88 inputs that used to be accepted are now rejected). Treat those as behavior
89 changes worth testing, not as "safe", when Medusa feeds the relevant input.
90
91 ## Step D — Map to Medusa usage
92
93 A change only matters if Medusa exercises the affected surface. For each hard
94 breaking or behavior change, find the call sites and read them with `Read`:
95
96 - Identify which `@medusajs/*` package(s) declare or import the dependency.
97 - Read the actual usage: which functions/options Medusa calls, and whether the
98 changed behavior is on that path.
99 - Where practical, reason about whether Medusa's specific usage is affected. If
100 it clearly is not (e.g. the change is to an env-var parser but Medusa passes
101 the config programmatically), say so and downgrade the concern.
102
103 Known high-traffic call sites (verify they still exist; the tree moves):
104
105 | Dependency | Typical Medusa call site |
106 |-----------|--------------------------|
107 | routing / path matching (e.g. `path-to-regexp`) | `packages/core/framework/src/http/routes-finder.ts` |
108 | query string (`qs`) | `packages/medusa/src/loaders/api.ts` (`parse`), `packages/core/js-sdk/src/client.ts` (`stringify`) |
109 | HTTP logging (`morgan`) | `packages/core/framework/src/http/express-loader.ts` |
110 | uploads (`multer`) | `packages/medusa/src/api/admin/uploads/middlewares.ts`, `.../products/middlewares.ts` |
111 | CSV (`json-2-csv`) | `packages/core/core-flows/src/product/utils/*.ts`, `.../order/steps/export-orders.ts` |
112 | telemetry (`@opentelemetry/*`) | `packages/medusa/src/instrumentation/index.ts`, `packages/deps/` |
113
114 This is a starting map, not a limit — follow the actual imports for whatever
115 package changed.
116
117 ## Step E — Supply-chain security (always)
118
119 Dependency PRs are the classic supply-chain vector. On top of the normal
120 security pass:
121
122 - Verify the bumped packages are the expected, well-known packages — not
123 typosquats or a swap to a different registry/source.
124 - Check for suspicious new lifecycle scripts (`postinstall`, `preinstall`,
125 `prepare`) introduced by the bump.
126 - Confirm lockfile changes are consistent with the `package.json` changes (no
127 unexplained extra packages pulled in).
128
129 A clearly malicious dependency swap (typosquat, exfil script) is a
130 `close-malicious` case, per the main flow.
131
132 ## Step F — Compose the decision
133
134 - **Default outcome for a clean bump: `approve`.** Put the value in the review:
135 a short per-package verdict and, most importantly, a concise **"areas to
136 test"** list derived from the behavior changes mapped to Medusa usage (e.g.
137 "run HTTP integration tests — routing + query parsing behavior changed").
138 - **`needs-changes` (`requires-more`)** only when a hard breaking change or a
139 behavior change genuinely affects a Medusa call site and the PR does not
140 account for it — state the package, the change, the call site, and what to do.
141 - **`requires-team`** when the affected area is sensitive or the correct
142 response needs maintainer judgement (e.g. a telemetry/runtime behavior change
143 self-hosters may rely on, a framework-level routing change).
144 - Keep `blocking_points` concrete and per-package. Do not block on lockfile
145 size, transitive-only patch bumps, or a missing PR template for a bot PR.
146
147 Because the review's `summary` is capped (600 chars) and `blocking_points` are
148 one line each, lead with the highest-blast-radius findings and the test areas;
149 summarise the long tail of safe patch bumps in a single clause.