Skip to content

feat: adding "crashes list" and "crashes get"#187

Merged
gmegidish merged 7 commits intomainfrom
feat-adding-crash-support
Mar 27, 2026
Merged

feat: adding "crashes list" and "crashes get"#187
gmegidish merged 7 commits intomainfrom
feat-adding-crash-support

Conversation

@gmegidish
Copy link
Copy Markdown
Member

No description provided.

Supports listing and fetching .ips crash reports via CLI and JSON-RPC.
iOS real devices use go-ios crashreport service, simulators read from
~/Library/Logs/DiagnosticReports. Android returns unsupported error.
Add path traversal validation to IOSDevice.GetCrashReport, extract
shared ParseCrashReports helper, deduplicate DiagnosticReports path,
and replace magic numbers with named constant in filename parser.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82b0c9a3-f241-4bf8-8835-bdb7f4b72cd8

📥 Commits

Reviewing files that changed from the base of the PR and between c7171f5 and 89e269e.

📒 Files selected for processing (3)
  • devices/android_crash.go
  • devices/android_crash_test.go
  • devices/common.go

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

Adds crash report management end-to-end: a new crashes CLI command with list and get subcommands and corresponding command handlers; a CrashReport type and parsing helpers; new ListCrashReports and GetCrashReport methods on the device interface with implementations for Android, iOS, simulator, and remote devices; Android log parsing/extraction utilities and tests; and two JSON-RPC methods (device.crashes.list, device.crashes.get) with server handlers.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the purpose, implementation approach, and any relevant context for the crash reports feature.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding two new crash report commands ('crashes list' and 'crashes get') to the CLI.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-adding-crash-support

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

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
devices/common.go (1)

20-35: Consider initializing with an empty slice to simplify the nil check.

The nil check at lines 31-33 can be avoided by initializing crashes as an empty slice upfront.

♻️ Optional simplification
 func ParseCrashReports(filenames []string) []CrashReport {
-	var crashes []CrashReport
+	crashes := make([]CrashReport, 0)
 	for _, f := range filenames {
 		if f == "." || f == ".." {
 			continue
 		}
 		report := ParseCrashFilename(f)
 		if report != nil {
 			crashes = append(crashes, *report)
 		}
 	}
-	if crashes == nil {
-		crashes = []CrashReport{}
-	}
 	return crashes
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@devices/common.go` around lines 20 - 35, The ParseCrashReports function
currently declares var crashes []CrashReport and later checks for nil to replace
it with an empty slice; instead initialize crashes to an empty slice up front
(e.g. crashes := []CrashReport{} or make([]CrashReport, 0)) and remove the final
nil-check block; update the function body around the ParseCrashReports variable
initialization and keep the loop that calls ParseCrashFilename and appends
results unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/crashes.go`:
- Around line 48-49: The two subcommands crashesListCmd and crashesGetCmd
redundantly re-register the --device flag (StringVar bound to deviceId) even
though rootCmd already defines it as a PersistentFlag; remove the duplicate
registrations by deleting the two lines that call
crashesListCmd.Flags().StringVar(&deviceId, "device", ...) and
crashesGetCmd.Flags().StringVar(&deviceId, "device", ...) so both commands
simply inherit the persistent --device flag from rootCmd and continue using the
shared deviceId variable.

---

Nitpick comments:
In `@devices/common.go`:
- Around line 20-35: The ParseCrashReports function currently declares var
crashes []CrashReport and later checks for nil to replace it with an empty
slice; instead initialize crashes to an empty slice up front (e.g. crashes :=
[]CrashReport{} or make([]CrashReport, 0)) and remove the final nil-check block;
update the function body around the ParseCrashReports variable initialization
and keep the loop that calls ParseCrashFilename and appends results unchanged.
🪄 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: CHILL

Plan: Pro

Run ID: 4f962c08-09b6-4121-b7fc-16929ddb972d

📥 Commits

Reviewing files that changed from the base of the PR and between 2ebb823 and f26e25e.

📒 Files selected for processing (9)
  • cli/crashes.go
  • commands/crashes.go
  • devices/android.go
  • devices/common.go
  • devices/ios.go
  • devices/remote.go
  • devices/simulator.go
  • server/dispatch.go
  • server/server.go

Comment thread cli/crashes.go
Parses native (tombstone) and java (AndroidRuntime) crashes from
`adb logcat -b crash -d -v year`. IDs use timestamp+pid for stable
lookups. Includes unit tests with embedded sample crash log.
Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@devices/android_crash.go`:
- Around line 187-199: The fallback stack parsing in stackFrameRegex and
extractProcessFromStack is too narrow and misses frames like
MainActivity$1.onClick, $$ExternalSyntheticLambda0.run, and constructors like
<init>; update stackFrameRegex (or replace its use in extractProcessFromStack)
to accept `$`, multiple `$` sequences, and angle-bracket names (or alternatively
parse the parsed.Message by locating the last '.' before the '(' to extract the
owner), keep the existing guard that Tag == "AndroidRuntime" and PID match, and
add a regression test feeding lines with frames such as
"MainActivity$1.onClick(...)", "$$ExternalSyntheticLambda0.run(...)", and
"<init>(...)" to ensure ProcessName is populated.
🪄 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: CHILL

Plan: Pro

Run ID: 8e5ad44a-08e2-4c8f-b308-f50c7168e79a

📥 Commits

Reviewing files that changed from the base of the PR and between f26e25e and f123b5d.

📒 Files selected for processing (3)
  • devices/android.go
  • devices/android_crash.go
  • devices/android_crash_test.go

Comment thread devices/android_crash.go Outdated
…parser

Use regex instead of manual index walking for .ips filename parsing.
Format iOS timestamps as "YYYY-MM-DD HH:MM:SS" to match Android format.
… frames

Replace regex-based stack frame parsing with string splitting that
handles $, $$, and <init> in class names. Add regression tests for
MainActivity$1, $$ExternalSyntheticLambda0, and <init> frames.
@gmegidish gmegidish merged commit 9180bcb into main Mar 27, 2026
6 checks passed
@gmegidish gmegidish deleted the feat-adding-crash-support branch March 27, 2026 13:59
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