Skip to content

Pointers v2 package test#1208

Open
marcell-vida wants to merge 3 commits into
masterfrom
pointers-v2-test
Open

Pointers v2 package test#1208
marcell-vida wants to merge 3 commits into
masterfrom
pointers-v2-test

Conversation

@marcell-vida

Copy link
Copy Markdown
Contributor

Checklist

Version

Requires a MAJOR/MINOR/PATCH version update

Context

Changes

Investigation details

Decisions

@bitrise

bitrise Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrated pointers package from v1 to v2 across multiple files. Updated imports from github.com/bitrise-io/go-utils/pointers to github.com/bitrise-io/go-utils/v2/pointers and replaced utility function calls with manual nil checks where needed.

Walkthrough

File Summary
bitrise/util.go, models/models_methods.go Updated imports to use v2 pointers package
cli/build_run_result_collector.go, cli/run.go, cli/run_util.go, cli/trigger.go, cli/trigger_check.go Migrated to v2 pointers package and replaced StringWithDefault/BoolWithDefault calls with manual nil checks
Test and generated files Updated test files and dependencies (go.mod, go.sum, vendor)

@bitrise bitrise Bot 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 is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

Comment thread cli/run_util.go
Comment on lines 1197 to 1218
func prepareAnalyticsStepInfo(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel) analytics.StepInfo {
stepTitle := ""
if stepInfoPtr.Step.Title != nil {
stepTitle = *stepInfoPtr.Step.Title
}
stepSource := ""
if stepInfoPtr.Step.SourceCodeURL != nil {
stepSource = *stepInfoPtr.Step.SourceCodeURL
}
skippable := false
if stepInfoPtr.Step.IsSkippable != nil {
skippable = *stepInfoPtr.Step.IsSkippable
}

return analytics.StepInfo{
StepID: stepInfoPtr.ID,
StepTitle: pointers.StringWithDefault(step.Title, ""),
StepTitle: stepTitle,
StepVersion: stepInfoPtr.Version,
StepSource: pointers.StringWithDefault(step.SourceCodeURL, ""),
Skippable: pointers.BoolWithDefault(step.IsSkippable, false),
StepSource: stepSource,
Skippable: skippable,
}
}

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.

🐛 Bug

The function now uses stepInfoPtr.Step fields instead of the step parameter. However, stepInfoPtr.Step.IsSkippable is never populated in the activateStep function, so it will always be nil and default to false. This causes incorrect analytics data. Additionally, stepTitle should use the step parameter (the merged step) not stepInfoPtr.Step.Title for consistency with the original implementation.

🔄 Suggestion:

Suggested change
func prepareAnalyticsStepInfo(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel) analytics.StepInfo {
stepTitle := ""
if stepInfoPtr.Step.Title != nil {
stepTitle = *stepInfoPtr.Step.Title
}
stepSource := ""
if stepInfoPtr.Step.SourceCodeURL != nil {
stepSource = *stepInfoPtr.Step.SourceCodeURL
}
skippable := false
if stepInfoPtr.Step.IsSkippable != nil {
skippable = *stepInfoPtr.Step.IsSkippable
}
return analytics.StepInfo{
StepID: stepInfoPtr.ID,
StepTitle: pointers.StringWithDefault(step.Title, ""),
StepTitle: stepTitle,
StepVersion: stepInfoPtr.Version,
StepSource: pointers.StringWithDefault(step.SourceCodeURL, ""),
Skippable: pointers.BoolWithDefault(step.IsSkippable, false),
StepSource: stepSource,
Skippable: skippable,
}
}
func prepareAnalyticsStepInfo(step stepmanModels.StepModel, stepInfoPtr stepmanModels.StepInfoModel) analytics.StepInfo {
stepTitle := ""
if step.Title != nil {
stepTitle = *step.Title
}
stepSource := ""
if step.SourceCodeURL != nil {
stepSource = *step.SourceCodeURL
}
skippable := false
if step.IsSkippable != nil {
skippable = *step.IsSkippable
}
return analytics.StepInfo{
StepID: stepInfoPtr.ID,
StepTitle: stepTitle,
StepVersion: stepInfoPtr.Version,
StepSource: stepSource,
Skippable: skippable,
}
}

@bitrise bitrise Bot 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 is an AI-generated review. Please review it carefully.

Actionable comments posted: 1

Comment thread cli/run_util.go Outdated
Comment on lines +1199 to +1209
if stepInfoPtr.Step.Title != nil {
stepTitle = *step.Title
}
stepSource := ""
if stepInfoPtr.Step.SourceCodeURL != nil {
stepSource = *step.SourceCodeURL
}
skippable := false
if stepInfoPtr.Step.IsSkippable != nil {
skippable = *step.IsSkippable
}

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.

🐛 Bug

The nil checks are performed on stepInfoPtr.Step fields, but the dereferences are on step fields. This causes a mismatch: if stepInfoPtr.Step.Title is not nil but step.Title is nil, this will cause a nil pointer dereference. The dereferences should use stepInfoPtr.Step fields instead of step fields.

🔄 Suggestion:

Suggested change
if stepInfoPtr.Step.Title != nil {
stepTitle = *step.Title
}
stepSource := ""
if stepInfoPtr.Step.SourceCodeURL != nil {
stepSource = *step.SourceCodeURL
}
skippable := false
if stepInfoPtr.Step.IsSkippable != nil {
skippable = *step.IsSkippable
}
if stepInfoPtr.Step.Title != nil {
stepTitle = *stepInfoPtr.Step.Title
}
stepSource := ""
if stepInfoPtr.Step.SourceCodeURL != nil {
stepSource = *stepInfoPtr.Step.SourceCodeURL
}
skippable := false
if stepInfoPtr.Step.IsSkippable != nil {
skippable = *stepInfoPtr.Step.IsSkippable
}

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