Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.d/399-behaviour-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
section: behaviour-changes
---

- **A sweep sets version bumps apart only where the definition names its version attributes** (#399). `projections explore --sweep` used to mark any change that only moved version-like strings as `versionOnly`, in any projection. It now does so only for projections whose definition sets `presentation.versionAttributes`. Projections that `projections explore` proposes or `projections init` writes for the built-in dependency and GitHub Actions extractors include the field. To keep dependency or action bumps from counting in a sweep's ranking, add the field to a definition you already adopted, for example `"presentation": {"versionAttributes": ["version", "resolved"]}` for `workspace-dependencies`, as its [page](docs/builtins/extractors/workspace-dependencies.md) shows. Extractions, comparisons and checks are unaffected.
6 changes: 6 additions & 0 deletions changelog.d/399.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
section: authoring
---

- **Sweeps count bot updates for less** (#399). `projections explore --sweep` now marks a change as a bot change when a bot authored it. For a squash or rebase merge, it checks the commit's author or committer; for a merge commit, it checks the merged pull request's author. Bots are `[bot]` accounts, Renovate, Dependabot, and common release-notes and changeset bots. A bot change is still swept, but counts a quarter as much when projections are ranked, so a run of dependency bumps no longer decides a projection's signal. A projection that changed only on bot updates is `quiet` once four other changes have been judged. The summary says how many changes were bot updates (for example "7 of 20 changes were bot updates"), as does the `sweep` agent tool. The JSON adds `botChanges`, each change's `author` and `bot`, each cell's `bot`, and each projection's `bots` count. The Explore view in the viewer ranks the same way.
- **Definitions name the attributes that hold only versions** (#399). A new definition field, `presentation.versionAttributes`, lists the data attributes of entities and relationships that hold only versions, such as `["version", "resolved"]`. When `projections explore --sweep` ranks projections, a change that only moved the versions in those attributes is marked `versionOnly` and doesn't count. In a dependency graph, a lockfile update that only moves, adds or removes transitive packages now counts as version-only too, so it no longer makes a dependency projection rank `rare`. Adding or removing a direct dependency or a workspace member still counts as a change. `projections explore` and `projections init` fill in the field for the built-in dependency extractors (`workspace-dependencies`, `cargo-dependencies`, `nuget-dependencies`, `swift-package-dependencies`, `xcode-modules`) and for `github-actions-jobs`, and a custom projection can opt in. A projection without the field, such as a custom projection whose items carry release versions, counts every changed version, so it is no longer ranked `quiet` for showing versions. The field doesn't affect what a projection extracts, compares or draws. See [Definitions](docs/contracts/definitions.md).
14 changes: 11 additions & 3 deletions docs/agents/create-projection.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,17 @@ adopt.
with `changes`, `steps` and `counts` by kind). Ready rows come best first,
each with its `signal`: `rare` (changed on a quarter of the changes or
fewer, likely the structural ones), `steady`, `noisy` (on four in five or
more), `quiet` (never) or `unknown` (fewer than four changes swept). A
cell marked `versionOnly` changed only version strings (a dependency or
action bump) and doesn't count as a change. On a busy repository, the last 20 merges may span only hours, leaving every
more), `quiet` (never, or only on bot changes) or `unknown` (fewer than
four changes swept). A cell marked `versionOnly` changed only versions (a
dependency or action bump, or a lockfile update that only moved transitive
packages) and doesn't count as a change. Only a projection whose definition
lists its version attributes in `presentation.versionAttributes` can be
version-only; explore fills it in for the built-in dependency and GitHub
Actions projections. A custom projection whose versions are what it shows
leaves it out and always counts them. A
change marked `bot` (Renovate, Dependabot, a release bot; `botChanges`
counts them) counts a quarter as much. Both affect only the ranking, never
extractions, comparisons or pictures. On a busy repository, the last 20 merges may span only hours, leaving every
projection `quiet`. Check the changes' dates and sweep again with
`--since 30d` (a date or duration) to spread `--last N` changes evenly across
that window.
Expand Down
9 changes: 7 additions & 2 deletions docs/agents/explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This file guides you, a coding agent, to find the projections that apply to this
2. Check the CLI: `projections --version`. If it is missing, install it by following https://github.com/githubnext/projections/blob/v0.3.2/docs/agents/install.md.
3. Propose: the `explore` tool, or `projections explore --list --json`, lists the projections whose built-in extractors apply here, each with the files that suggested it and what it `needs` first (configuration, or an install such as the repository's own TypeScript): do that, or leave it out.
4. Sweep: the `sweep` tool, or `projections explore --sweep --json`, runs each one on the last 20 merges into this branch (`--last N` for more). In a busy repository those may span only hours, leaving every projection `quiet`: check the changes’ dates and sweep again with `--since 30d`, which spreads the changes across that window. Projections that run repository code are skipped unless you pass `--trust`; ask the person first.
5. Report, per projection, the pull requests it changed on and how (for example `#12: 3 added, 1 removed`), why it failed when it did (the sweep gives the extractor's own words), and its `signal`, which ranks the sweep: `rare` (only on structural work: worth a look), `noisy` (on nearly every change: likely noise, so don’t recommend it) or `quiet` (never changed here, or only version updates: a dependency or action bump marked `versionOnly`); and the pull requests where several changed. Recommend projections that show something characteristic of this codebase (the picture a long-time maintainer would recognize as theirs), not just the ones that change least. Don’t add `repository-map` or `code-statistics`, which explore no longer proposes: they only show what Projections can draw, not this codebase. To look at one yourself, draw it: `projections compare <before>..<after> -p <id> --png FILE` (a new file outside the repository).
5. Report, per projection, the pull requests it changed on and how (for example `#12: 3 added, 1 removed`), why it failed when it did (the sweep gives the extractor's own words), and its `signal`, which ranks the sweep: `rare` (only on structural work: worth a look), `noisy` (on nearly every change: likely noise, so don’t recommend it) or `quiet` (never changed here, or only on version updates marked `versionOnly`, such as a dependency or action bump, or only on bot updates); and the pull requests where several changed. A change Renovate, Dependabot or a release bot made is marked `bot` and counts a quarter as much in the ranking (the sweep says how many there were). Only projections whose definitions list their version attributes in `presentation.versionAttributes`, which explore fills in for the built-in dependency and GitHub Actions projections, can be `versionOnly`, a lockfile update that only moved transitive packages included; in any other projection a version that changed counts. Neither changes what a projection extracts, compares or draws. Recommend projections that show something characteristic of this codebase (the picture a long-time maintainer would recognize as theirs), not just the ones that change least. Don’t add `repository-map` or `code-statistics`, which explore no longer proposes: they only show what Projections can draw, not this codebase. To look at one yourself, draw it: `projections compare <before>..<after> -p <id> --png FILE` (a new file outside the repository).
6. Ask the person which projections to keep. Never adopt or change CI on your own; a request to set projections up for them is their go-ahead to adopt the few the sweep shows are worth having, so you can show them. Say which you adopted and why.
7. Adopt what they chose: `projections adopt <id>... --dry-run`, then `projections adopt <id>...`. Built-in projections fit standard systems like Actions workflows, database schemas and package dependencies, but rarely cover what’s distinctive about a codebase. Name the characteristic systems they missed (its own registries, extension points, protocols, pipelines) and offer to build projections for them, usually with custom renderers. To build one, run `projections help agents create-projection` and follow what it prints.
8. Show them each adopted projection yourself: `projections view show -p <id> --choice bookmark:<bookmark>` (or the `open_projection` tool) shows it in the Projections viewer on a pull request it changed on (`projections bookmark list` lists the ones adopt saved) and prints the viewer’s URL. When the person asks to “open it in the inspector” or to “show” a projection, they mean this viewer.
Expand Down Expand Up @@ -85,7 +85,12 @@ projections explore --sweep

The sweep reports how often each projection changed across those pull requests
and distinguishes noisy ones (changing on nearly every pull request) from
structural ones (showing up only when a change reshapes something). Pass
structural ones (showing up only when a change reshapes something). Dependency
bumps count for less: a pull request from Renovate, Dependabot or a release bot
counts a quarter as much. In the built-in dependency and GitHub Actions
projections, whose definitions name their version attributes, a change that only
moves versions, transitive lockfile entries included, doesn't count. Neither
changes what a projection extracts or draws, only how the sweep ranks it. Pass
`--json` if you want structured output for scripts or tools.

In a busy repository, the last 20 merges might cover only a few hours, so every
Expand Down
5 changes: 5 additions & 0 deletions docs/builtins/extractors/cargo-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ each crate.
},
"extractor": "cargo-dependencies",
"id": "cargo-dependencies",
"presentation": {
"versionAttributes": [
"version"
]
},
"renderer": "dependencies",
"title": "Cargo dependencies"
}
Expand Down
7 changes: 7 additions & 0 deletions docs/builtins/extractors/github-actions-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ a plain job graph.
"inputs": {
"workflowPath": ".github/workflows/ci.yml"
},
"presentation": {
"versionAttributes": [
"ref",
"uses",
"image"
]
},
"renderer": "github-actions",
"title": "GitHub Actions jobs"
}
Expand Down
5 changes: 5 additions & 0 deletions docs/builtins/extractors/nuget-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ each package.
},
"extractor": "nuget-dependencies",
"id": "nuget-dependencies",
"presentation": {
"versionAttributes": [
"version"
]
},
"renderer": "dependencies",
"title": "NuGet dependencies"
}
Expand Down
7 changes: 7 additions & 0 deletions docs/builtins/extractors/swift-package-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ Your package's targets and products sit on the left as the graph's roots.
{
"extractor": "swift-package-dependencies",
"id": "swift-package-dependencies",
"presentation": {
"versionAttributes": [
"version",
"revision",
"requirement"
]
},
"renderer": "dependencies",
"title": "Swift package dependencies"
}
Expand Down
6 changes: 6 additions & 0 deletions docs/builtins/extractors/workspace-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ packages") to keep the diff focused; toggle **All packages** to expand them.
{
"extractor": "workspace-dependencies",
"id": "workspace-dependencies",
"presentation": {
"versionAttributes": [
"version",
"resolved"
]
},
"renderer": "dependencies",
"title": "Workspace dependencies"
}
Expand Down
8 changes: 8 additions & 0 deletions docs/builtins/extractors/xcode-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ Your targets sit on the left as the graph's roots.
{
"extractor": "xcode-modules",
"id": "xcode-modules",
"presentation": {
"versionAttributes": [
"version",
"revision",
"requirement",
"resolved"
]
},
"renderer": "dependencies",
"title": "Xcode modules"
}
Expand Down
7 changes: 7 additions & 0 deletions docs/builtins/renderers/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ matrix results in more than one run per job (`2 jobs · 7 runs`).
"inputs": {
"workflowPath": ".github/workflows/ci.yml"
},
"presentation": {
"versionAttributes": [
"ref",
"uses",
"image"
]
},
"renderer": "github-actions",
"title": "GitHub Actions jobs"
}
Expand Down
6 changes: 6 additions & 0 deletions docs/builtins/renderers/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ table, where the details panel shows the change and any comparator summary.
{
"extractor": "workspace-dependencies",
"id": "workspace-dependencies",
"presentation": {
"versionAttributes": [
"version",
"resolved"
]
},
"renderer": "dependencies",
"title": "Workspace dependencies"
}
Expand Down
10 changes: 10 additions & 0 deletions docs/contracts/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ still override in the UI:
also set a `noun`, `{"singular": …, "plural": …}` (1–64 characters each), for
the summary bar's counts. A kind's key also names the matching flag wherever a
renderer draws flags. Renderers ignore any kinds they don't draw.
- `versionAttributes` lists the data attributes of entities and relationships
that hold only versions (1–16 names, such as `["version", "resolved"]`).
Viewers ignore it. When `projections explore --sweep` ranks projections, a
change that only moved the versions in these attributes counts as version-only
(`versionOnly`), not as a change, and in a dependency graph so does a lockfile
update that only adds or drops transitive packages. Without it, no change is
version-only. `projections explore` and `projections init` fill it in for the
built-in dependency and GitHub Actions extractors. Leave it out of a
projection whose versions are what it shows, such as one of releases. It never
changes an extraction, a comparison or a picture.

```json
"presentation": {
Expand Down
21 changes: 21 additions & 0 deletions docs/design/onboarding-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ adopted instead.
first-parent commits is compared against its parent. Changes are labeled with
the pull request number from their commit message (`#123`), and GitHub merge
commits use the pull request title from the first line of the message body.
- **Ranking.** A projection's signal (`rare`, `steady`, `noisy`, `quiet`) comes
from how many swept changes it changed on, and two kinds of change count for
less. A change a bot made (`[bot]` accounts, Renovate, Dependabot,
release-notes and changeset bots, listed in `packages/cli/src/sweep/bots.rs`)
counts a quarter as much. Its author decides: a commit's author or committer,
or for a merge commit the merged pull request's author. A bump says little
about the work a repository's people do, but it can still reshape a dependency
graph, so it counts for something. A quarter keeps a run of bumps (7 of 20
changes on a busy repository) from deciding the signal. A change that only
moved versions (`versionOnly`) doesn't count at all, but only in projections
whose definitions name their version attributes
(`presentation.versionAttributes`), and only in those attributes. Explore
writes the field into the built-in dependency and GitHub Actions templates,
and a custom projection can opt in. The definition says it, not the renderer,
because only the extractor's author knows which attributes are just versions.
In a dependency graph, a lockfile update that only added, removed or moved
transitive packages is version-only, while a direct dependency or workspace
member added or removed is not. In a projection without the field, such as a
custom one whose items carry release versions, versions are what it shows and
always count. Neither rule changes an extraction, a comparison or a picture,
only the ranking.
- **One definition.** Every revision is extracted with the working tree's
definition (matching `compare --definition-revision working-tree`), so a sweep
evaluates the projection you are tuning rather than whatever older definition
Expand Down
38 changes: 38 additions & 0 deletions docs/reference/extractors.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ A definition to start from:
{
"extractor": "workspace-dependencies",
"id": "workspace-dependencies",
"presentation": {
"versionAttributes": [
"version",
"resolved"
]
},
"renderer": "dependencies",
"title": "Workspace dependencies"
}
Expand Down Expand Up @@ -254,6 +260,11 @@ A definition to start from:
},
"extractor": "cargo-dependencies",
"id": "cargo-dependencies",
"presentation": {
"versionAttributes": [
"version"
]
},
"renderer": "dependencies",
"title": "Cargo dependencies"
}
Expand All @@ -280,6 +291,13 @@ A definition to start from:
{
"extractor": "swift-package-dependencies",
"id": "swift-package-dependencies",
"presentation": {
"versionAttributes": [
"version",
"revision",
"requirement"
]
},
"renderer": "dependencies",
"title": "Swift package dependencies"
}
Expand All @@ -305,6 +323,14 @@ A definition to start from:
{
"extractor": "xcode-modules",
"id": "xcode-modules",
"presentation": {
"versionAttributes": [
"version",
"revision",
"requirement",
"resolved"
]
},
"renderer": "dependencies",
"title": "Xcode modules"
}
Expand Down Expand Up @@ -338,6 +364,11 @@ A definition to start from:
},
"extractor": "nuget-dependencies",
"id": "nuget-dependencies",
"presentation": {
"versionAttributes": [
"version"
]
},
"renderer": "dependencies",
"title": "NuGet dependencies"
}
Expand Down Expand Up @@ -430,6 +461,13 @@ A definition to start from:
"inputs": {
"workflowPath": ".github/workflows/ci.yml"
},
"presentation": {
"versionAttributes": [
"ref",
"uses",
"image"
]
},
"renderer": "github-actions",
"title": "GitHub Actions jobs"
}
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/schemas/definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Type: map of [`kindPresentation`](#kindpresentation). At most 64 properties.

### `presentation`

Initial host and renderer settings for viewers. Viewers can still change them.
Initial host and renderer settings for viewers, and how a sweep ranks the projection. Viewers can still change them.

| Property | Type | Required | Description |
|---|---|---|---|
Expand All @@ -116,5 +116,6 @@ Initial host and renderer settings for viewers. Viewers can still change them.
| `durationMs` | integer | | Playback duration from before to after at 1× speed, in milliseconds. Omitted, it scales with the number of steps. At least 500. At most 120000. |
| `rendererOptions` | map of string or number or boolean | | Initial values of the renderer's declared controls, keyed by control ID. Hosts ignore unknown IDs and invalid values, with a notice. At most 32 properties. |
| `kinds` | [`kinds`](#kinds) | | |
| `versionAttributes` | array of string | | The data attributes of entities and relationships that hold only versions, such as `["version"]` for a dependency graph. When a sweep (`projections explore --sweep`) ranks projections, a change that only moved the versions in these attributes counts as version-only, not as a change. Omitted, no change is version-only. Extractions, comparisons and pictures ignore it. At least 1 item. At most 16 items. Items are unique. |

No other properties are allowed.
5 changes: 3 additions & 2 deletions docs/runner/agent-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ KB, never raw documents—alongside the same facts in `structuredContent`.
- `sweep` reports how projections behaved across recent changes: for each
projection, how many changes it moved on (N of M), its median change size, the
changes where it showed the most, and the changes where several projections
moved together. `latest` summarizes the most recent sweep (such as one run in
the Explore view).
moved together. It says how many changes were bot updates, which count a
quarter as much when ranking. `latest` summarizes the most recent sweep (such
as one run in the Explore view).
- `check` returns `projections check`'s report with pass, fail, warn, or skip
per check; `render` includes the renderer checks.
- `prepare` runs the environment's prepare steps (`projections prepare`) in the
Expand Down
Loading
Loading