Skip to content

Cover is_image_media_type_token non-image prefix arm - #238

Open
seonghobae wants to merge 1 commit into
mainfrom
cursor/image-unit-media-type-coverage-aa68
Open

Cover is_image_media_type_token non-image prefix arm#238
seonghobae wants to merge 1 commit into
mainfrom
cursor/image-unit-media-type-coverage-aa68

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Why

Protected-main product coverage is still missing one authored line and one False branch in evidence_core::image_unit:

  • line is_image_media_type_token return false after strip_prefix("image/")
  • branch site on that let Some(subtype) = … else False arm

The public scanner searches data:image/, so that None arm is unreachable through contains_base64_image_data_uri. This PR covers the helper directly. No production behavior change.

What changed

Direct unit test non_image_media_type_token_refuses_non_image_prefix calls the private helper with text/plain, application/json, and text/plain;charset=utf-8. CHANGELOG no longer claims public non-image data URIs cover that line.

Overlap

#241 closes the same gap by rewriting the helper to unwrap_or_default() (plus network_analysis coverage). If #241 lands first, this PR should rebase or close rather than re-introduce the let-else. Prefer this PR when the contract should keep an explicit non-image prefix refusal instead of collapsing it into the empty-subtype path.

#240 must not merge: 0ce16e88 already restored pre-#232 psychometric sources.

Local verification on 7266ec93 (rebased onto c482ccea)

  • Red (earlier head): inverted assertion on text/plain failed.
  • cargo test -p evidence_core --all-features --lib non_image_media_type_token_refuses_non_image_prefix passed.
  • cargo test -p evidence_core --all-features passed.
  • cargo fmt --all --check clean.
  • cargo clippy -p evidence_core --all-features -- -D warnings clean.
  • Crate llvm-cov lines: image_unit.rs DA:152,3; check_coverage.py 312/312.
  • Nightly crate branches: image_unit.rs 30/30; unique fold [151, 9, 151, 22] false=3; 96/96.
  • python3 scripts/validate_documentation.py passed.
  • python3 scripts/check_docstrings.py passed.

Workspace llvm-cov remains the exact-head CI gate. Strix is not product CI. Not full #167 closure.

Open in Web Open in Cursor 

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 30 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 44f6a11b-dac5-43ad-8cdf-9b7d8b5254f4

📥 Commits

Reviewing files that changed from the base of the PR and between c482cce and 7266ec9.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • crates/evidence_core/src/image_unit.rs

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.

Call is_image_media_type_token directly with non-image types so the
strip_prefix("image/") None arm executes. Public data: URI scanning
searches data:image/ and cannot reach that return false.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/image-unit-media-type-coverage-aa68 branch from 1521f1d to 7266ec9 Compare August 25, 2026 10:19
@seonghobae
seonghobae marked this pull request as ready for review August 25, 2026 10:21

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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