Skip to content

fix(review): reject results when candidate input is unreadable or denied by filesystem - #1939

Open
decode2 wants to merge 2 commits into
Gentleman-Programming:mainfrom
decode2:fix/issue-1867-reject-unreadable-candidate-results
Open

fix(review): reject results when candidate input is unreadable or denied by filesystem#1939
decode2 wants to merge 2 commits into
Gentleman-Programming:mainfrom
decode2:fix/issue-1867-reject-unreadable-candidate-results

Conversation

@decode2

@decode2 decode2 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #1867

🏷️ PR Type

  • type:bug — Bug fix (non-breaking change that fixes an issue)

📝 Summary

Reviewer processes running under permission-restricted sandboxes (such as Windows sandbox environments) could report file/diff read access denials in their evidence strings while returning 0 findings. The admission check allowed these results as valid clean approvals because evidenceReportsUnavailableInspection did not recognize filesystem permission denial phrases.

This PR expands evidenceReportsUnavailableInspection to recognize filesystem permission denial patterns and ensures unreadable candidate inputs are rejected as incomplete admission failures.

📂 Changes

File / Area What Changed
internal/reviewtransaction/artifact_admission.go Expand evidenceReportsUnavailableInspection phrase detection to cover filesystem access denials
internal/reviewtransaction/artifact_admission_test.go Add unit test cases for filesystem access denial evidence

🧪 Test Plan

  • Unit tests pass (go test ./internal/reviewtransaction/...)
  • Go format passes (go run ./internal/gofmtcheck)

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • PR stays within 400 changed lines
  • I have added the appropriate type:* label to this PR
  • Unit tests pass (go test ./...)
  • My commits follow Conventional Commits format
  • My commits do not include Co-Authored-By trailers

Summary by CodeRabbit

  • Bug Fixes
    • Improved artifact admission validation to recognize more inspection access failure messages, including “cannot read” and permission/denied-style responses.
    • Artifacts are now reliably marked as incomplete when required inspection evidence can’t be accessed or read.
  • Tests
    • Expanded automated coverage with additional scenarios simulating evidence access denial to ensure the correct admission outcome is returned.

…ied by filesystem

Reviewer sessions executing in constrained or permission-denied sandboxes
were reporting read denials in evidence text without failing admission,
allowing false-clean zero-finding approvals.

- Expand evidenceReportsUnavailableInspection to detect filesystem access denial phrases
- Add unit tests verifying read access denials in evidence are rejected as incomplete

Closes Gentleman-Programming#1867
@decode2 decode2 added the type:bug Bug fix label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f91af96a-fcd4-4142-b556-ac863328460c

📥 Commits

Reviewing files that changed from the base of the PR and between b20c0ca and 4c5e6af.

📒 Files selected for processing (1)
  • internal/reviewtransaction/artifact_admission_test.go

📝 Walkthrough

Walkthrough

Changes

Artifact admission validation

Layer / File(s) Summary
Inspection access denial handling
internal/reviewtransaction/artifact_admission.go, internal/reviewtransaction/artifact_admission_test.go
Additional read and filesystem denial phrases are classified as unavailable inspection, with table-driven tests expecting ArtifactAdmissionIncomplete for the new variants.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: alan-thegentleman

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR covers unreadable-input rejection, but most #1867 requirements like typed recoverable failures and retry recovery are not shown. Implement the remaining #1867 requirements, including typed recoverable failures, deterministic recovery, managed-capture validation, and schema/receipt handling.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: rejecting unreadable or filesystem-denied candidate results.
Out of Scope Changes check ✅ Passed The code and tests stay focused on unreadable-input admission behavior and its denial-message variants.
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

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.

@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 `@internal/reviewtransaction/artifact_admission_test.go`:
- Around line 80-87: Expand the table-driven cases in the artifact admission
tests around the existing “read denied by filesystem” and “file access denied”
entries to cover every newly supported denial phrase, including “read denied,”
“cannot read manifest,” and “filesystem access denied.” Keep each variant
asserting empty Findings and ArtifactAdmissionIncomplete, or consolidate
production matching to a documented canonical set with tests for each supported
form.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c4b98ea4-d94e-4d4b-ae33-4ae0c2de7d28

📥 Commits

Reviewing files that changed from the base of the PR and between ffbcc12 and b20c0ca.

📒 Files selected for processing (2)
  • internal/reviewtransaction/artifact_admission.go
  • internal/reviewtransaction/artifact_admission_test.go

Comment on lines +80 to +87
{name: "read denied by filesystem", mutate: func(r *ArtifactAdmissionRequest) {
r.Result.Findings = []Finding{}
r.Result.Evidence = []string{"The immutable diff and manifest were denied by its filesystem environment."}
}, decision: ArtifactAdmissionIncomplete},
{name: "file access denied", mutate: func(r *ArtifactAdmissionRequest) {
r.Result.Findings = []Finding{}
r.Result.Evidence = []string{"Cannot read diff: file access denied."}
}, decision: ArtifactAdmissionIncomplete},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the remaining newly supported denial phrases.

These tests validate two variants, but the production change adds several independent phrases (read denied, cannot read manifest, filesystem access denied, and others). Add table entries for each phrase, or consolidate the matcher into a smaller canonical set, so future regressions cannot silently remove coverage for individual variants.

🤖 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 `@internal/reviewtransaction/artifact_admission_test.go` around lines 80 - 87,
Expand the table-driven cases in the artifact admission tests around the
existing “read denied by filesystem” and “file access denied” entries to cover
every newly supported denial phrase, including “read denied,” “cannot read
manifest,” and “filesystem access denied.” Keep each variant asserting empty
Findings and ArtifactAdmissionIncomplete, or consolidate production matching to
a documented canonical set with tests for each supported form.

@dnlrsls dnlrsls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This patch correctly covers the added unreadable/denied evidence phrases, but it closes #1867 while implementing only part of the approved scope. #1867 also requires atomic truncated-capture handling, typed recovery, and integration coverage. Please either relink this narrow patch to a separately approved issue or implement and test the remaining #1867 acceptance criteria. Also complete the missing required PR-template entries.

@dnlrsls dnlrsls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: linked issue #1867 is open with status:needs-design, so its implementation approach is not approved. Please complete the required design and obtain status:approved before implementation review resumes.

@Alan-TheGentleman

Copy link
Copy Markdown
Contributor

Please stop implementation churn until #1867 has an approved design. The current patch covers unreadable-input phrases, but the issue also requires atomic truncated capture, typed recovery, and deterministic handling of mutable test and configuration state. Define that complete failure and recovery contract in the issue, regain status:approved, then update this PR to the agreed scope and run fresh CI.

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

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(review): reject results when candidate input is unreadable or capture is truncated

3 participants