Skip to content

Add tests for structured Reddit output - #17

Merged
EthanPlant merged 2 commits into
mainfrom
reddit-tests
Jul 29, 2026
Merged

EthanPlant merged 2 commits into
mainfrom
reddit-tests

Conversation

@EthanPlant

@EthanPlant EthanPlant commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds tests for structured Reddit output to avoid regression. Specifically tests cover the following cases:

  • plan --json contains the structured Reddit artifact
  • Rendering link and self posts produce the expected structured behaviour
  • Subreddits are normalized from both /r/ and r/ to prefix-less in the plan/render structure

This PR also introduces a CI check that coverage remains above 70%.

Closes #3

Summary by CodeRabbit

  • Tests
    • Added unit test coverage for Reddit rendering of both link and self-post artifacts.
    • Added validation that generated plans serialize the expected Reddit artifact data.
  • Chores
    • Enhanced CI with automated line-coverage reporting and an enforced minimum 70% threshold.
    • Updated CI security settings to use read-only repository permissions and improved credential handling in Rust toolchain steps.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 33 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 01572665-e2e2-41ca-8965-cc2a5244144a

📥 Commits

Reviewing files that changed from the base of the PR and between 1d8a3d2 and 02b826b.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml
📝 Walkthrough

Walkthrough

Adds tests for structured Reddit link and self-post artifacts, verifies Reddit artifacts in plan JSON, and updates CI permissions, credential persistence, and workspace line-coverage enforcement.

Changes

Reddit artifact coverage

Layer / File(s) Summary
Structured Reddit artifact tests
src/renderers/reddit.rs, src/plan.rs
Adds link and self-post renderer tests and verifies the Reddit artifact is included in serialized plan output.
CI permissions and coverage enforcement
.github/workflows/ci.yaml
Restricts workflow permissions, disables persisted toolchain credentials across jobs, and enforces 70% LLVM-based workspace line coverage.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding tests for structured Reddit output.
Linked Issues check ✅ Passed The changes add tests for Reddit link/self artifacts, plan JSON inclusion, and subreddit normalization as required by issue #3.
Out of Scope Changes check ✅ Passed The CI coverage workflow update is part of the PR objectives, so no clearly unrelated changes stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch reddit-tests

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

@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 @.github/workflows/ci.yaml:
- Around line 40-49: Restrict the coverage job’s permissions by adding job-level
contents: read, and configure the actions/checkout@v4 step with
persist-credentials disabled. Apply these changes only to the coverage job so
cargo llvm-cov and repository tests cannot access a write-capable persisted
token.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 11985f51-712d-4967-b70d-9b69cb3b708a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e31eb6 and f334fa3.

📒 Files selected for processing (3)
  • .github/workflows/ci.yaml
  • src/plan.rs
  • src/renderers/reddit.rs

Comment thread .github/workflows/ci.yaml

@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: 2

🤖 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 @.github/workflows/ci.yaml:
- Line 23: Move persist-credentials: false from the
dtolnay/rust-toolchain@stable configuration to the preceding checkout step at
.github/workflows/ci.yaml lines 23-23, 34-34, and 55-55; remove it from each
Rust toolchain configuration and add it to each corresponding checkout step.
- Around line 43-44: The standalone with mappings in .github/workflows/ci.yaml
at lines 43-44 and 73-74 are invalid workflow steps; remove them and attach
persist-credentials: false directly under the corresponding actions/checkout@v4
step in both the test and build jobs.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5deb5655-c9f2-4dc5-bf13-e85e61e1afd5

📥 Commits

Reviewing files that changed from the base of the PR and between f334fa3 and 1d8a3d2.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

Comment thread .github/workflows/ci.yaml Outdated
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
persist-credentials: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major

Move persist-credentials: false to the checkout steps.

dtolnay/rust-toolchain@stable does not accept this input, so checkout credentials remain persisted. Apply the setting at each checkout site:

  • .github/workflows/ci.yaml#L23-L23: remove it from the Rust toolchain configuration and add it under the preceding checkout step.
  • .github/workflows/ci.yaml#L34-L34: make the same change in the clippy job.
  • .github/workflows/ci.yaml#L55-L55: make the same change in the coverage job.
🧰 Tools
🪛 actionlint (1.7.12)

[error] 23-23: input "persist-credentials" is not defined in action "dtolnay/rust-toolchain@stable". available inputs are "components", "target", "targets", "toolchain"

(action)

📍 Affects 1 file
  • .github/workflows/ci.yaml#L23-L23 (this comment)
  • .github/workflows/ci.yaml#L34-L34
  • .github/workflows/ci.yaml#L55-L55
🤖 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 @.github/workflows/ci.yaml at line 23, Move persist-credentials: false from
the dtolnay/rust-toolchain@stable configuration to the preceding checkout step
at .github/workflows/ci.yaml lines 23-23, 34-34, and 55-55; remove it from each
Rust toolchain configuration and add it to each corresponding checkout step.

Source: Linters/SAST tools

Comment thread .github/workflows/ci.yaml Outdated
@EthanPlant
EthanPlant merged commit aec0772 into main Jul 29, 2026
7 checks passed
@EthanPlant
EthanPlant deleted the reddit-tests branch July 29, 2026 08:51
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.

Add tests for Reddit structured artifacts

1 participant