ronantakizawa/codereview-bench huggingface dataset:
Repository: google/go-github
File: github/codespaces_machines_test.go (Go)

Code before:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/google/go-cmp/cmp"
)

func TestCodespacesService_ListMachineTypesForRepository(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/owner/repo/codespaces/machines", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")

		fmt.Fprint(w, `{
			"total_count": 1,
			"machines": [
				{
					"name": "standardLinux",
					"display_name": "4 cores, 8 GB RAM, 64 GB storage",
					"operating_system": "linux",
					"storage_in_bytes": 68719476736,
					"memory_in_bytes": 17179869184,
					"cpus": 4,
					"prebuild_availability": "ready"
				}
			]
		}`)
	})

	ctx := t.Context()
	opts := &ListMachinesOptions{
		Ref:      Ptr("main"),
		Location: Ptr("WestUs2"),
		ClientIP: Ptr("1.2.3.4"),
	}

	got, _, err := client.Codespaces.ListMachineTypesForRepository(
		ctx,

Review comment (suggestion):
Please check query parameters:
```suggestion
		testFormValues(t, r, values{
			"ref":       "main",
			"location":  "WestUs2",
			"client_ip": "1.2.3.4",
		})

```

Code after:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/google/go-cmp/cmp"
)

func TestCodespacesService_ListRepositoryMachineTypes(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/owner/repo/codespaces/machines", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testFormValues(t, r, values{
			"ref":       "main",
			"location":  "WestUs2",
			"client_ip": "1.2.3.4",
		})
		fmt.Fprint(w, `{
			"total_count": 1,
			"machines": [
				{
					"name": "standardLinux",
					"display_name": "4 cores, 8 GB RAM, 64 GB storage",
					"operating_system": "linux",
					"storage_in_bytes": 68719476736,
					"memory_in_bytes": 17179869184,
					"cpus": 4,
					"prebuild_availability": "ready"
				}
			]
		}`)
	})

	ctx := t.Context()
	opts := &ListRepoMachineTypesOptions{
		Ref:      Ptr("main"),
		Location: Ptr("WestUs2"),
		ClientIP: Ptr("1.2.3.4"),
Repository: google/go-github
File: github/strings_benchmark_test.go (Go)

Code before:
// Copyright 2013 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"testing"
)

type BenchmarkStruct struct {
	Name    string
	Age     int
	Active  bool
	Score   float32
	Rank    float64
	Tags    []string
	Pointer *int
}

func BenchmarkStringify(b *testing.B) {
	val := 42
	s := &BenchmarkStruct{
		Name:    "benchmark",
		Age:     30,

Review comment (security):
```suggestion
// Copyright 2026 The go-github AUTHORS. All rights reserved.
```

Code after:
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"testing"
)

type BenchmarkStruct struct {
	Name    string
	Age     int
	Active  bool
	Score   float32
	Rank    float64
	Tags    []string
	Pointer *int
}

func BenchmarkStringify(b *testing.B) {
	val := 42
	s := &BenchmarkStruct{
		Name:    "benchmark",
		Age:     30,
Repository: google/go-github
File: github/enterprise_scim_test.go (Go)

Code before:
			"created": ` + referenceTimeStr + `,
			"lastModified": ` + referenceTimeStr + `,
			"location": "l"
		}
	}`

	testJSONMarshal(t, u, want)
}

func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) {
	t.Parallel()
	testJSONMarshal(t, &SCIMEnterpriseAttribute{}, "{}")

	u := &SCIMEnterpriseAttribute{
		Schemas: []string{"s"},
		Operations: []*SCIMEnterpriseAttributeOperation{
			{Op: "o1"},
			{
				Op:    "o2",
				Path:  Ptr("p2"),
				Value: "v2",
			},
			{
				Op:    "replace",
				Path:  Ptr("emails[type eq 'work'].value"),
				Value: "v@3.com",
			},
			{
				Op:   "add",
				Path: Ptr("members"),
				Value: []*SCIMEnterpriseDisplayReference{
					{Value: "v-1"},
					{Value: "v-2"},
				},
			},
		},
	}

	want := `{
		"schemas": ["s"],
		"Operations": [
			{"op": "o1"},
			{
				"op": "o2",
				"path": "p2",
				"value": "v2"
			},
			{
				"op": "replace",
				"path": "emails[type eq 'work'].value",
				"value": "v@3.com"

Review comment (suggestion):
Just to remain consistent with rest of repo.
```suggestion
				Value: "v@example.com",
```

Code after:
			"created": ` + referenceTimeStr + `,
			"lastModified": ` + referenceTimeStr + `,
			"location": "l"
		}
	}`

	testJSONMarshal(t, u, want)
}

func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) {
	t.Parallel()
	testJSONMarshal(t, &SCIMEnterpriseAttribute{}, "{}")

	u := &SCIMEnterpriseAttribute{
		Schemas: []string{"s"},
		Operations: []*SCIMEnterpriseAttributeOperation{
			{Op: "o1"},
			{
				Op:    "o2",
				Path:  Ptr("p2"),
				Value: "v2",
			},
			{
				Op:    "replace",
				Path:  Ptr("emails[type eq 'work'].value"),
				Value: "v@example.com",
			},
			{
				Op:   "add",
				Path: Ptr("members"),
				Value: []*SCIMEnterpriseDisplayReference{
					{Value: "v-1"},
					{Value: "v-2"},
				},
			},
		},
	}

	want := `{
		"schemas": ["s"],
		"Operations": [
			{"op": "o1"},
			{
				"op": "o2",
				"path": "p2",
				"value": "v2"
			},
			{
				"op": "replace",
				"path": "emails[type eq 'work'].value",
				"value": "v@example.com"
Repository: google/go-github
File: github/enterprise_scim_test.go (Go)

Code before:
				Value: "v@example.com",
			},
			{
				Op:   "add",
				Path: Ptr("members"),
				Value: []*SCIMEnterpriseDisplayReference{
					{Value: "v-1"},
					{Value: "v-2"},
				},
			},
		},
	}

	want := `{
		"schemas": ["s"],
		"Operations": [
			{"op": "o1"},
			{
				"op": "o2",
				"path": "p2",
				"value": "v2"
			},
			{
				"op": "replace",
				"path": "emails[type eq 'work'].value",
				"value": "v@3.com"
			},
			{
				"op": "add",
				"path": "members",
				"value": [
					{
						"value": "v-1"
					},
					{
						"value": "v-2"
					}
				]
			}
		]
	}`

	testJSONMarshal(t, u, want)
}

func TestEnterpriseService_ListProvisionedSCIMGroups(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/scim/v2/enterprises/ee/Groups", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")

Review comment (bug):
```suggestion
				"value": "v@example.com"
```
we have to make changes here too otherwise test will fail.

Code after:
				Value: "v@example.com",
			},
			{
				Op:   "add",
				Path: Ptr("members"),
				Value: []*SCIMEnterpriseDisplayReference{
					{Value: "v-1"},
					{Value: "v-2"},
				},
			},
		},
	}

	want := `{
		"schemas": ["s"],
		"Operations": [
			{"op": "o1"},
			{
				"op": "o2",
				"path": "p2",
				"value": "v2"
			},
			{
				"op": "replace",
				"path": "emails[type eq 'work'].value",
				"value": "v@example.com"
			},
			{
				"op": "add",
				"path": "members",
				"value": [
					{
						"value": "v-1"
					},
					{
						"value": "v-2"
					}
				]
			}
		]
	}`

	testJSONMarshal(t, u, want)
}

func TestEnterpriseService_ListProvisionedSCIMGroups(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/scim/v2/enterprises/ee/Groups", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
Repository: google/go-github
File: github/issues_test.go (Go)

Code before:
func TestIssuesService_ListByOrg_badOrg(t *testing.T) {
	t.Parallel()
	client, _, _ := setup(t)

	ctx := t.Context()
	_, _, err := client.Issues.ListByOrg(ctx, "\n", nil)
	testURLParseError(t, err)
}

func TestIssuesService_ListByRepo(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testHeader(t, r, "Accept", mediaTypeReactionsPreview)
		testFormValues(t, r, values{
			"milestone": "*",
			"state":     "closed",
			"assignee":  "a",
			"creator":   "c",
			"mentioned": "m",
			"labels":    "a,b",
			"sort":      "updated",
			"direction": "asc",
			"since":     "2002-02-10T15:30:00Z",
			"per_page":  "1",
		})
		fmt.Fprint(w, `[{"number":1}]`)
	})

	// IssueListByRepoOptions uses standard strings (not pointers) and ListCursorOptions
	opt := &IssueListByRepoOptions{
		Milestone:         "*",
		State:             "closed",
		Assignee:          "a",
		Creator:           "c",
		Mentioned:         "m",
		Labels:            []string{"a", "b"},
		Sort:              "updated",
		Direction:         "asc",
		Since:             time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC),
		ListCursorOptions: ListCursorOptions{PerPage: 1},
	}

	ctx := t.Context()
	issues, _, err := client.Issues.ListByRepo(ctx, "o", "r", opt)
	if err != nil {
		t.Errorf("Issues.ListByOrg returned error: %v", err)
	}


Review comment (suggestion):
```suggestion
			"since":     referenceTimeStr,
```

Code after:
	t.Parallel()
	client, _, _ := setup(t)

	ctx := t.Context()
	_, _, err := client.Issues.ListByOrg(ctx, "\n", nil)
	testURLParseError(t, err)
}

func TestIssuesService_ListByRepo(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testHeader(t, r, "Accept", mediaTypeReactionsPreview)
		testFormValues(t, r, values{
			"milestone": "*",
			"state":     "closed",
			"assignee":  "a",
			"creator":   "c",
			"mentioned": "m",
			"labels":    "a,b",
			"sort":      "updated",
			"direction": "asc",
			"since":     referenceTime.Format(time.RFC3339),
			"per_page":  "1",
		})
		fmt.Fprint(w, `[{"number":1}]`)
	})

	// IssueListByRepoOptions uses standard strings (not pointers) and ListCursorOptions
	opt := &IssueListByRepoOptions{
		Milestone:         "*",
		State:             "closed",
		Assignee:          "a",
		Creator:           "c",
		Mentioned:         "m",
		Labels:            []string{"a", "b"},
		Sort:              "updated",
		Direction:         "asc",
		Since:             referenceTime,
		ListCursorOptions: ListCursorOptions{PerPage: 1},
	}

	ctx := t.Context()
	issues, _, err := client.Issues.ListByRepo(ctx, "o", "r", opt)
	if err != nil {
		t.Errorf("Issues.ListByOrg returned error: %v", err)
	}

	want := []*Issue{{Number: Ptr(1)}}
Repository: google/go-github
File: github/repos_immutable_releases.go (Go)

Code before:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// checkImmutableReleases represents whether immutable releases are enabled for a repository.
type checkImmutableReleases struct {
	Enabled bool `json:"enabled,omitempty"`
}

// EnableImmutableReleases enables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases-for-a-repository
//
//meta:operation PUT /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("PUT", u, nil)

Review comment (security):
```suggestion
// Copyright 2026 The go-github AUTHORS. All rights reserved.
```

Code after:
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// RepoImmutableReleasesStatus represents the immutable releases status for a repository.
type RepoImmutableReleasesStatus struct {
	Enabled         *bool `json:"enabled,omitempty"`
	EnforcedByOwner *bool `json:"enforced_by_owner,omitempty"`
}

// EnableImmutableReleases enables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases
//
//meta:operation PUT /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)
Repository: google/go-github
File: github/repos_immutable_releases.go (Go)

Code before:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// checkImmutableReleases represents whether immutable releases are enabled for a repository.
type checkImmutableReleases struct {
	Enabled bool `json:"enabled,omitempty"`
}

// EnableImmutableReleases enables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases-for-a-repository
//
//meta:operation PUT /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("PUT", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// DisableImmutableReleases disables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases-for-a-repository
//
//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

Review comment (suggestion):
```suggestion
// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases
```

Code after:
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// RepoImmutableReleasesStatus represents the immutable releases status for a repository.
type RepoImmutableReleasesStatus struct {
	Enabled         *bool `json:"enabled,omitempty"`
	EnforcedByOwner *bool `json:"enforced_by_owner,omitempty"`
}

// EnableImmutableReleases enables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-immutable-releases
//
//meta:operation PUT /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo)

	req, err := s.client.NewRequest("PUT", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// DisableImmutableReleases disables immutable releases for a repository.
//
// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-immutable-releases
//
//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases
func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) {
Repository: google/go-github
File: github/repos_immutable_releases_test.go (Go)

Code before:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"fmt"
	"net/http"
	"testing"
)

func TestRepositoriesService_EnableImmutableReleases(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/owner/repo/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")
		w.WriteHeader(http.StatusNoContent)
	})

	ctx := t.Context()
	_, err := client.Repositories.EnableImmutableReleases(ctx, "owner", "repo")
	if err != nil {
		t.Errorf("Repositories.EnableImmutableReleases returned error: %v", err)

Review comment (security):
```suggestion
// Copyright 2026 The go-github AUTHORS. All rights reserved.
```

Code after:
// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/google/go-cmp/cmp"
)

func TestRepositoriesService_EnableImmutableReleases(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	mux.HandleFunc("/repos/owner/repo/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")
		w.WriteHeader(http.StatusNoContent)
	})

	ctx := t.Context()
	_, err := client.Repositories.EnableImmutableReleases(ctx, "owner", "repo")
Repository: google/go-github
File: github/github_test.go (Go)

Code before:
func testMethod(t *testing.T, r *http.Request, want string) {
	t.Helper()
	if got := r.Method; got != want {
		t.Errorf("Request method: %v, want %v", got, want)
	}
}

type values map[string]string

// testFormValues checks that the request form values match the expected values.
// It expects exactly one value per key.
func testFormValues(t *testing.T, r *http.Request, want values) {
	t.Helper()

	wantValues := url.Values{}
	for k, v := range want {
		wantValues.Add(k, v)
	}

	assertNilError(t, r.ParseForm())
	if got := r.Form; !cmp.Equal(got, wantValues) {
		t.Errorf("Request query parameters: %v, want %v", got, wantValues)
	}
}

// testFormValuesMany checks that the request form values match the expected values.
// It allows for multiple values per key.
func testFormValuesList(t *testing.T, r *http.Request, want url.Values) {
	t.Helper()

	assertNilError(t, r.ParseForm())
	if got := r.Form; !cmp.Equal(got, want) {
		t.Errorf("Request query parameters: %v, want %v", got, want)
	}
}

func testHeader(t *testing.T, r *http.Request, header, want string) {
	t.Helper()
	if got := r.Header.Get(header); got != want {
		t.Errorf("Header.Get(%q) returned %q, want %q", header, got, want)
	}
}

func testURLParseError(t *testing.T, err error) {
	t.Helper()
	if err == nil {
		t.Error("Expected error to be returned")
	}
	var uerr *url.Error
	if !errors.As(err, &uerr) || uerr.Op != "parse" {
		t.Errorf("Expected URL parse error, got %+v", err)

Review comment (suggestion):
```suggestion
// testFormValuesList checks that the request form values match the expected values.
```

Code after:
func testMethod(t *testing.T, r *http.Request, want string) {
	t.Helper()
	if got := r.Method; got != want {
		t.Errorf("Request method: %v, want %v", got, want)
	}
}

type values map[string]string

// testFormValues checks that the request form values match the expected values.
// It expects exactly one value per key.
func testFormValues(t *testing.T, r *http.Request, want values) {
	t.Helper()

	wantValues := url.Values{}
	for k, v := range want {
		wantValues.Add(k, v)
	}

	assertNilError(t, r.ParseForm())
	if got := r.Form; !cmp.Equal(got, wantValues) {
		t.Errorf("Request query parameters: %v, want %v", got, wantValues)
	}
}

// testFormValuesList checks that the request form values match the expected values.
// It allows for multiple values per key.
func testFormValuesList(t *testing.T, r *http.Request, want url.Values) {
	t.Helper()

	assertNilError(t, r.ParseForm())
	if got := r.Form; !cmp.Equal(got, want) {
		t.Errorf("Request query parameters: %v, want %v", got, want)
	}
}

func testHeader(t *testing.T, r *http.Request, header, want string) {
	t.Helper()
	if got := r.Header.Get(header); got != want {
		t.Errorf("Header.Get(%q) returned %q, want %q", header, got, want)
	}
}

func testURLParseError(t *testing.T, err error) {
	t.Helper()
	if err == nil {
		t.Error("Expected error to be returned")
	}
	var uerr *url.Error
	if !errors.As(err, &uerr) || uerr.Op != "parse" {
		t.Errorf("Expected URL parse error, got %+v", err)
Repository: google/iosched
File: mobile/src/main/java/com/google/samples/apps/iosched/ui/sessiondetail/SessionDetailActivity.kt (Kotlin)

Code before:
                // If this activity was launched from a deeplink, then the logcat statement is
                // printed. Otherwise, the SessionDetailFragment is started from the MainActivity
                // which would have already reported fully drawn to the framework.
                reportFullyDrawn()
            }
        })
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (resultCode == Activity.RESULT_CANCELED) {
            Timber.d("An activity returned RESULT_CANCELED")
            val response = IdpResponse.fromResultIntent(data)
            response?.error?.let {
                snackbarMessageManager.addMessage(
                    SnackbarMessage(
                        messageId = FirebaseAuthErrorCodeConverter.convert(it.errorCode),
                        requestChangeId = UUID.randomUUID().toString()
                    )
                )
            }
        }
    }

    private fun getSessionId(intent: Intent): String? {
        return intent.data?.lastPathSegment // for iosched://sessions/{id}
            ?: intent.data?.getQueryParameter(QUERY_SESSION_ID) // for iosched://sessions?session_id={id}
            ?: intent.getStringExtra(EXTRA_SESSION_ID)
    }

    companion object {
        private const val EXTRA_SESSION_ID = "SESSION_ID"

        fun starterIntent(context: Context, sessionId: SessionId): Intent {
            return Intent(context, SessionDetailActivity::class.java).apply {
                putExtra(EXTRA_SESSION_ID, sessionId)
            }
        }
    }
}


Review comment (bug):
Will `.lastPathSegment` capture `sessions` by mistake (instead of the id) if the URI is of the form `iosched://sessions?session_id={id}`?

In any case this might be better as a separate change if there's a bug with the current code here.

Code after:
            Timber.d("An activity returned RESULT_CANCELED")
            val response = IdpResponse.fromResultIntent(data)
            response?.error?.let {
                snackbarMessageManager.addMessage(
                    SnackbarMessage(
                        messageId = FirebaseAuthErrorCodeConverter.convert(it.errorCode),
                        requestChangeId = UUID.randomUUID().toString()
                    )
                )
            }
        }
    }

    private fun getSessionId(intent: Intent): String? {
        return intent.data?.getQueryParameter(QUERY_SESSION_ID) // for iosched://sessions/{id}
            ?: intent.getStringExtra(EXTRA_SESSION_ID)
    }

    companion object {
        private const val EXTRA_SESSION_ID = "SESSION_ID"

        fun starterIntent(context: Context, sessionId: SessionId): Intent {
            return Intent(context, SessionDetailActivity::class.java).apply {
                putExtra(EXTRA_SESSION_ID, sessionId)
            }
        }
    }
}