walkdiff 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.0
4
+
5
+ - **Review from VS Code:** a VS Code extension, in `packages/vscode`, reviews PRs with the local app. It isn't on the Marketplace yet; [its README](packages/vscode/README.md) says how to run it from the repository.
6
+ - **Starting a review:** of the current branch's PR, of a PR waiting for your review, or of a pasted link. If the app isn't running, the extension offers to start it in a terminal.
7
+ - **Reading it:** the Walkdiff view lists your reviews with their progress. A finished review opens onto its changed files and their findings, and each file opens in VS Code's diff editor without checking the PR out.
8
+ - **Commenting and posting:** comments on any line the diff shows stay pending until you submit the review as Comment, Approve or Request changes. The PR's threads appear on their lines, where you can reply, resolve and reopen. As on the report page, nothing is posted once the PR has new commits.
9
+ - **An API for editor plugins and scripts:** while `walkdiff app` runs, it writes `app.json` to its data directory, readable by you only, with its address and API key, and removes it when it stops. [docs/app-api.md](docs/app-api.md) describes it and each endpoint, and what changes the API's version.
10
+ - **Report and files:** a review's report as JSON, and any file the PR changes at its merge base or head.
11
+ - **Finding PRs:** the open PR for a branch, from the repository's git remote, and the open PRs waiting for your review on that host, including requests to your teams on GitHub. Remotes over HTTPS and SSH work for github.com, gitlab.com and the hosts in `WALKDIFF_TRUSTED_GITHUB_HOSTS` and `WALKDIFF_TRUSTED_GITLAB_HOSTS`.
12
+ - **GitHub Action:** `navasvarela/walkdiff@v0` now follows each release of 0.x, and the README starts with a quick start for the Action.
13
+
14
+ ## 0.13.0
15
+
16
+ - **The Risks tab is a one-page overview:**
17
+ - **Headline:** the security summary, plus what else needs a decision or is background.
18
+ - **Index:** a row per kind of finding (supply chain, breaking change, docs drift and so on), grouped into security, decisions and background, with counts coloured by the worst finding. It stays in view as you scroll.
19
+ - **Sections:** one per kind, with what to check and its findings, ordered by kind and then severity. The checks that ran and didn't come last.
20
+ - **Links:** each section has a link of its own, such as `#risks/supplyChain`, and the review brief's new **At a glance** card links straight to them.
21
+ - **Breaking changes in API schemas:** each OpenAPI, GraphQL or protobuf file a PR changes or deletes is compared with its version at the merge base. A change that breaks clients already running is high; one that only breaks code built against the schema is medium.
22
+ - **OpenAPI 3 and Swagger 2:** removed operations; new or newly required parameters and request fields; enum values clients can no longer send; and response fields that were removed, retyped, or are no longer always there.
23
+ - **GraphQL:** removed types, fields, arguments and enum values; changed types; output fields that can now be null; and inputs that became required.
24
+ - **Protobuf:** removed RPCs, messages and enums; changed types; field numbers that changed; and fields removed or renamed without reserving their number.
25
+ - **Split schemas:** GraphQL and protobuf files are read together, so a type that moves to another file is compared with itself there. A schema that can't be parsed is listed under "Not checked".
26
+ - **Docs drift:** a new check flags docs a PR leaves out of date.
27
+ - **Stale mentions:** Markdown, reStructuredText or AsciiDoc that still mentions a command-line option, environment variable, config key, function or type the PR removes or renames. Changelogs and upgrade guides, and lines that also name the replacement, are left alone.
28
+ - **Doc comments:** a comment that still describes a parameter its changed function dropped, or leaves out one it gained.
29
+ - **Hotspots:** a new check notes changed files that had a change reverted in the last 90 days, keep needing fixes, or change far more often than most, from their commits in the year before the PR. A hotspot ranks higher on the review path and says why.
30
+ - **Where the history comes from:** git for local reviews. For hosted PRs, GitHub's or GitLab's API, which reads only the changed files' paths; on GitHub this needs a token.
31
+ - **Settings:** it can be turned off, and the list of what leaves your machine names it.
32
+ - **Mixed-concern PRs:** a new Scope check asks whether a PR should be split.
33
+ - **Tidy-ups and upgrades:** behaviour changes buried among 5 or more files that are only reformatted, renamed or moved, or among 10 or more upgraded packages.
34
+ - **Unrelated packages:** behaviour changes in workspace packages that neither depend on nor use each other.
35
+
3
36
  ## 0.12.0
4
37
 
5
38
  - **Attack surface:** new HTTP endpoints are noted where a PR adds them, in Express, Koa, Fastify, Hono, NestJS, FastAPI, Flask, Django, Spring, JAX-RS, ASP.NET, Go's `net/http`, gin, echo, chi, axum, actix and Rocket. A new endpoint without the auth its neighbours in the file declare is flagged, as is code that turns auth or CSRF checks off, such as `[AllowAnonymous]`, `permitAll()` or `@csrf_exempt`. A route moved within the PR isn't counted as new.
package/README.md CHANGED
@@ -5,16 +5,72 @@
5
5
  A review companion for GitHub pull requests and GitLab merge requests. `walkdiff review <url>` fetches the
6
6
  change, analyzes it, and serves a local report.
7
7
 
8
- Status: early release, [v0.12.0](CHANGELOG.md). To run it on your team's PRs, see the [pilot guide](docs/pilot.md).
8
+ Status: early release, [v0.14.0](CHANGELOG.md). To run it on your team's PRs, see the [pilot guide](docs/pilot.md).
9
9
 
10
10
  **Documentation:** [website](https://navasvarela.github.io/walkdiff/), [getting started](docs/getting-started.md), [configuration](docs/configuration.md), [troubleshooting](docs/troubleshooting.md), [security policy](SECURITY.md).
11
11
 
12
+ ## Quick start: the GitHub Action
13
+
14
+ Add `.github/workflows/walkdiff.yml` to your repository:
15
+
16
+ ```yaml
17
+ name: Walkdiff
18
+ on: pull_request
19
+ permissions:
20
+ contents: read
21
+ pull-requests: write
22
+ jobs:
23
+ report:
24
+ runs-on: ubuntu-latest
25
+ # Walkdiff only reports; it should never block a merge.
26
+ continue-on-error: true
27
+ steps:
28
+ - uses: navasvarela/walkdiff@v0.14.0
29
+ ```
30
+
31
+ Each PR then gets one comment, updated on every push. It has a summary of security findings, counts, the top findings linked into the diff, and a link to the full report, which is kept as an artifact of the workflow run. Opening the report needs a GitHub account with access to the repository.
32
+
33
+ - **No checkout needed.** The Action reads the PR through GitHub's API and never runs its code, so it's safe on PRs from forks. Those get a read-only token, so instead of a comment, the summary goes on the workflow run's page.
34
+ - **Pinning:** `@v0.14.0` stays on this release. `@v0` follows every 0.x release, and a full commit SHA gives the strongest guarantee.
35
+ - **Permissions:** `pull-requests: write` is only for the comment.
36
+
37
+ | Input | Default | What it does |
38
+ | --- | --- | --- |
39
+ | `token` | `github.token` | Reads the repository and comments on the PR |
40
+ | `ai` | `"false"` | `"true"` sends the changed code to an AI provider for a review |
41
+ | `anthropic-api-key` | | Anthropic API key, for AI review with Anthropic |
42
+ | `ai-provider` | `anthropic` | `anthropic`, or `openai-compatible` for OpenAI and other services |
43
+ | `ai-model` | | The model to use; required with `openai-compatible` |
44
+ | `ai-base-url` | | With `openai-compatible`, the provider's address |
45
+ | `ai-api-key` | | With `openai-compatible`, the provider's API key |
46
+ | `coverage-file` | | An LCOV or Cobertura report from an earlier step, to show whether changed lines ran in tests |
47
+ | `retention-days` | `14` | Days to keep the report artifact |
48
+ | `package` | this release | Which Walkdiff to install, as an npm package spec |
49
+
50
+ The `report-url` output links to the report artifact. For AI review, give the step these inputs, and see [AI review](#ai-review) for what's sent:
51
+
52
+ ```yaml
53
+ - uses: navasvarela/walkdiff@v0.14.0
54
+ with:
55
+ ai: "true"
56
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
57
+ ```
58
+
59
+ On GitLab, see the [pilot guide](docs/pilot.md#gitlab). To review a PR on your own machine instead, see [Usage](#usage).
60
+
12
61
  ## What the report shows
13
62
 
14
63
  The report opens on a brief: what to check, how many changes need attention, and where to start. A review path then takes you through the changes that matter most, one at a time, with why each one is there, its code, callers and tests. You can mark changes as reviewed and leave comments, and everything else stays one link away under **All changes**. In the app, you can then post your review to the PR and join the discussion.
15
64
 
16
65
  All changes has five tabs, including **Conversation** in the app: **Changes** (files, the map of each file and the changed units), **Impact** (where other code uses what changed), **Risks** (each check's result and every finding) and **AI review**. Each tab shows a count, and its name in the URL lets you link to it, as in `#risks`.
17
66
 
67
+ **Risks** is a one-page overview:
68
+ - **Headline:** the security summary, with how many findings need a decision or are background.
69
+ - **Index:** a row per kind of finding (supply chain, breaking change, docs drift and so on), grouped into security, decisions and background, with counts coloured by the worst finding. It stays in view as you scroll.
70
+ - **Sections:** one per kind of finding, with what to check and its findings, then the checks that ran and didn't.
71
+
72
+ Each section has a link of its own, as in `#risks/supplyChain`, and the review brief's **At a glance** card links straight to them.
73
+
18
74
  - **Changed units, not hunks.** For Rust, TypeScript/JavaScript, Python, Go, Java, Kotlin, C#, C and C++, each changed function,
19
75
  method, type, class or macro appears once, whole, before and after, with edited words marked. A class shows only the
20
76
  code it owns; its methods are separate cards. In JavaScript and TypeScript tests, each `describe`,
@@ -93,7 +149,7 @@ npx walkdiff app
93
149
 
94
150
  This runs a local page at `http://127.0.0.1:4317/`. Paste a pull request or merge request link to add it; analyses run one at a time, and the list shows each review's status and counts, and flags medium or high severity security findings. Refresh re-runs a review after new commits. The list is kept in SQLite under `~/.local/share/walkdiff`, so it survives restarts. If `GITHUB_TOKEN` is not set, the app asks the GitHub CLI for its login on that PR's host.
95
151
 
96
- The server listens only on your machine, refuses requests for any other host name, and its API needs a key that is created each run.
152
+ The server listens only on your machine, refuses requests for any other host name, and its API needs a key that is created each run. The [VS Code extension](packages/vscode/README.md) uses it to review PRs from the editor, and other plugins and scripts can use the same API; [docs/app-api.md](docs/app-api.md) describes how to find the running app and call it.
97
153
 
98
154
  ## Private repositories
99
155
 
@@ -117,7 +173,7 @@ Tokens and code stay on your machine, apart from the host itself, package names
117
173
 
118
174
  ## In CI
119
175
 
120
- The GitHub Action (`navasvarela/walkdiff@v0.12.0`) and the GitLab template (`ci/gitlab-ci.yml`) generate the report for each PR, keep it as a job artifact, and post one summary comment that is updated on each push. The [pilot guide](docs/pilot.md) has the setup. Locally, `walkdiff review` also works without a URL inside a CI job, and `walkdiff comment --report <dir> --report-url <url>` posts the summary.
176
+ The GitHub Action (`navasvarela/walkdiff@v0.14.0`, or `@v0` to follow every 0.x release) and the GitLab template (`ci/gitlab-ci.yml`) generate the report for each PR, keep it as a job artifact, and post one summary comment that is updated on each push. The [pilot guide](docs/pilot.md) has the setup. Locally, `walkdiff review` also works without a URL inside a CI job, and `walkdiff comment --report <dir> --report-url <url>` posts the summary.
121
177
 
122
178
  ## AI review
123
179
 
@@ -246,6 +302,20 @@ functions under a framework's decorator are skipped, as the decorator can change
246
302
  name that's still available after its definition went, through an alias, a `__getattr__` shim or a move to
247
303
  another file. A removal that untouched code still uses shows up as a broken reference instead.
248
304
 
305
+ **API schemas:** each OpenAPI, GraphQL or protobuf file the PR changes or deletes is compared with its version at
306
+ the merge base. A new schema file can't break anyone, so it isn't compared on its own. What breaks clients
307
+ already running, such as a removed operation, is high, and what breaks code built against the schema is medium.
308
+
309
+ | Format | Flags |
310
+ | --- | --- |
311
+ | OpenAPI 3 and Swagger 2 (YAML or JSON) | Removed operations; new or newly required parameters, request bodies and request fields; enum values clients can no longer send; removed or retyped response fields, and ones that are no longer always there. Bodies are compared at their top level, following `$ref`s and `allOf` within the file |
312
+ | GraphQL (`.graphql`, `.graphqls`, `.gql`) | Removed types, fields, arguments and enum values; retyped fields and arguments; output fields that can now be null; arguments and input fields that became required, or are new and required |
313
+ | Protobuf (`.proto`) | Removed RPCs, messages and enums; retyped RPCs and fields; fields and enum values whose number changed; fields and enum values removed or renamed without reserving their number |
314
+
315
+ GraphQL and protobuf schemas are often split across files, so the PR's files of each are read as one. A type
316
+ that moves to another file is compared with itself there. A schema Walkdiff can't parse is listed under "Not
317
+ checked" with the file and why.
318
+
249
319
  **Database migrations:** dropped or renamed tables and columns and changed column types, in raw SQL (including
250
320
  Prisma, Goose, dbmate and Flyway files), Alembic, Django, Rails, Knex, Sequelize and TypeORM. Only the added lines
251
321
  that run on the way up count, so rollbacks aren't flagged. Neither are temporary tables, or names the
@@ -261,9 +331,68 @@ mentions an unusual name. Django's `AlterField` isn't checked, since it mostly c
261
331
  - A key removed from a config file (`config/*.yml`, `settings.toml`, `appsettings.json`, `*.example.json` and
262
332
  similar) while code still reads it. Ordinary words like `name` are left out, as matches on them mean little.
263
333
 
264
- Not covered yet: public struct fields and interface members, new required trait methods, re-exports removed from an entry point
334
+ Not covered yet: GraphQL union members and directives, OpenAPI `$ref`s to other files, and nested body
335
+ fields beyond the top level; public struct fields and interface members, new required trait methods, re-exports removed from an entry point
265
336
  without the definition changing, and inputs of a GitHub Action's `action.yml`.
266
337
 
338
+ ## Docs drift
339
+
340
+ Walkdiff flags docs a PR leaves out of date, under its own "Docs drift" category. These are review signals,
341
+ not security findings.
342
+
343
+ - **Names the docs still use:** a command-line option (a quoted `--flag` in code), an environment variable, a
344
+ config key, or a function or type that the PR removes or renames, while Markdown, reStructuredText or AsciiDoc
345
+ files at head still mention it.
346
+ - **Severity:** options and settings are medium, because whoever follows the docs gets an error or a setting
347
+ that silently does nothing. Code names are low.
348
+ - **What's skipped:** a name that code at head still uses anywhere doesn't count, since it may be defined
349
+ elsewhere. Neither do changelogs, release notes, upgrade and migration guides, or a line that names the
350
+ replacement too, which is describing the rename.
351
+ - **Doc comments that no longer match:** a function the PR changes whose doc comment still describes a parameter
352
+ it removed, or doesn't describe one it added while describing the others. This reads JSDoc, Javadoc and KDoc
353
+ `@param`, Python's `Args:`, NumPy `Parameters` and `:param:` sections, and Rust's `# Arguments`.
354
+
355
+ Only what the PR changes is compared, so docs that were already out of date aren't flagged.
356
+
357
+ ## Hotspots
358
+
359
+ Walkdiff notes changed files whose recent history says to look harder. It reads each file's commits in the
360
+ year before the merge base, so the PR's own commits never count:
361
+
362
+ | Note | When |
363
+ | --- | --- |
364
+ | Had a change reverted recently | A commit starting with "Revert" touched it in the 90 days before the PR |
365
+ | Often fixed | At least 5 commits that fixed something touched it, a quarter or more of its changes. Fixes are commits with "fix", "bug", "hotfix", "regression", "crash" or "broken" in their subject, but not ones about typos, lint, formatting, docs, tests, CI, builds or dependencies |
366
+ | Changes often | 30 or more commits touched it |
367
+
368
+ These go under the "Hotspot" category. They're context, not questions: they don't count as security and the
369
+ review plan doesn't list them, but a hotspot file ranks higher on the review path and says why.
370
+
371
+ **Where the history comes from:**
372
+ - **`--local` reviews and checkouts with history:** the repository itself.
373
+ - **Hosted PRs and MRs:** these fetch only the PR's own commits, so Walkdiff asks the host. On GitHub that's one
374
+ GraphQL query for up to 20 files, which needs a token. On GitLab it's one request per file.
375
+
376
+ Offline, without a GitHub token, or in a shallow clone, the Risks tab lists Hotspots under "Not checked". It
377
+ looks at up to 60 changed code files, and can be turned off in the app's Settings.
378
+
379
+ ## Scope
380
+
381
+ Walkdiff flags PRs that mix concerns, under the "Scope" category, as a question for the review plan: should it be
382
+ split? Each changed file is sorted by what it carries:
383
+
384
+ - **Behaviour:** code units added, removed, or edited beyond formatting and comments.
385
+ - **Tidy-up:** code that's only reformatted, re-commented, renamed or moved.
386
+ - **Dependencies:** lockfiles.
387
+ - **Neither:** tests, docs, CI and config, which travel with the change they belong to.
388
+
389
+ It flags two things:
390
+
391
+ | Note | When |
392
+ | --- | --- |
393
+ | Mixes a tidy-up or upgrades with behaviour changes | Alongside behaviour changes, 5 or more tidy-up files, or 10 or more packages the lockfiles already had moved to new versions. New packages don't count, since they come with the code that uses them |
394
+ | Changes packages that don't use each other | Behaviour changes in two or more workspace packages (folders with their own `package.json`, `Cargo.toml`, `go.mod` and so on), each with at least 3 changed units, where neither declares a dependency on the other, names something the other changes, or calls it |
395
+
267
396
  ## Code quality
268
397
 
269
398
  Walkdiff flags poor implementations and bad practice in the code a PR adds, under the "Code quality"