Skip to content

fix(device): guard nil scope/deploymentState/target in platform sections#185

Merged
neilmartin83 merged 1 commit into
mainfrom
fix/device-platform-nil-deref
May 7, 2026
Merged

fix(device): guard nil scope/deploymentState/target in platform sections#185
neilmartin83 merged 1 commit into
mainfrom
fix/device-platform-nil-deref

Conversation

@neilmartin83
Copy link
Copy Markdown
Member

@neilmartin83 neilmartin83 commented May 7, 2026

Closes #184

Summary

  • BlueprintDetail.Scope, BlueprintDetail.DeploymentState, and BenchmarkResponseV2.Target are omitempty pointer fields that can be nil when absent from API responses
  • Dereferencing them without a nil check caused a nil pointer panic in fetchDevicePlatformSections goroutines (reported as pro device <serial> crashing in v1.10.0)
  • Add nil guards before each dereference; nil scope/target → blueprint/benchmark excluded (no overlap); nil deploymentState → empty state string

Test plan

  • TestFetchDevicePlatformSections_NilBlueprintScope — blueprint with absent scope field does not panic, is excluded from output
  • TestFetchDevicePlatformSections_NilDeploymentState — blueprint with matching scope but absent deploymentState does not panic, appears with empty state
  • TestFetchDevicePlatformSections_NilBenchmarkTarget — benchmark with absent target field does not panic, is excluded from output
  • make test passes

🤖 Generated with Claude Code

BlueprintDetail.Scope, BlueprintDetail.DeploymentState, and
BenchmarkResponseV2.Target are all omitempty pointer fields that can be
nil when absent from API responses. Dereferencing them without a nil
check caused a panic in fetchDevicePlatformSections goroutines when any
blueprint or benchmark lacked these fields.

Add nil guards before each dereference and cover all three cases with
integration tests against a test httptest server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilmartin83 neilmartin83 merged commit 7d5bd52 into main May 7, 2026
1 check passed
@neilmartin83 neilmartin83 deleted the fix/device-platform-nil-deref branch May 7, 2026 14:07
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.

Memory Error

2 participants