Skip to content

Sweep ranking: discount bot updates; lockfile-only transitive churn is version-only - #399

Open
agorischek wants to merge 7 commits into
mainfrom
sweep/bot-and-version-only-ranking
Open

agorischek wants to merge 7 commits into
mainfrom
sweep/bot-and-version-only-ranking

Conversation

@agorischek

@agorischek agorischek commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

explore --sweep ranks candidates (rare, steady, noisy, quiet) by how often they change across recent pull requests. Dependency-bump noise skewed that ranking in both directions. This PR changes how two kinds of change count in the ranking. Extractions, comparisons and pictures stay the same for every change, and the docs now say so.

B. Bot changes count a quarter

  • A change counts as a bot change when a bot authored it. For a squash or rebase merge (a plain commit), the sweep checks the commit's author or committer. For a merge commit, it checks the pull request author (the merged branch's head commit), not whoever merged it.
  • Bots are [bot] accounts (name or email) plus Renovate, Dependabot and the common release-notes and changeset bots (release-please, release-drafter, semantic-release, changesets, GoReleaser). The list is kept in one place, BOT_AUTHORS in packages/cli/src/sweep/bots.rs, and the docs point there.
  • Bot changes are still swept and extracted. In the ranking, each one counts as a quarter of a change (BOT_SHARE = 4 in signal.rs), both when it changed and when it didn't. Once four non-bot changes have been judged, a candidate that changed only on bot changes ranks quiet.
  • Why a quarter: a bump says little about the work a repository's people do, but not nothing, because it can still reshape a dependency graph. At a quarter, the 7 Renovate bumps in a 20-change window weigh as much as about 2 other changes. The signal then rests on the changes people made, while a candidate that changes on every change, bots included, still ranks noisy.
  • The text summary and the sweep agent tool report, for example, 7 of 20 changes were bot updates, and each bot change in a row's list is marked , bot update. The JSON adds botChanges, each change's author and bot, each cell's bot, and each projection row's bots. The Inspector's Explore view (stats.ts) ranks the same way.

C. Version-only only where the definition names its version attributes, including lockfile-only transitive churn

  • New definition field: presentation.versionAttributes. It is a list of 1 to 16 data attribute names on entities and relationships that hold only versions. A change is versionOnly (not counted when ranking) only when every modified item differs only in the versions inside those attributes. A label that equals one of those values is also masked, as with a dependency's declared range. Projections without the field are never version-only, whatever their renderer. The Rust validator and the definition JSON Schema both accept it, and viewers ignore it.
  • Why a list rather than one attribute: the built-in extractors keep versions in more than one attribute. workspace-dependencies uses version and resolved (a declaration's range and what it resolved to). Swift uses version, revision and requirement. github-actions-jobs uses ref, uses and image. With a single name, some of today's bumps would start counting.
  • Explore fills it in. VERSION_ATTRIBUTES in packages/extractors/catalog/src/lib.rs writes the field into the templates of the built-in dependency extractors (workspace-dependencies, cargo-dependencies, nuget-dependencies, swift-package-dependencies, xcode-modules) and of github-actions-jobs. explore, adopt and init therefore all write it. init switching an existing definition to a built-in extractor replaces only versionAttributes and keeps the definition's other presentation settings. The table lives in the catalog rather than in the extractor SDK's Descriptor, because a new Descriptor field would touch all 30 extractors and break sibling PRs that add extractors (for example python-dependencies: a built-in extractor for Python projects #386). An extractor added later opts in with one line in that table.
  • Mastodon case. In a dependency graph, adding or removing packages installed only transitively, and the edges between them, also counts as version-only. A graph counts as a dependency graph when it has roots: workspace members, projects, target frameworks, targets or products. Adding or removing a direct dependency (one a root declares) or a root, or changing a root other than in its versions, is a real change. An extraction without roots never treats additions or removals as version-only.
  • Phoenix case. A custom projection whose items carry versions leaves the field out, so every change counts and it no longer ranks quiet.

Behaviour change

On main, any projection could be versionOnly, because any version-like string was masked. Now only projections with the field can be. A definition adopted before this change, such as an existing workspace-dependencies definition, has no field, so its bumps count until the field is added. Each built-in's page shows the field. A separate behaviour-changes changelog fragment (changelog.d/399-behaviour-changes.md) explains this.

Remaining notes for review

  • A workspace member's own version bump (a release commit) is still version-only in a dependency projection, as it was before this PR.
  • The field is under presentation, as requested. That block is otherwise viewer settings, so the schema and contract docs now say versionAttributes affects only how a sweep ranks a projection.
  • Schemas for the CLI's JSON output #395 (CLI JSON schemas in packages/schemas) hasn't merged. This PR updates the definition schema and the runner API's versionOnly and bot descriptions. When Schemas for the CLI's JSON output #395 lands, its explore --sweep schema needs botChanges, the per-change author and bot, the per-cell bot, and the per-row bots.

Evidence

Run on Linux with the CLI crate built in debug:

  • npm run tools -- check --fast: passed (lint, cargo check, format, the file-complexity standard and the repository rules). cargo clippy -p projections-cli -p projections-extractor-catalog --all-targets --locked -- -D warnings: passed.

  • cargo test -p projections-cli --lib: 233 passed. The new and updated tests cover:

    • bot detection, the quarter weighting and the bot note
    • action bumps with ref, uses and image
    • lockfile-only transitive churn: version-only in a graph with roots, but not without roots, and a direct dependency or workspace member added is a change
    • only_projections_that_name_their_version_attributes_are_version_only: without the field, even a pure version bump counts, whatever the renderer
    • init replacing only versionAttributes and keeping the other presentation settings

    check::tests::a_custom_comparator_scenario_names_its_file_by_its_repository_path failed only because the rules comparator Wasm isn't built in this environment.

  • cargo test -p projections-cli --test authoring: 28 passed. init_adds_a_custom_renderer_and_comparator_to_an_existing_projection failed for the same missing rules comparator. The end-to-end sweep test, a_sweep_discounts_bot_updates_and_lockfile_churn_only_in_dependency_projections, does three things:

    • takes the workspace-dependencies definition that explore --list proposes and checks it carries versionAttributes: ["version", "resolved"]
    • sweeps it next to a phoenix-style custom releases projection without the field
    • checks that the Renovate lockfile bump and the release are versionOnly only in the proposed projection, which ranks quiet, while releases counts both and isn't quiet
  • cargo test -p projections-cli --test native presentation_defaults: passed. The field passes through, and empty, non-list, duplicate and blank lists are rejected. cargo test -p projections-cli --test extractors catalog_advertises: passed; every template, the new field included, validates.

  • Inspector stats.ts: I ran the new client.test.mjs assertions directly against the source. I didn't run the Inspector workspace's own suite, which needs every renderer built.

  • Generated pages:

    • npm run generate --workspace @githubnext/projections-schemas regenerated definition/v0.json and runner-api.json.
    • node tools/scripts/reference-docs.mjs --only agents,extractors,schemas regenerated the explore and create-projection briefs, docs/reference/extractors.md and docs/reference/schemas/definition.md.
    • The builtins generator needs every renderer built, which this environment's disk couldn't hold. I updated the eight affected generated "definition" blocks under docs/builtins/ from projections extractor list --json, using the generator's own JSON.stringify(template, null, 2) formatting. CI's generated-files check confirms them.
    • node --test tools/scripts/reference-docs/agents.test.mjs: passed. npm run tools -- changelog: passed.

Docs changed:

  • docs/contracts/definitions.md (the new field)
  • docs/runner/commands.md
  • docs/setup/quick-start.md (and through it the explore brief, docs/agents/explore.md)
  • packages/cli/templates/SKILL.md (and docs/agents/create-projection.md)
  • docs/runner/agent-tools.md
  • docs/design/onboarding-loop.md (a Ranking bullet under Sweeps)
  • the generated builtin and reference pages above

Each says that neither rule changes extractions, comparisons or pictures, only the ranking.

Scope: this changes only how explore --sweep and the sweep tool rank and summarize, plus the new definition field that explore writes. It doesn't touch the sweep's timeouts, streaming, grouping or adopt's reuse of a sweep.

  • Documentation that this change affects is updated, and generated reference
    pages are regenerated (npm run docs:generate).
  • Fixes include a regression test.
  • A changelog fragment at changelog.d/<this PR's number>.md describes what
    users will notice, or the PR has the no changelog label (see
    changelog.d/README.md).
  • No credentials, private source or machine-specific paths are included.

agorischek and others added 4 commits December 4, 2026 21:51
…s version-only

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…n their own modules

Keeps sweep/mod.rs and sweep/run.rs within the file complexity standard.
A merge commit's committer (whoever merged it) never makes it a bot change.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… agent briefs; describe ranking in the onboarding design

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

GitHub Actions image-only bumps incorrectly affect ranking because masking misses the extractor’s container and Docker-step image paths; Swift manifest-only range bumps likewise count as signal because the requirement attribute is not masked. Separately, adding or removing an unused direct Swift dependency is incorrectly suppressed as version-only because the check does not use declaration/transitive metadata to distinguish direct dependencies from lockfile churn.

3 open issues
What changed in this PR

This PR reduces dependency-update noise in Projections’ sweep rankings without changing extractions, comparisons, or rendered output.

Changes:

  • Weights bot-authored changes at one quarter across CLI and Inspector rankings.
  • Restricts version-only classification to dependency-like projections and includes transitive lockfile churn.
  • Updates summaries, schemas, regression tests, and documentation.
File Description
tools/​scripts/​reference-docs/​agents.mjs Updates generated agent guidance.
packages/​schemas/​src/​runner/​api.ts Defines bot metadata and version-only semantics.
packages/​schemas/​internal/​runner-api.json Updates generated API schema.
packages/​host/​inspector/​test/​client.test.mjs Tests weighted rankings and summaries.
packages/​host/​inspector/​src/​sweep/​stats.ts Applies bot weighting in Inspector.
packages/​cli/​tests/​authoring.rs Adds end-to-end sweep regressions.
packages/​cli/​templates/​SKILL.md Explains revised ranking behavior.
packages/​cli/​src/​tools/​tests.rs Tests bot-count summaries.
packages/​cli/​src/​tools/​read/​sweep.rs Reports bot counts in agent output.
packages/​cli/​src/​sweep/​window.rs Uses relocated log parsing.
packages/​cli/​src/​sweep/​versions.rs Classifies version-only dependency changes.
packages/​cli/​src/​sweep/​tests.rs Tests classification and bot weighting.
packages/​cli/​src/​sweep/​signal.rs Implements weighted ranking and advice.
packages/​cli/​src/​sweep/​run.rs Annotates cells with bot and version-only flags.
packages/​cli/​src/​sweep/​mod.rs Extends change metadata and text summaries.
packages/​cli/​src/​sweep/​log.rs Parses history with author metadata.
packages/​cli/​src/​sweep/​bots.rs Centralizes bot detection and reporting.
packages/​cli/​src/​service/​sweeps.rs Initializes metadata for explicit revision pairs.
packages/​cli/​src/​onboard/​tests.rs Updates change fixtures.
packages/​cli/​src/​commands/​explore.rs Exposes bot counts in JSON.
docs/​setup/​quick-start.md Explains dependency-update weighting.
docs/​runner/​commands.md Documents ranking rules and output fields.
docs/​runner/​agent-tools.md Documents bot summaries.
docs/​design/​onboarding-loop.md Describes sweep ranking design.
docs/​agents/​explore.md Refreshes generated exploration guidance.
docs/​agents/​create-projection.md Refreshes generated authoring guidance.
changelog.d/​399.md Records user-visible ranking changes.

Review effort: Balanced

Comment thread packages/cli/src/sweep/versions.rs Outdated
fn attributes(self) -> &'static [&'static str] {
match self {
// A package's version, a declaration's range and the version it resolved to, a pinned revision.
Self::Dependencies => &["version", "resolved", "revision"],
Comment thread packages/cli/src/sweep/versions.rs Outdated
// A package's version, a declaration's range and the version it resolved to, a pinned revision.
Self::Dependencies => &["version", "resolved", "revision"],
// An action's ref, a reusable workflow's `@ref`, an image's tag or digest.
Self::Actions => &["ref", "uses", "image"],
/// that no root declares.
fn transitive(document: &Value, collection: Option<&str>, item: &Value) -> bool {
match collection {
Some("entities") => !root(item),
agorischek and others added 3 commits December 4, 2026 22:58
…s, not its renderer

A projection is version-only only in the data attributes its definition names;
without the field, no change is. Explore writes the field into the built-in
dependency and GitHub Actions templates.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…n's; its other presentation settings stay

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@agorischek agorischek mentioned this pull request Dec 4, 2026
4 tasks done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants