Skip to content

ADFA-2597 | Filter expected cache read errors from Sentry#856

Merged
jatezzz merged 3 commits intostagefrom
fix/ADFA-2597-filter-sentry-cache-read-errors
Jan 27, 2026
Merged

ADFA-2597 | Filter expected cache read errors from Sentry#856
jatezzz merged 3 commits intostagefrom
fix/ADFA-2597-filter-sentry-cache-read-errors

Conversation

@jatezzz
Copy link
Collaborator

@jatezzz jatezzz commented Jan 19, 2026

Description

This PR filters out expected FileNotFoundException and ErrnoException (ENOENT) errors from Sentry reporting during project initialization. These errors often occur due to race conditions or when users manually delete cache files, creating unnecessary noise in the issue tracker.

Details

Logs are still printed to the local console for debugging, and the UI still notifies the user of the cache read failure, but the exception is no longer sent to Sentry if the cause is a missing file.

Screen.Recording.2026-01-19.at.3.56.01.PM.mov

Ticket

ADFA-2597

Observation

This change is purely internal to the error reporting logic; there are no visual changes for the user.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough
  • Change: Suppress Sentry reporting for expected cache-read "file not found" errors during project initialization.
    • Treat FileNotFoundException, NoSuchFileException, and ErrnoException with errno == ENOENT as expected by adding a private Throwable?.isFileNotFound extension property.
    • When reading the Gradle build cache in onProjectInitialized(), skip Sentry.captureException for these cases while preserving local console logging and UI notifications.
  • Implementation details:
    • Added imports: ErrnoException, OsConstants, NoSuchFileException.
    • Introduced private Throwable?.isFileNotFound and used it to conditionally skip Sentry reporting.
    • No public API changes; internal-only modification. Lines changed: +11 / -1.
  • Risks / best-practice notes:
    • Risk (Low–Medium): legitimate, unexpected "file not found" errors could be suppressed in Sentry if the check is reused outside the intended cache-read flow. Confirm suppression is limited to project-initialization cache reads.
    • Observability impact: fewer Sentry events may hide recurring issues. Consider adding sampled reporting, a debug/opt-in flag, or a local metric/counter to track suppressed occurrences.
    • Recommendation: document the suppression at the detection site, limit the scope of the check, and have reviewers validate the logic and placement.

Walkthrough

Added a nullable Throwable extension to detect file-not-found errors and updated ProjectHandlerActivity.onProjectInitialized to skip reporting expected file-not-found failures (FileNotFoundException, NoSuchFileException, or ErrnoException with ENOENT) to Sentry while still handling other errors.

Changes

Cohort / File(s) Change Summary
Error reporting filter
app/src/main/java/com/itsaky/androidide/activities/editor/ProjectHandlerActivity.kt
Added imports for ErrnoException, OsConstants, and NoSuchFileException. Introduced Throwable?.isFileNotFound extension detecting FileNotFoundException, NoSuchFileException, or ErrnoException with OsConstants.ENOENT. Updated onProjectInitialized to skip Sentry.captureException for these expected errors while preserving existing failure handling for other non-null errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • hal-eisen-adfa
  • itsaky-adfa

Poem

🐰 I sniffed the missing-file breeze,
A quiet hop past logs and trees.
ENOENT blinked, no siren sound,
I left the trace untouched on ground.
Hopped on, code tidy, bugs unwound. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: filtering expected cache read errors from Sentry reporting during project initialization.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose, impact, and rationale for filtering file-not-found errors from Sentry.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@jatezzz jatezzz force-pushed the fix/ADFA-2597-filter-sentry-cache-read-errors branch from afb007c to bfdc7c4 Compare January 20, 2026 13:11
@jatezzz jatezzz force-pushed the fix/ADFA-2597-filter-sentry-cache-read-errors branch 4 times, most recently from a3da47f to 202040d Compare January 22, 2026 13:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/ProjectHandlerActivity.kt`:
- Around line 22-23: Add the missing import for
java.nio.file.NoSuchFileException so the isFileNotFound property can reference
NoSuchFileException without a compile error; specifically, add an import for
NoSuchFileException to the top of the file alongside ErrnoException and
OsConstants so usages in ProjectHandlerActivity.isFileNotFound resolve.

@jatezzz jatezzz force-pushed the fix/ADFA-2597-filter-sentry-cache-read-errors branch 7 times, most recently from 4ac9868 to 37c4813 Compare January 26, 2026 15:49
…ent FileNotFoundException and ENOENT during project initialization from reporting to Sentry
Added `isFileNotFound` extension to handle legacy IO, NIO, and Errno exceptions.
@jatezzz jatezzz force-pushed the fix/ADFA-2597-filter-sentry-cache-read-errors branch from 76f5a8a to 14c7338 Compare January 27, 2026 13:12
@jatezzz jatezzz merged commit 6f180fd into stage Jan 27, 2026
2 checks passed
@jatezzz jatezzz deleted the fix/ADFA-2597-filter-sentry-cache-read-errors branch January 27, 2026 13:18
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