Skip to content

devex(library): no runnable examples — library claim without consumer-facing example code #2709

Closed

Description

@EffortlessSteven

The gap

AGENTS.md declares ripr as both a binary AND a library. The crate-root pub use surface (lib.rs:84-100) is clean and documented with doctests. But there are zero runnable cargo run --example targets — examples/ holds only a sample workspace fixture (for the CLI to run against), not library-usage examples.

Evidence:

  • crates/ripr/examples/sample/ — contains example.diff, src/lib.rs, tests/pricing.rs — a CLI test fixture, not a library example.
  • ls crates/ripr/examples/*.rs — no files (no runnable example targets).
  • lib.rs:39-50 — a doctest shows the quick-start (check_workspace call), but no standalone example shows how to embed ripr in another crate.

Impact

  • [adoption] A consumer wanting to use ripr as a library (not the CLI) has only the doctest to learn from. No example shows: how to parse a diff, call check_workspace, render output programmatically, or use explain_finding/collect_context as a library.
  • [friction] The library API is usable (pub use surface is clean), but the lack of examples makes it hard to evaluate without reading source.

Proposed fix

Add 2-3 runnable examples under crates/ripr/examples/:

  1. examples/check_diff.rs — parse a diff, call check_workspace, print the summary.
  2. examples/render_json.rs — call check_workspace, render the output as JSON using the library's render function.
  3. examples/explain.rs — call explain_finding for a specific probe ID and print the human-readable explanation.

These would also serve as integration tests that the library API is usable from external code.

Verification

  • cargo run --example check_diff works and produces output.
  • cargo run --example render_json produces valid JSON.

Activity

  1. coderabbitai commented on Jul 29, 2026

    @coderabbitai
    🔗 Related PRs

    #2433 - security(agent): make advisory command argv round-trip through Bash (#2347) [open]
    #2467 - docs(cli): fix crate README Quick Start examples that failed verbatim [merged]
    #2524 - api(app): expose _with_config overloads as pub (#2458) [merged]
    #2579 - ux: fix agent repair --help, add repair to agent overview, actionable errors, retire stale goals refs [merged]
    #2583 - feat(cli): suggest the nearest flag and point at help on unknown arguments [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    status/needs-work
    on Jul 29, 2026
  3. EffortlessSteven commented on Jul 29, 2026

    @EffortlessSteven
    MemberAuthor

    Update: this lane was delivered by PR #2749 (#2749), merged at 2026-07-29T17:50:07Z with merge commit 4ab8564 from exact head 0cd723d.

    Acceptance covered: crates/ripr/examples/check_diff.rs, render_json.rs, and explain.rs are runnable consumer examples; the package manifest includes the example sources and package-root-relative library.diff; the examples use stable crate-root APIs and the existing sample fixture.

    Hosted proof: routed Rust wrapper run 30476146569 passed, including required CX43 job 90658275948 and result summarizer 90661385796; test analytics job 90658223808, coverage job 90658224164, source-of-truth job 90658223170, security/cargo-deny jobs 90658223276 and 90658223408, and ub-review job 90658224424 passed. The first hosted attempt caught the intentional new exports missing from policy/public_api.txt; commits 4cb5aca and 0cd723d corrected that exact checker contract before the passing run.

    Claim boundary: this delivers runnable library examples only. No unrelated API redesign, CLI changes, or sample-workspace changes were made. The issue remains open intentionally as delivered work.

  4. added
    status/done-open
    and removed
    status/needs-work
    on Jul 29, 2026
  5. EffortlessSteven commented on Aug 1, 2026

    @EffortlessSteven
    MemberAuthor

    Resolved — three runnable examples now exist: crates/ripr/examples/check_diff.rs, render_json.rs, explain.rs. Each consumes the public ripr::{check_workspace, CheckInput, OutputFormat} API. Verified on main.

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

    status/done-open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions