feat: adding "crashes list" and "crashes get"#187
Conversation
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.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting WalkthroughAdds crash report management end-to-end: a new 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
crashesas 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
📒 Files selected for processing (9)
cli/crashes.gocommands/crashes.godevices/android.godevices/common.godevices/ios.godevices/remote.godevices/simulator.goserver/dispatch.goserver/server.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.
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
devices/android.godevices/android_crash.godevices/android_crash_test.go
…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.
No description provided.