giseldo/neodataset huggingface dataset:
Resolve Ruby 2 deprecations caught from Sentry

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

Deprecations warning caught from Sentry:

- [x] 1. [RUBY2 DEPRECATION: ](https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/4126430/?referrer=slack)/home/customersdot/CustomersDot/releases/20230426060457Z/app/services/salesforce/create_quote_objects_service.rb:14: warning: The called method `initialize' is defined here 
- [x] 2. [RUBY2 DEPRECATION: ](https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/4126431/?referrer=slack)/home/customersdot/CustomersDot/releases/20230426060457Z/app/services/create_order_service.rb:26: warning: The called method `execute' is defined here
- [ ] 3. ~[RUBY2 DEPRECATION:](https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/4126432/?query=logger%3A%22manual_exception_capture%22) /home/customersdot/CustomersDot/shared/vendor/bundle/ruby/2.7.0/gems/iron_bank-5.2.6/lib/iron_bank/queryable.rb:46: warning: The called method `where' is defined here~ See: https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6360



**Follow up:**

- [x] 4. Based on Comment: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/7222#note_1369018495, refactor spec: https://gitlab.com/gitlab-org/customers-gitlab-com/blob/6f1cc0a7d81266ffdb664bb3a6f9f9f27a599c7f/spec/services/salesforce/create_quote_objects_service_spec.rb#L8-19
### Proposal

<!-- Consult with `@gitlab-com/business-technology/enterprise-apps/zuora-architects` on the ~"Enterprise Applications" team if Zuora business logic is involved. -->

### Result 

### Next steps (if any)

### How will we measure success?

Story points: 3.0
Create custom Warning class to catch deprecation

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem
As a part of Ruby 3 upgrade, enable deprecation warning to catch any codepath that doesn't have specs yet.

More context: https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6022#note_1364593894
### Proposal

<!-- Consult with `@gitlab-com/business-technology/enterprise-apps/zuora-architects` on the ~"Enterprise Applications" team if Zuora business logic is involved. -->

### Result

### Next steps (if any)

### How will we measure success?

Story points: 2.0
South Korea lookup in SanctionsChecker is resulting in North Korea

### Problem

When the Zuora account's sold to or bill to has the country set to `Korea, (Republic of)`, the alpha3 lookup results in finding it as North Korea instead of South Korea.

- [Example 1](https://console.cloud.google.com/logs/query;cursorTimestamp=2023-04-23T00:23:07.917Z;query=%228a12929e8799adc80187ab782d3e4704%22%0Atimestamp%3D%222023-04-23T00:23:07.917Z%22%0AinsertId%3D%22ezslv1fe6cuss%22;timeRange=P2D?project=gitlab-subscriptions-prod)
- [Example 2](https://console.cloud.google.com/logs/query;cursorTimestamp=2023-04-21T15:26:16.684Z;query=%228a1280098799981d0187a46c4039269d%22%0Atimestamp%3D%222023-04-21T15:26:16.684Z%22%0AinsertId%3D%223c9my9f3023wd%22;timeRange=2023-04-21T13:10:08.487Z%2F2023-04-22T03:10:08.487Z?project=gitlab-subscriptions-prod)

### Proposal

Use the same fix as introduced in https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/3939 for the customer creation. This fix uses a lookup with `World.all_countries` before using the `ISO3166::Country.find_country_by_name` lookup to find the correct alpha3 code.

### Result

Lookup for `Korea, (Republic of)` is correctly identified as South Korea and provisioning isn't blocked by the `SanctionsChecker`.

Story points: 1.0
Sync Account worker should create a BillingAccount if it doesn't exist

### Problem

Currently the `ZuoraCallout::SyncResource::AccountWorker` logs an error and returns an unsuccessful result if a BillingAccount doesn't exist in CDot but the Zuora Account exists.  This could lead to problems where a BillingAccounts aren't available in CDot when needed.  This may also help with race conditions as we start working on a new sync mechanism for Zuora Contacts in https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6285+.

[Sentry issues for Production](https://sentry.gitlab.net/gitlab/customersgitlabcom/?query=is%3Aunresolved+No+BillingAccount+found)

### Proposal

Let's update the `ZuoraCallout::SyncResource::AccountWorker` to no longer log an error for this and instead create the BillingAccount using the data from Zuora.

Story points: 2.0
Allow admin forward of cloud activation code even if there is an activated instance present

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

Similar to https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/5530, when admin tries to forward activation code, it is blocked when existing activated instance is present.

### Proposal

Allow admin to forward activation code regardless of activation instance being present or not

### How will we measure success?

Story points: 1.0
CI minutes provisioning not working after two days of its purchase

### Problem

In https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6102+, a fix to only provision current CI minutes purchases and not future dated one was implemented. It was just discovered when investigating a [failed provision](https://gitlab.slack.com/archives/C049W1SNRV1/p1681866001597449) that this introduced a new bug which prevents to provision CI minutes if they weren't provisioned within the first two days of its purchase. It turned out that since CI minutes is a one time purchase, the effective period is only two days long:

![Screenshot_2023-04-19_at_12.55.00_PM](/uploads/49ef20d07a3ef4263710e1081ad09770/Screenshot_2023-04-19_at_12.55.00_PM.png)

Before the mentioned issues was implemented, the CustomersDot's `Order` record and its `subscription` record was used. But with the fix the `current_subscription` is used. This led to the CI minutes not being returned after those two days because of this logic [here](https://gitlab.com/gitlab-org/customers-gitlab-com/-/blob/bbc73401606fd0a45655c8c00b7f1cc35043192c/app/models/subscription.rb#L82) that only selects products where today's date is covered within their effective dates.

### Proposal

When filtering the products to be effective as of today, add a special condition to check if the product is CI minutes (`rate_plan_charge.rate_plan.product_rate_plan_id == Plan::CI_1000_MINUTES_PLAN`) AND today's date is greater or equal to the effective start date of the rate plan charge.

We could also set the effective end date to be the effective start date + 12 months which would be similar to how it's done on the [GitLab side](https://gitlab.com/gitlab-org/customers-gitlab-com/blob/a584f70cdeb9df7ecda3494daf696bf80d49c3ef/lib/add_ons/ci_minutes_params_generator.rb#L19).

### Result

Return the correct amount of purchased CI minutes for the current subscription regardless of its Zuora effective date period.

Story points: 2.0
Provision failure for cloud license undecided subscriptions

# Bug

## Summary

When self managed subscription is cloud license undecided (i.e. turn_on_cloud_licensing__c is NULL), and when a license of the same subscription already exists, provision will raise "NoMethodError: undefined method `valid?' for nil:NilClass" error.

## What is the current *bug* behavior?

Provision will fail.

## What is the expected *correct* behavior?

Provision will succeed.

## Relevant logs and/or screenshots

* https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/4124224/?query=is%3Aresolved%20%22undefined%20method%20%60valid%3F%27%20for%20nil%3ANilClass%22
* https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/4123506/?referrer=gitlab_plugin

## Workarounds

(Ways to get around the issue)

## Reported examples

A total of 5 errors has occurred.

https://customers.gitlab.com/admin/provision/44684

<!---
Please add both severity and priority level according to: https://docs.gitlab.com/ee/development/contributing/issue_workflow.html#severity-labels
--->

Story points: 1.0
Skip the invalid country validation on Customer

### Problem

As described in https://gitlab.com/groups/gitlab-org/-/epics/10349+, we want to be able to use BillingAccount Contacts more in CDot instead of using Customer data, and one area in particular for this epic is in Compliance.  We need to remove CDot's dependence on using the `country` attribute on the Customer model for compliance checks when a customer becomes a paid customer.  This allows CDot to more effectively manage BillingAccounts with multiple BillingAccountMemberships.

In particular, there are validations on this attribute on Customer model that should no longer apply for paid Customers.  In order to remove these validations, we want to make sure CDot prevents these Customers/Users from registering to begin with.  Once we effectively prevent registration and purchases, we should be able to remove the validations.

### Proposal

In this issue, CDot should skip the [invalid country validation on Customer](https://gitlab.com/gitlab-org/customers-gitlab-com/-/blob/32cde3637e1a9b987a7dcc8f6354168253ad272f/app/models/customer.rb#L50) when the `compliance_v2` feature flag is enabled.

We are able to safely remove this validation assuming other checks are in place to prevent web-direct purchases up-front.  Those checks will be handled in https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6257 and https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/6258.  This will help avoid unexpected errors that are encountered in other unrelated CDot logic.

#### Rollout

We will rollout this change behind a new feature flag called `compliance_v2`.

Story points: 1.0
Resolve Ruby 2 deprecations in workers

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [ ] `create_opportunity_for_upcoming_reconciliation_worker`:

```shell
? test_salesforce/create_opportunity_for_upcoming_reconciliation_worker#perform_when_reconciliation_id_is_absent_logs_but_does_not_raise_error_to_avoid_retry
: - |
    DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/spec/workers/salesforce/create_opportunity_for_upcoming_reconciliation_worker_spec.rb:45: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /builds/gitlab-org/customers-gitlab-com/spec/support/helpers.rb:24: warning: The called method `expect_worker_to_log_error' is defined here

```

- [ ] `zuora_callback_worker`:

```shell
? test_zuora_callback_worker#perform_with_an_active_subscription_when_customer_is_known_when_subscription_belongs_to_an_ee_plan_sends_a_license_notification_to_the_customer
: - |
    DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/spec/support/helpers/next_instance_of.rb:36: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /builds/gitlab-org/customers-gitlab-com/app/services/license_notification_service.rb:9: warning: The called method `initialize' is defined here
? test_zuora_callback_worker#perform_with_an_active_subscription_when_customer_is_known_when_subscription_belongs_to_an_ee_plan_calls_the_provisions/update_checkpoint_service
: - |
    DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/workers/zuora_callback_worker.rb:78: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /builds/gitlab-org/customers-gitlab-com/app/services/license_notification_service.rb:9: warning: The called method `initialize' is defined here
```

## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Resolve Ruby 2 deprecations in serializers

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [x] `subscription_plan_serializer`:

```shell
---
test_subscription_plan_serializer#as_json_returns_upgrade_prices:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/models/plans_finder.rb:29: warning: Passing the keyword argument as the last hash parameter is deprecated
  /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/iron_bank-5.2.6/lib/iron_bank/cacheable.rb:35: warning: The called method `where' is defined here
```

## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Resolve Ruby 2 deprecations in spec/requests

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

### Proposal

<!-- Consult with `@gitlab-com/business-technology/enterprise-apps/zuora-architects` on the ~"Enterprise Applications" team if Zuora business logic is involved. -->

### Result

### Next steps (if any)

### How will we measure success?

Story points: 1.0
Resolve Ruby 2 deprecations in models

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [ ] `subscription`:

```shell
---
test_subscription#user_count_is_expected_to_eq_311:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/spec/models/subscription_spec.rb:1221: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /builds/gitlab-org/customers-gitlab-com/spec/support/stub_zuora_calls.rb:66: warning: The called method `product_mock' is defined here

```

<hr>

- [ ] `license.yml`:

```shell
---
test_license.build_from_subscription_with_subscription_cloud_license_flags_enabled:_true_builds_a_new_record:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/lib/gem_extensions/iron_bank/local.rb:14: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /usr/local/lib/ruby/2.7.0/csv.rb:679: warning: The called method `parse' is defined here
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/models/plans_finder.rb:29: warning: Passing the keyword argument as the last hash parameter is deprecated
  /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/iron_bank-5.2.6/lib/iron_bank/cacheable.rb:35: warning: The called method `where' is defined here
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/services/salesforce/create_opportunity_objects_service.rb:8: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /builds/gitlab-org/customers-gitlab-com/app/services/salesforce/create_opportunity_objects_service.rb:12: warning: The called method `initialize' is defined here
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/models/subscription.rb:211: warning: Passing the keyword argument as the last hash parameter is deprecated
  /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/iron_bank-5.2.6/lib/iron_bank/cacheable.rb:35: warning: The called method `where' is defined here

```

<hr>

## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Resolve Ruby 2 deprecations in jobs

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [ ] `sync_expired_order_job`:

```shell
---
test_gitlab/sync_expired_order_job_yields_the_block_with_the_order_when_providing_a_block:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/jobs/gitlab/sync_expired_order_job.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /builds/gitlab-org/customers-gitlab-com/app/jobs/gitlab/sync_expired_order_job.rb:12: warning: The called method `perform' is defined here
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/lib/gem_extensions/iron_bank/local.rb:14: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /usr/local/lib/ruby/2.7.0/csv.rb:679: warning: The called method `parse' is defined here

```

<hr>

- [ ] `invoice_collect`:

```shell
---
test_zuora/operations/invoice_collect#perform_raises_error_on_connection_failure:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/activejob-7.0.4.3/lib/active_job/execution.rb:59: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /builds/gitlab-org/customers-gitlab-com/app/jobs/zuora/operations/invoice_collect.rb:8: warning: The called method `perform' is defined here

```

<hr>

- [ ] `unlinked_com_subscription_notification_job`:

```shell
---
? test_unlinked_com_subscription_notification_job_when_order_has_no_gitlab_namespace_id_does_not_call_unlinked_com_subscription_notification_service
: - |
    DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/spec/jobs/unlinked_com_subscription_notification_job_spec.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
    /builds/gitlab-org/customers-gitlab-com/app/jobs/unlinked_com_subscription_notification_job.rb:9: warning: The called method `perform' is defined here

```

<hr>

## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Resolve Ruby 2 deprecations in finders

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [ ] `invoices_finder`:

```shell
---
test_invoices_finder.for_zuora_account_find_payments_through_zuora/payment:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/app/finders/invoices_finder.rb:19: warning: Passing the keyword argument as the last hash parameter is deprecated
  /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/iron_bank-5.2.6/lib/iron_bank/queryable.rb:46: warning: The called method `where' is defined here

```

<hr>


## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Resolve Ruby 2 deprecations in spec/features

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

### Proposal

<!-- Consult with `@gitlab-com/business-technology/enterprise-apps/zuora-architects` on the ~"Enterprise Applications" team if Zuora business logic is involved. -->

### Result

### Next steps (if any)

### How will we measure success?

Story points: 1.0
Resolve Ruby 2 deprecations in experiments

# Using the last argument as keyword parameters is deprecated

Deprecation messages:

- [ ] `application_experiment`:

```shell
---
test_application_experiment#track_tracks_the_event_with_the_expected_arguments_and_merged_contexts:
- |
  DEPRECATION WARNING: /builds/gitlab-org/customers-gitlab-com/vendor/ruby/2.7.0/gems/rspec-mocks-3.12.3/lib/rspec/mocks/message_expectation.rb:143: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
  /builds/gitlab-org/customers-gitlab-com/lib/gitlab/tracking.rb:62: warning: The called method `event' is defined here

```

<hr>

## How to resolve?

- Option 1: maybe `**` should be added to the call?
- Option 2: Rewrite the code to keyword arguments completely.

Story points: 1.0
Automate gem cache update when Gemfile lock is updated

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem
Changes to our gems causes our cache-assets job to fail. We currently have to manually run the `cache-gems-update` job to resolve the failures.

### Proposal
Automate the job so it runs automatically when Gemfile/lock changes are detected.


<!-- Consult with `@gitlab-com/business-technology/enterprise-apps/zuora-architects` on the ~"Enterprise Applications" team if Zuora business logic is involved. -->

### Result
No manual intervention is required when gems are updated.

### Next steps (if any)
Also investigate if this is an issue for node dependencies. If so, create an issue to automatically run `cache-node-updates` on changes.

### How will we measure success?

Story points: 1.0
Two specs using zuora_payment_iframe failing

### Problem

Two specs in the `rspec` job are causing failing frequently and causing many failing pipelines.

```
Failures:
  1) purchase new cloud subscriptions without payment methods successfully purchase a GitLab.com subscription
     Failure/Error: expect(page).to have_no_css('.gl-spinner-container')
       expected not to find visible css ".gl-spinner-container", found 1 match: ""
     # ./spec/features/new_gitlab_subscription_spec.rb:64:in `block (3 levels) in <top (required)>'
  2) purchase new EE Subscriptions when payment method does not exist successfully purchase an EE subscription
     Failure/Error:
       within_frame(find(:css, 'iframe#z_hppm_iframe')) do
         find('#input-creditCardNumber').set(credit_card_number)
         select(exp_month, from: 'input-creditCardExpirationMonth')
         select(exp_year, from: 'input-creditCardExpirationYear')
         find('#input-cardSecurityCode').set(cvv)
         find('#input-creditCardHolderName').set(name)
       end
     Capybara::ElementNotFound:
       Unable to find visible css "iframe#z_hppm_iframe"
     # ./spec/support/helpers/zuora_iframe_test_helpers.rb:13:in `fill_zuora_payment_iframe'
     # ./spec/features/new_ee_subscription_spec.rb:59:in `block (3 levels) in <top (required)>'
```

### Proposal

Determine what caused these to fail now or at least find a solution to get them passing again.

Story points: 1.0