carlos / platform Public

console: saved contacts take ctx; Handle is RegistrarHandle

Every new domain Store method takes ctx first and passes it to the
database. SavedContact.Handle becomes RegistrarHandle (column stays
handle), so non-test code can read it without tripping the route
census, and the set-by-key workaround goes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev cc53d8e760133087380f4ec5069fefa834a6270c parent d0d1cb7
2 files changed, +71 −78
  • internal/console/domainstore.go +18 −31
  • internal/console/domainstore_test.go +53 −47
diff --git a/internal/console/domainstore.go b/internal/console/domainstore.go
index f0a46b9da..17fd43cae 100644
--- a/internal/console/domainstore.go
+++ b/internal/console/domainstore.go
@@ -81,14 +81,14 @@ type DomainRegistration struct {
}
// SavedContact is one of an account's registrant contacts. Every edit bumps
-// Version and clears Handle, so a registrar handle minted for one version is
-// never used for another.
+// Version and clears RegistrarHandle, so a registrar handle minted for one
+// version is never used for another.
type SavedContact struct {
ID string // "dc_" + 12 random hex
AccountID int64
Contact registrar.Contact
Version int64 // 1 on add, +1 on every edit
- Handle string // registrar handle for this Version; "" until a purchase mints one
+ RegistrarHandle string // registrar handle for this Version; "" until a purchase mints one
LastUsed, CreatedAt time.Time
}
@@ -468,8 +468,7 @@ func scanDomainRegistration(sc interface{ Scan(...any) error }) (*DomainRegistra
}
// DomainRegistrations lists an account's registrations by domain.
-func (s *Store) DomainRegistrations(accountID int64) ([]DomainRegistration, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) DomainRegistrations(ctx context.Context, accountID int64) ([]DomainRegistration, error) {
rows, err := s.db.QueryContext(ctx, `SELECT `+domainRegistrationColumns+` FROM domain_registrations WHERE account_id = ? ORDER BY domain`, accountID)
if err != nil {
return nil, err
@@ -488,8 +487,7 @@ func (s *Store) DomainRegistrations(accountID int64) ([]DomainRegistration, erro
// DomainRegistrationFor is nil, nil when the domain is not registered to
// this account.
-func (s *Store) DomainRegistrationFor(accountID int64, domain string) (*DomainRegistration, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) DomainRegistrationFor(ctx context.Context, accountID int64, domain string) (*DomainRegistration, error) {
r, err := scanDomainRegistration(s.db.QueryRowContext(ctx, `SELECT `+domainRegistrationColumns+` FROM domain_registrations WHERE domain = ? AND account_id = ?`, domain, accountID))
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
@@ -499,8 +497,7 @@ func (s *Store) DomainRegistrationFor(accountID int64, domain string) (*DomainRe
// AccountDomainPurchases lists an account's purchases still in flight,
// newest first.
-func (s *Store) AccountDomainPurchases(accountID int64) ([]DomainPurchase, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) AccountDomainPurchases(ctx context.Context, accountID int64) ([]DomainPurchase, error) {
rows, err := s.db.QueryContext(ctx, `SELECT `+domainPurchaseColumns+` FROM domain_purchases WHERE account_id = ? AND `+liveDomainPurchaseSQL+` ORDER BY created_at DESC, rowid DESC`, accountID)
if err != nil {
return nil, err
@@ -519,8 +516,7 @@ func (s *Store) AccountDomainPurchases(accountID int64) ([]DomainPurchase, error
// DomainObligations lists, sorted, the domains an account holds a
// registration for or is still buying.
-func (s *Store) DomainObligations(accountID int64) ([]string, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) DomainObligations(ctx context.Context, accountID int64) ([]string, error) {
rows, err := s.db.QueryContext(ctx, `SELECT domain FROM domain_registrations WHERE account_id = ?
UNION SELECT domain FROM domain_purchases WHERE account_id = ? AND `+liveDomainPurchaseSQL+`
ORDER BY domain`, accountID, accountID)
@@ -553,9 +549,7 @@ func scanSavedContact(sc interface{ Scan(...any) error }) (*SavedContact, error)
if err := sc.Scan(&id, &account, &contact, &version, &handle, &used, &created); err != nil {
return nil, err
}
- // A selector named Handle, on any receiver, trips the route census
- // (TestClaimConsoleMuxHasOneRegistrar), so the field is set by key.
- c := SavedContact{ID: id, AccountID: account, Version: version, Handle: handle}
+ c := SavedContact{ID: id, AccountID: account, Version: version, RegistrarHandle: handle}
if err := json.Unmarshal([]byte(contact), &c.Contact); err != nil {
return nil, err
}
@@ -568,8 +562,7 @@ func scanSavedContact(sc interface{ Scan(...any) error }) (*SavedContact, error)
// SavedContacts lists an account's saved contacts, most recently used
// first, then newest first.
-func (s *Store) SavedContacts(accountID int64) ([]SavedContact, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) SavedContacts(ctx context.Context, accountID int64) ([]SavedContact, error) {
rows, err := s.db.QueryContext(ctx, `SELECT `+savedContactColumns+` FROM domain_saved_contacts WHERE account_id = ?
ORDER BY last_used DESC, created_at DESC, rowid DESC`, accountID)
if err != nil {
@@ -588,8 +581,7 @@ func (s *Store) SavedContacts(accountID int64) ([]SavedContact, error) {
}
// SavedContact is nil, nil when the contact is missing or another account's.
-func (s *Store) SavedContact(accountID int64, id string) (*SavedContact, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) SavedContact(ctx context.Context, accountID int64, id string) (*SavedContact, error) {
c, err := scanSavedContact(s.db.QueryRowContext(ctx, `SELECT `+savedContactColumns+` FROM domain_saved_contacts WHERE account_id = ? AND id = ?`, accountID, id))
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
@@ -597,8 +589,7 @@ func (s *Store) SavedContact(accountID int64, id string) (*SavedContact, error)
return c, err
}
-func (s *Store) AddSavedContact(accountID int64, c registrar.Contact, now time.Time) (SavedContact, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) AddSavedContact(ctx context.Context, accountID int64, c registrar.Contact, now time.Time) (SavedContact, error) {
if err := c.Validate(); err != nil {
return SavedContact{}, err
}
@@ -615,11 +606,10 @@ func (s *Store) AddSavedContact(accountID int64, c registrar.Contact, now time.T
return sc, nil
}
-// EditSavedContact replaces the contact, bumps Version and clears Handle:
-// the registrar handle of the old version is never used for the new one.
-// Registrations and purchases keep their frozen copies.
-func (s *Store) EditSavedContact(accountID int64, id string, c registrar.Contact) error {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+// EditSavedContact replaces the contact, bumps Version and clears
+// RegistrarHandle: the registrar handle of the old version is never used
+// for the new one. Registrations and purchases keep their frozen copies.
+func (s *Store) EditSavedContact(ctx context.Context, accountID int64, id string, c registrar.Contact) error {
if err := c.Validate(); err != nil {
return err
}
@@ -634,8 +624,7 @@ func (s *Store) EditSavedContact(accountID int64, id string, c registrar.Contact
// RemoveSavedContact removes the contact from the list only; purchases and
// registrations keep their frozen copy.
-func (s *Store) RemoveSavedContact(accountID int64, id string) error {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) RemoveSavedContact(ctx context.Context, accountID int64, id string) error {
res, err := s.db.ExecContext(ctx, `DELETE FROM domain_saved_contacts WHERE account_id = ? AND id = ?`, accountID, id)
return savedContactAffected(res, err)
}
@@ -657,8 +646,7 @@ func savedContactAffected(res sql.Result, err error) error {
// SetSavedContactHandle records a handle minted for one version of a saved
// contact. It is false, and changes nothing, when the contact has been
// edited since (version moved) or already has a handle.
-func (s *Store) SetSavedContactHandle(accountID int64, id string, version int64, handle string) (bool, error) {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) SetSavedContactHandle(ctx context.Context, accountID int64, id string, version int64, handle string) (bool, error) {
res, err := s.db.ExecContext(ctx, `UPDATE domain_saved_contacts SET handle = ? WHERE account_id = ? AND id = ? AND version = ? AND handle = ''`,
handle, accountID, id, version)
if err != nil {
@@ -670,8 +658,7 @@ func (s *Store) SetSavedContactHandle(accountID int64, id string, version int64,
// TouchSavedContact sets LastUsed only. A contact removed meanwhile is not
// an error.
-func (s *Store) TouchSavedContact(accountID int64, id string, now time.Time) error {
- ctx := context.Background() // the domain store API takes no ctx yet; there is none to inherit
+func (s *Store) TouchSavedContact(ctx context.Context, accountID int64, id string, now time.Time) error {
_, err := s.db.ExecContext(ctx, `UPDATE domain_saved_contacts SET last_used = ? WHERE account_id = ? AND id = ?`, now.Unix(), accountID, id)
return err
}
diff --git a/internal/console/domainstore_test.go b/internal/console/domainstore_test.go
index 361c13cf0..429ac09dd 100644
--- a/internal/console/domainstore_test.go
+++ b/internal/console/domainstore_test.go
@@ -285,38 +285,39 @@ func savedTestContact(first string) registrar.Contact {
}
func TestSavedContactsOrderAndAccountScope(t *testing.T) {
+ ctx := t.Context()
s := openTestStore(t)
base := time.Date(2026, 11, 19, 10, 0, 0, 0, time.UTC)
- if _, err := s.AddSavedContact(1, registrar.Contact{FirstName: "Half"}, base); err == nil {
+ if _, err := s.AddSavedContact(ctx, 1, registrar.Contact{FirstName: "Half"}, base); err == nil {
t.Fatal("invalid contact saved")
}
var ids []string
for i, name := range []string{"alpha", "bravo", "charlie", "delta"} {
- c, err := s.AddSavedContact(1, savedTestContact(name), base.Add(time.Duration(i)*time.Minute))
+ c, err := s.AddSavedContact(ctx, 1, savedTestContact(name), base.Add(time.Duration(i)*time.Minute))
if err != nil {
t.Fatal(err)
}
- if !regexp.MustCompile(`^dc_[0-9a-f]{12}$`).MatchString(c.ID) || c.AccountID != 1 || c.Version != 1 || c.Handle != "" ||
+ if !regexp.MustCompile(`^dc_[0-9a-f]{12}$`).MatchString(c.ID) || c.AccountID != 1 || c.Version != 1 || c.RegistrarHandle != "" ||
!c.LastUsed.IsZero() || !c.CreatedAt.Equal(base.Add(time.Duration(i)*time.Minute)) || c.Contact != savedTestContact(name) {
t.Fatalf("added: %+v", c)
}
ids = append(ids, c.ID)
}
- other, err := s.AddSavedContact(2, savedTestContact("other"), base.Add(time.Hour))
+ other, err := s.AddSavedContact(ctx, 2, savedTestContact("other"), base.Add(time.Hour))
if err != nil {
t.Fatal(err)
}
// bravo used last, alpha before it; charlie and delta never used: newest first.
- if err := s.TouchSavedContact(1, ids[0], base.Add(2*time.Hour)); err != nil {
+ if err := s.TouchSavedContact(ctx, 1, ids[0], base.Add(2*time.Hour)); err != nil {
t.Fatal(err)
}
- if err := s.TouchSavedContact(1, ids[1], base.Add(3*time.Hour)); err != nil {
+ if err := s.TouchSavedContact(ctx, 1, ids[1], base.Add(3*time.Hour)); err != nil {
t.Fatal(err)
}
- if err := s.TouchSavedContact(1, other.ID, base.Add(4*time.Hour)); err != nil {
+ if err := s.TouchSavedContact(ctx, 1, other.ID, base.Add(4*time.Hour)); err != nil {
t.Fatal(err)
}
- list, err := s.SavedContacts(1)
+ list, err := s.SavedContacts(ctx, 1)
if err != nil {
t.Fatal(err)
}
@@ -330,96 +331,98 @@ func TestSavedContactsOrderAndAccountScope(t *testing.T) {
if !list[0].LastUsed.Equal(base.Add(3 * time.Hour)) {
t.Fatalf("last used: %+v", list[0])
}
- if c, err := s.SavedContact(1, other.ID); err != nil || c != nil {
+ if c, err := s.SavedContact(ctx, 1, other.ID); err != nil || c != nil {
t.Fatalf("another account's contact: %+v, %v", c, err)
}
- if c, err := s.SavedContact(1, "dc_000000000000"); err != nil || c != nil {
+ if c, err := s.SavedContact(ctx, 1, "dc_000000000000"); err != nil || c != nil {
t.Fatalf("missing contact: %+v, %v", c, err)
}
- if c, err := s.SavedContact(2, other.ID); err != nil || c == nil || !c.LastUsed.IsZero() || c.Contact.FirstName != "other" {
+ if c, err := s.SavedContact(ctx, 2, other.ID); err != nil || c == nil || !c.LastUsed.IsZero() || c.Contact.FirstName != "other" {
t.Fatalf("other account touched across accounts or missing: %+v, %v", c, err)
}
- if err := s.EditSavedContact(1, other.ID, savedTestContact("stolen")); !errors.Is(err, ErrSavedContactNotFound) {
+ if err := s.EditSavedContact(ctx, 1, other.ID, savedTestContact("stolen")); !errors.Is(err, ErrSavedContactNotFound) {
t.Fatalf("cross-account edit: %v", err)
}
- if err := s.RemoveSavedContact(1, other.ID); !errors.Is(err, ErrSavedContactNotFound) {
+ if err := s.RemoveSavedContact(ctx, 1, other.ID); !errors.Is(err, ErrSavedContactNotFound) {
t.Fatalf("cross-account remove: %v", err)
}
- if list, err := s.SavedContacts(2); err != nil || len(list) != 1 || list[0].Contact.FirstName != "other" {
+ if list, err := s.SavedContacts(ctx, 2); err != nil || len(list) != 1 || list[0].Contact.FirstName != "other" {
t.Fatalf("other account list: %+v, %v", list, err)
}
- if err := s.RemoveSavedContact(1, ids[0]); err != nil {
+ if err := s.RemoveSavedContact(ctx, 1, ids[0]); err != nil {
t.Fatal(err)
}
- if list, err := s.SavedContacts(1); err != nil || len(list) != 3 {
+ if list, err := s.SavedContacts(ctx, 1); err != nil || len(list) != 3 {
t.Fatalf("after remove: %+v, %v", list, err)
}
}
func TestEditSavedContactBumpsVersionClearsHandle(t *testing.T) {
+ ctx := t.Context()
s := openTestStore(t)
now := time.Date(2026, 11, 19, 10, 0, 0, 0, time.UTC)
- c, err := s.AddSavedContact(1, savedTestContact("jane"), now)
+ c, err := s.AddSavedContact(ctx, 1, savedTestContact("jane"), now)
if err != nil {
t.Fatal(err)
}
- if ok, err := s.SetSavedContactHandle(1, c.ID, 1, "handle-1"); err != nil || !ok {
+ if ok, err := s.SetSavedContactHandle(ctx, 1, c.ID, 1, "handle-1"); err != nil || !ok {
t.Fatalf("set handle: %v, %v", ok, err)
}
- if err := s.TouchSavedContact(1, c.ID, now.Add(time.Hour)); err != nil {
+ if err := s.TouchSavedContact(ctx, 1, c.ID, now.Add(time.Hour)); err != nil {
t.Fatal(err)
}
- if err := s.EditSavedContact(1, c.ID, registrar.Contact{FirstName: "Half"}); err == nil {
+ if err := s.EditSavedContact(ctx, 1, c.ID, registrar.Contact{FirstName: "Half"}); err == nil {
t.Fatal("invalid edit accepted")
}
edited := savedTestContact("janet")
- if err := s.EditSavedContact(1, c.ID, edited); err != nil {
+ if err := s.EditSavedContact(ctx, 1, c.ID, edited); err != nil {
t.Fatal(err)
}
- got, err := s.SavedContact(1, c.ID)
+ got, err := s.SavedContact(ctx, 1, c.ID)
if err != nil || got == nil {
t.Fatalf("after edit: %+v, %v", got, err)
}
- if got.Version != 2 || got.Handle != "" || got.Contact != edited || !got.CreatedAt.Equal(now) || !got.LastUsed.Equal(now.Add(time.Hour)) {
+ if got.Version != 2 || got.RegistrarHandle != "" || got.Contact != edited || !got.CreatedAt.Equal(now) || !got.LastUsed.Equal(now.Add(time.Hour)) {
t.Fatalf("after edit: %+v", got)
}
- if err := s.EditSavedContact(1, c.ID, edited); err != nil {
+ if err := s.EditSavedContact(ctx, 1, c.ID, edited); err != nil {
t.Fatal(err)
}
- if got, err := s.SavedContact(1, c.ID); err != nil || got.Version != 3 {
+ if got, err := s.SavedContact(ctx, 1, c.ID); err != nil || got.Version != 3 {
t.Fatalf("second edit: %+v, %v", got, err)
}
- if err := s.EditSavedContact(1, "dc_000000000000", edited); !errors.Is(err, ErrSavedContactNotFound) {
+ if err := s.EditSavedContact(ctx, 1, "dc_000000000000", edited); !errors.Is(err, ErrSavedContactNotFound) {
t.Fatalf("missing edit: %v", err)
}
}
func TestSetSavedContactHandleIsConditional(t *testing.T) {
+ ctx := t.Context()
s := openTestStore(t)
- c, err := s.AddSavedContact(1, savedTestContact("jane"), time.Now())
+ c, err := s.AddSavedContact(ctx, 1, savedTestContact("jane"), time.Now())
if err != nil {
t.Fatal(err)
}
- if err := s.EditSavedContact(1, c.ID, savedTestContact("janet")); err != nil {
+ if err := s.EditSavedContact(ctx, 1, c.ID, savedTestContact("janet")); err != nil {
t.Fatal(err)
}
// A purchase that froze version 1 mints a handle after the edit: refused.
- if ok, err := s.SetSavedContactHandle(1, c.ID, 1, "stale"); err != nil || ok {
+ if ok, err := s.SetSavedContactHandle(ctx, 1, c.ID, 1, "stale"); err != nil || ok {
t.Fatalf("stale version: %v, %v", ok, err)
}
- if got, _ := s.SavedContact(1, c.ID); got.Handle != "" || got.Version != 2 {
+ if got, _ := s.SavedContact(ctx, 1, c.ID); got.RegistrarHandle != "" || got.Version != 2 {
t.Fatalf("stale write changed row: %+v", got)
}
- if ok, err := s.SetSavedContactHandle(2, c.ID, 2, "cross"); err != nil || ok {
+ if ok, err := s.SetSavedContactHandle(ctx, 2, c.ID, 2, "cross"); err != nil || ok {
t.Fatalf("other account: %v, %v", ok, err)
}
- if ok, err := s.SetSavedContactHandle(1, c.ID, 2, "first"); err != nil || !ok {
+ if ok, err := s.SetSavedContactHandle(ctx, 1, c.ID, 2, "first"); err != nil || !ok {
t.Fatalf("matching version: %v, %v", ok, err)
}
- if ok, err := s.SetSavedContactHandle(1, c.ID, 2, "second"); err != nil || ok {
+ if ok, err := s.SetSavedContactHandle(ctx, 1, c.ID, 2, "second"); err != nil || ok {
t.Fatalf("existing handle: %v, %v", ok, err)
}
- if got, _ := s.SavedContact(1, c.ID); got.Handle != "first" || got.Version != 2 {
+ if got, _ := s.SavedContact(ctx, 1, c.ID); got.RegistrarHandle != "first" || got.Version != 2 {
t.Fatalf("handle: %+v", got)
}
}
@@ -461,8 +464,9 @@ func seedLegacyDomainState(t *testing.T, s *Store) (registered, done registrar.C
}
func TestMigrateDomainsBackfillsContactsAndRegistrant(t *testing.T) {
+ ctx := t.Context()
s := openTestStore(t)
- before, err := s.SavedContacts(123)
+ before, err := s.SavedContacts(ctx, 123)
if err != nil || len(before) != 0 {
t.Fatalf("fresh store: %+v, %v", before, err)
}
@@ -472,16 +476,16 @@ func TestMigrateDomainsBackfillsContactsAndRegistrant(t *testing.T) {
t.Fatal(err)
}
}
- list, err := s.SavedContacts(123)
+ list, err := s.SavedContacts(ctx, 123)
if err != nil || len(list) != 1 {
t.Fatalf("saved contacts: %+v, %v", list, err)
}
c := list[0]
- if c.Handle != "contact-1" || c.Version != 1 || c.Contact != savedTestContact("legacy") || c.LastUsed.IsZero() || c.AccountID != 123 {
+ if c.RegistrarHandle != "contact-1" || c.Version != 1 || c.Contact != savedTestContact("legacy") || c.LastUsed.IsZero() || c.AccountID != 123 {
t.Fatalf("backfilled contact: %+v", c)
}
for domain, want := range map[string]registrar.Contact{"one.example": registered, "two.example": done, "three.example": {}} {
- r, err := s.DomainRegistrationFor(123, domain)
+ r, err := s.DomainRegistrationFor(ctx, 123, domain)
if err != nil || r == nil || r.Registrant != want {
t.Fatalf("%s registrant: %+v, %v; want %+v", domain, r, err, want)
}
@@ -496,6 +500,7 @@ func TestMigrateDomainsBackfillsContactsAndRegistrant(t *testing.T) {
}
func TestMigratedContactRemovalSurvivesReopen(t *testing.T) {
+ ctx := t.Context()
path := filepath.Join(t.TempDir(), "console.db")
s, err := Open(path)
if err != nil {
@@ -506,11 +511,11 @@ func TestMigratedContactRemovalSurvivesReopen(t *testing.T) {
if err := s.migrateDomains(); err != nil {
t.Fatal(err)
}
- list, err := s.SavedContacts(123)
+ list, err := s.SavedContacts(ctx, 123)
if err != nil || len(list) != 1 {
t.Fatalf("saved contacts: %+v, %v", list, err)
}
- if err := s.RemoveSavedContact(123, list[0].ID); err != nil {
+ if err := s.RemoveSavedContact(ctx, 123, list[0].ID); err != nil {
t.Fatal(err)
}
if err := s.Close(); err != nil {
@@ -519,12 +524,13 @@ func TestMigratedContactRemovalSurvivesReopen(t *testing.T) {
if s, err = Open(path); err != nil {
t.Fatal(err)
}
- if list, err := s.SavedContacts(123); err != nil || len(list) != 0 {
+ if list, err := s.SavedContacts(ctx, 123); err != nil || len(list) != 0 {
t.Fatalf("removed contact came back: %+v, %v", list, err)
}
}
func TestDomainObligations(t *testing.T) {
+ ctx := t.Context()
s := openTestStore(t)
t0 := time.Date(2026, 11, 1, 0, 0, 0, 0, time.UTC)
jane := savedTestContact("jane")
@@ -550,24 +556,24 @@ func TestDomainObligations(t *testing.T) {
t.Fatal(err)
}
}
- got, err := s.DomainObligations(1)
+ got, err := s.DomainObligations(ctx, 1)
if want := []string{"alpha.example", "dup.example", "live.example", "zed.example"}; err != nil || !reflect.DeepEqual(got, want) {
t.Fatalf("obligations = %v, %v; want %v", got, err, want)
}
- if got, err := s.DomainObligations(3); err != nil || len(got) != 0 {
+ if got, err := s.DomainObligations(ctx, 3); err != nil || len(got) != 0 {
t.Fatalf("empty account: %v, %v", got, err)
}
- regs, err := s.DomainRegistrations(1)
+ regs, err := s.DomainRegistrations(ctx, 1)
if err != nil || len(regs) != 3 || regs[0].Domain != "alpha.example" || regs[1].Domain != "dup.example" || regs[2].Domain != "zed.example" || regs[2].Registrant != jane || regs[0].Registrant != (registrar.Contact{}) {
t.Fatalf("registrations: %+v, %v", regs, err)
}
- if r, err := s.DomainRegistrationFor(1, "theirs.example"); err != nil || r != nil {
+ if r, err := s.DomainRegistrationFor(ctx, 1, "theirs.example"); err != nil || r != nil {
t.Fatalf("another account's registration: %+v, %v", r, err)
}
- if r, err := s.DomainRegistrationFor(1, "missing.example"); err != nil || r != nil {
+ if r, err := s.DomainRegistrationFor(ctx, 1, "missing.example"); err != nil || r != nil {
t.Fatalf("missing registration: %+v, %v", r, err)
}
- purchases, err := s.AccountDomainPurchases(1)
+ purchases, err := s.AccountDomainPurchases(ctx, 1)
if err != nil || len(purchases) != 2 || purchases[0].Domain != "dup.example" || purchases[1].Domain != "live.example" {
t.Fatalf("account purchases: %+v, %v", purchases, err)
}