Skip to content

ci: reject unapproved Rust dependency additions #88

Closed

Description

@zackees

Problem

The linker is intentionally dependency-constrained, but CI currently has no guard against an agent adding a new direct, development, build, or transitive Rust crate while implementing logging or other features.

Proposed check

  • Commit a machine-readable baseline of direct manifest dependency edges and resolved crate identities.
  • Add a CI script that compares the current metadata and lockfile graph with that baseline.
  • Allow version changes only when they do not introduce a new crate identity; fail on every newly introduced direct or transitive crate.
  • Protect baseline updates through developer review/ownership so an agent cannot approve its own dependency addition.
  • Keep the check deterministic, offline after dependency metadata is available, and test it with fixtures for direct, dev, build, feature-gated, target-specific, and transitive additions.

Required failure message

New Rust dependency detected: <crate>.
Adding crates to the reld linker requires explicit developer approval.
Agents must not update the dependency baseline to bypass this check.
Use the standard library or an already-approved dependency, or obtain developer approval and update the baseline in the same reviewed change.

Acceptance criteria

  • Pull requests fail when a manifest gains any dependency kind without a reviewed baseline update.
  • Pull requests fail when a lockfile change introduces a new transitive crate identity.
  • Existing dependency version updates that introduce no new identity remain possible.
  • The failure output lists the added dependency and gives the explicit developer-approval guidance above.
  • DESIGN.md and AGENTS.md link to or describe the same policy.

Judgment calls

  • Treat target-specific and feature-gated dependencies as dependencies even when the current host does not select them.
  • Track both direct edges and resolved identities: either view alone misses meaningful graph expansion.
  • Do not let automated agents regenerate the baseline as a routine fix; a developer must explicitly approve the new crate.

Activity

  1. zackees commented on Sep 17, 2026

    @zackees
    CollaboratorAuthor

    Closing: the acceptance list is met and the guard is proven in production use.

    • Baseline of direct edges and resolved identities: ci/dependency-baseline.json records both direct_edges (per-manifest, per-kind, per-target) and resolved_crates (name|version|source|checksum).
    • CI script comparing metadata and lockfile against it: ci/check_dependencies.py, wired into the hygiene job of ci.yml ("Enforce approved Rust dependency graph").
    • Fails on any newly introduced direct or transitive crate: yes. It is in fact stricter than this issue asked, since a version or source substitution also changes the resolved identity and must be re-approved.
    • Baseline updates protected by developer review: the script's own guidance text states that agents must not update the baseline to bypass the check, and that approval must be recorded in the reviewed change.
    • Deterministic and offline: it reads the manifests and Cargo.lock only.
    • Fixtures: ci/tests/test_dependency_policy.py covers the current graph, the CI wiring, every dependency kind and target section, new direct and transitive crates, and same-name version/source substitution.

    Proven twice in real use this week: it blocked windows-sys in reld#144 until the owner approved it explicitly, and it accepted the approved edge only once the baseline was updated in the same PR. It also caught the version-string churn when [workspace.package].version moved off 0.0.0 in reld#148.

    Tracked in the burn-down meta #153 (Wave 0).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions