Skip to content

feat(cli): ripr annotations — binary-first GitHub Actions annotations (item 8b) - #1467

Merged
EffortlessSteven merged 1 commit into
mainfrom
ripr-annotations
Jul 3, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
ripr-annotations

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

What

Ports cargo xtask ripr-annotations into ripr annotations — the second binary-first subcommand (item 8b). Downstream consumers can now generate GitHub Actions annotations without compiling xtask.

Changes (6 files)

  • app/annotations.rs (new): faithful port of xtask annotations.rs (~250 lines). Reads comments.json, emits ::warning lines, writes/checks annotations.txt. repo_root() uses current_dir().
  • CLI wiring: CliCommand::Annotations + parse + dispatch + handler.
  • 3 cli_smoke tests + 2 lib parse tests.

Supports

  • --comments <path> (default: target/ripr/review/comments.json)
  • --out <path> (default: target/ripr/review/annotations.txt)
  • --check (verify freshness)
  • --help

Gates

compile, fmt, clippy, lib tests, smoke tests all green.

Scope

One semantic slice. No other xtask commands ported.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8a43f81c-d38d-4f16-b9a7-87e081eeb646

📥 Commits

Reviewing files that changed from the base of the PR and between a688270 and c038900.

📒 Files selected for processing (7)
  • crates/ripr/src/app.rs
  • crates/ripr/src/app/annotations.rs
  • crates/ripr/src/cli/command.rs
  • crates/ripr/src/cli/commands.rs
  • crates/ripr/src/cli/execute.rs
  • crates/ripr/tests/cli_smoke.rs
  • policy/process_allowlist.txt

Walkthrough

Adds a new ripr annotations CLI subcommand that reads target/ripr/review/comments.json, converts comments into GitHub Actions ::warning annotation lines, and writes or checks target/ripr/review/annotations.txt. Wires the new module and command through CliCommand, execute, and commands.rs, with accompanying unit and smoke tests.

Changes

Annotations Subcommand

Layer / File(s) Summary
Annotations rendering core
crates/ripr/src/app/annotations.rs
New module with run_annotations entry point, option parsing (--comments, --out, --check, --help), JSON comment extraction/validation, ::warning command formatting/escaping, file writing/checking, and unit tests.
CLI wiring
crates/ripr/src/app.rs, crates/ripr/src/cli/command.rs, crates/ripr/src/cli/commands.rs, crates/ripr/src/cli/execute.rs
New annotations module declared; CliCommand::Annotations(Vec<String>) variant added and mapped from "annotations"; commands::annotations delegates to run_annotations; execute dispatches the new variant.
Smoke tests
crates/ripr/tests/cli_smoke.rs
New tests cover --help output, successful run with missing comments.json, and failure on unknown arguments.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as ripr CLI
    participant Exec as execute/commands
    participant Ann as run_annotations
    participant FS as Filesystem

    User->>CLI: ripr annotations [--comments] [--out] [--check]
    CLI->>Exec: CliCommand::Annotations(args)
    Exec->>Ann: run_annotations(args)
    Ann->>Ann: parse_options(args)
    Ann->>FS: read comments.json
    alt file missing
        FS-->>Ann: not found
        Ann->>Ann: mark comments missing
    else file present
        FS-->>Ann: JSON content
        Ann->>Ann: build ::warning lines per comment
    end
    alt --check
        Ann->>FS: read existing annotations.txt
        Ann->>Ann: compare with generated text
    else
        Ann->>FS: write annotations.txt
    end
    Ann-->>Exec: Result
    Exec-->>User: exit status
Loading

Suggested labels: codex

Poem

A rabbit taps commands with care, 🐇
Warnings bloom from JSON air,
::warning:: lines hop out just right,
Comments missing? Still alright!
Annotations saved, tests all pass —
Hop hop hooray, we're built to last! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main change, but it omits most required template sections like boundary, links, proof, rollback, and traceability. Fill out the template sections for swarm boundary, source links, scope classification, proof, rollback, traceability, and policy/impact notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and accurately summarizes the new binary-first annotations subcommand.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ripr-annotations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16ae71f62c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.unwrap();
let bin = std::fs::canonicalize(env!("CARGO_BIN_EXE_ripr"))
.unwrap_or_else(|_| std::path::PathBuf::from(env!("CARGO_BIN_EXE_ripr")));
let output = std::process::Command::new(&bin)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update process policy for the new binary spawn

This new smoke test adds an eleventh Command::new occurrence in crates/ripr/tests/cli_smoke.rs, but policy/process_allowlist.txt still caps that file at 10. I ran cargo xtask check-process-policy, and it fails with crates/ripr/tests/cli_smoke.rs contains Command::new 11 time(s), allowed 10, so the required policy gate will reject this commit. Either route this through an existing helper that avoids a new spawn surface or update the process allowlist count/reason for the annotations smoke and validate with cargo xtask check-process-policy.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/ripr/src/app/annotations.rs`:
- Around line 154-174: The annotation message is being escaped with the same
helper used for workflow-command parameters, which over-escapes the data segment
and turns visible colons into %3A. Update annotation construction in
annotation_from_comment so the message passed after the final :: uses data-only
escaping, while file/title keep parameter escaping via escape_cmd. Refactor
escape_cmd or add a separate helper to distinguish parameter vs. data escaping,
and ensure the suggested_test intent text remains readable in GitHub Actions
output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f8de7ee-ca9c-45ad-b5fc-8078621d7931

📥 Commits

Reviewing files that changed from the base of the PR and between f8571c5 and a688270.

📒 Files selected for processing (6)
  • crates/ripr/src/app.rs
  • crates/ripr/src/app/annotations.rs
  • crates/ripr/src/cli/command.rs
  • crates/ripr/src/cli/commands.rs
  • crates/ripr/src/cli/execute.rs
  • crates/ripr/tests/cli_smoke.rs

Comment on lines +154 to +174
let reason = item
.get("reason")
.and_then(Value::as_str)
.unwrap_or("RIPR review guidance");
let intent = item
.get("suggested_test")
.and_then(|test| test.get("intent"))
.and_then(Value::as_str);
let mut message = reason.to_string();
if let Some(intent) = intent {
message.push_str(" Suggested test: ");
message.push_str(intent);
}
let title = format!("ripr {severity} {kind}");
Ok(format!(
"::warning file={},line={},title={}::{}",
escape_cmd(&path),
line,
escape_cmd(&title),
escape_cmd(&message)
))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

escape_cmd over-escapes the annotation message, corrupting visible output.

GitHub Actions workflow-command escaping differs for "data" (the text after the final ::) versus "parameter" values (file=, line=, title=): data only needs %, \r, \n escaped, while parameters additionally need : and , escaped. escape_cmd (Lines 228-235) escapes :/, unconditionally and is reused for message (the data segment) at Line 174. Since message is built with a literal colon at Line 164 (" Suggested test: "), every annotation with a suggested-test intent will render %3A instead of : in the GitHub Actions UI — this isn't a hypothetical edge case, it's the common path.

🐛 Proposed fix: separate data vs. property escaping
-fn escape_cmd(value: &str) -> String {
+fn escape_property(value: &str) -> String {
     value
         .replace('%', "%25")
         .replace('\r', "%0D")
         .replace('\n', "%0A")
         .replace(',', "%2C")
         .replace(':', "%3A")
 }
+
+fn escape_data(value: &str) -> String {
+    value
+        .replace('%', "%25")
+        .replace('\r', "%0D")
+        .replace('\n', "%0A")
+}
     Ok(format!(
         "::warning file={},line={},title={}::{}",
-        escape_cmd(&path),
+        escape_property(&path),
         line,
-        escape_cmd(&title),
-        escape_cmd(&message)
+        escape_property(&title),
+        escape_data(&message)
     ))

Also worth a unit test on annotation_from_comment/escaping directly — the current 2 tests only cover option parsing and wouldn't have caught this.

Also applies to: 228-235

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/ripr/src/app/annotations.rs` around lines 154 - 174, The annotation
message is being escaped with the same helper used for workflow-command
parameters, which over-escapes the data segment and turns visible colons into
%3A. Update annotation construction in annotation_from_comment so the message
passed after the final :: uses data-only escaping, while file/title keep
parameter escaping via escape_cmd. Refactor escape_cmd or add a separate helper
to distinguish parameter vs. data escaping, and ensure the suggested_test intent
text remains readable in GitHub Actions output.

… (item 8b)

Ports `cargo xtask ripr-annotations` into `ripr annotations` so downstream
consumers can generate GitHub Actions `::warning` annotations without
compiling their own xtask. This is the second binary-first subcommand (after
`ripr pr-summary`).

The command reads `target/ripr/review/comments.json` and emits annotation-safe
placement-mode warning lines to `target/ripr/review/annotations.txt`. Supports
`--comments <path>`, `--out <path>`, `--check`, `--help`. Missing comments.json
is an advisory no-op (writes empty annotations.txt, exits cleanly).

Implementation: ports xtask/src/reports/annotations.rs into
crates/ripr/src/app/annotations.rs, adapting repo_root() from
CARGO_MANIFEST_DIR to current_dir() (binary shouldn't assume build-system
location).

CLI wiring: CliCommand::Annotations + parse arm + execute dispatch + handler.

Tests: 3 cli_smoke tests (help, missing-comments writes empty, unknown-arg
fails) + 2 lib parse tests. All green.

Gates: compile, fmt, clippy, lib tests, smoke tests all green.

Scope: one semantic slice (second binary-first subcommand). No other xtask
commands ported, no downstream workflow switch.
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.28910% with 107 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/app/annotations.rs 47.80% 107 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EffortlessSteven
EffortlessSteven merged commit 54ee4c0 into main Jul 3, 2026
19 of 20 checks passed
@EffortlessSteven
EffortlessSteven deleted the ripr-annotations branch July 3, 2026 17:21
EffortlessSteven added a commit that referenced this pull request Jul 4, 2026
Ports `cargo xtask ripr-pr` into `ripr pr-evidence` so downstream consumers
can generate PR evidence packets without compiling their own xtask. This is
the third binary-first subcommand (after pr-summary #1460 and annotations
#1467).

The command:
- Verifies git revisions (--base/--head)
- Runs ripr check directly via check_workspace() (no cargo subprocess)
- Composes the check output into a PR evidence packet with changed_files,
  summary, and findings count
- Writes target/ripr/pr/repo-exposure.{json,md}
- Supports --root, --base, --head, --check, --help
- Error packets surface named issues (bad revisions, check failure) rather
  than silently producing misleading clean packets

Implementation: ports xtask/src/reports/pr_evidence.rs into
crates/ripr/src/app/pr_evidence.rs. Key difference from xtask: calls
crate::check_workspace() directly instead of shelling out through cargo.

CLI wiring: CliCommand::PrEvidence + parse + dispatch + handler.

Tests: 3 cli_smoke tests (help, missing-artifact graceful, unknown-arg fails).

Gates: compile, fmt, clippy, lib tests, smoke tests, no-panic, static-language,
goldens (zero drift), process-policy all green.

Scope: one semantic slice (third binary-first subcommand).
EffortlessSteven added a commit that referenced this pull request Jul 4, 2026
…d) (#1468)

Ports `cargo xtask ripr-pr` into `ripr pr-evidence` so downstream consumers
can generate PR evidence packets without compiling their own xtask. This is
the third binary-first subcommand (after pr-summary #1460 and annotations
#1467).

The command:
- Verifies git revisions (--base/--head)
- Runs ripr check directly via check_workspace() (no cargo subprocess)
- Composes the check output into a PR evidence packet with changed_files,
  summary, and findings count
- Writes target/ripr/pr/repo-exposure.{json,md}
- Supports --root, --base, --head, --check, --help
- Error packets surface named issues (bad revisions, check failure) rather
  than silently producing misleading clean packets

Implementation: ports xtask/src/reports/pr_evidence.rs into
crates/ripr/src/app/pr_evidence.rs. Key difference from xtask: calls
crate::check_workspace() directly instead of shelling out through cargo.

CLI wiring: CliCommand::PrEvidence + parse + dispatch + handler.

Tests: 3 cli_smoke tests (help, missing-artifact graceful, unknown-arg fails).

Gates: compile, fmt, clippy, lib tests, smoke tests, no-panic, static-language,
goldens (zero drift), process-policy all green.

Scope: one semantic slice (third binary-first subcommand).
EffortlessSteven added a commit that referenced this pull request Aug 30, 2026
…headline entries (#3591)

* docs(changelog): consolidate Unreleased headings and add the missing headline entries

The Unreleased section carried duplicate Added/Fixed headings and
omitted the release's headline features. Consolidate to one Added /
Changed / Fixed sequence (0.10.0 convention) and add verified entries
for:

- ripr mcp --stdio server and startup routing (#3088, #3525, #3587)
- ripr rerun changed-test targeted analysis (#1520)
- the binary-first evidence/gate surface: ripr plus, pr-summary,
  pr-evidence, annotations, impacted-evidence (#1476/#1460/#1468/#1467/#1474)
- --suppression-policy and --exception-policy policy flags (#1475/#1477)
- the cache management surface: status, clear, atomic writes
  (#1822/#2865/#2738)
- the LSP capability wave: pull diagnostics, listActionableItems,
  transport bounds (#1669/#3012/#2185)
- analysis performance: per-file fact cache, rayon parallel parse,
  artifact reuse (#2039/#2322/#2250)

Every cited PR verified MERGED via the GitHub API. Also corrects the
stale 0.10.0 release-date line (crates.io publication 2026-06-15;
GitHub release draft remains unfinalized).

* docs(changelog): drop the superseded duplicate MCP entry (#3591 review)

The pre-existing Added block already carried an MCP entry from the
#3525 merge; keep the expanded consolidated entry (startup routing,
verbose handling, review fixes) and remove the older shorter one.
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.

1 participant