gitlab-labkit 0.41.0 → 0.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 762df6d0e3348526c7b49929a3a6cdd82db05c80a9d83569a76bd10ddb131ca2
4
- data.tar.gz: 0affeb965dd17cfc202a0b64419d46bb92419a051a70972cbab5d57e5844d027
3
+ metadata.gz: 0d9f3f7db908df4f839a96f74ce39650dad4a132e5b72e3ac4d7fb1358bc48f1
4
+ data.tar.gz: 125b63a4f1716bfbb8dca8ab986c5f824dd2a56f8df46079041c6c62f5e385e5
5
5
  SHA512:
6
- metadata.gz: c703503bc9cf08155d72a0ffc61f7f8cc2c573353d67382e7b4d7b22ea554c2a14ee2e2d04f8804696fa95584843cd4a342cbcdb5e9cb8ac775bd0d36df006b3
7
- data.tar.gz: 2a598ffe29d7382689637c605db8ba721c993e3fc4b033176b273b99515033577b16d82961007bb9e99da3feac5ec2419e58c7a45b354dfd820e4d9bfa9baa4b
6
+ metadata.gz: 92907d96e457abebe07567df0506f80c585f159ead4b78b6bdf8c57b3eb82d19c7700b88d2733415dad5c0d3bba792c23ae9b1e2281df9fef6ec44b7069d453c
7
+ data.tar.gz: 678ab5ad3290e93ff0682ef1f5f08681ea85e01c65919c3c16f21c95949065fa70c20507499b20c2c72f1a856838650fe79963533b529a463d9fc5a6f99a3bfc
data/.copier-answers.yml CHANGED
@@ -3,7 +3,7 @@
3
3
  # See the project for instructions on how to update the project
4
4
  #
5
5
  # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
6
- _commit: v1.35.1
6
+ _commit: v1.36.0
7
7
  _src_path: https://gitlab.com/gitlab-com/gl-infra/common-template-copier.git
8
8
  ee_licensed: false
9
9
  golang: false
@@ -1,5 +1,5 @@
1
1
  # DO NOT MANUALLY EDIT; Run ./scripts/update-asdf-version-variables.sh to update this
2
2
  variables:
3
- GL_ASDF_RUBY_VERSION: "3.4.5"
3
+ GL_ASDF_RUBY_VERSION: "3.4.6"
4
4
  GL_ASDF_SHELLCHECK_VERSION: "0.11"
5
5
  GL_ASDF_SHFMT_VERSION: "3.12"
data/.tool-versions CHANGED
@@ -1,3 +1,3 @@
1
- ruby 3.4.5
1
+ ruby 3.4.6
2
2
  shfmt 3.12
3
3
  shellcheck 0.11
@@ -149,7 +149,7 @@ experience.checkpoint
149
149
  experience.complete
150
150
  ```
151
151
 
152
- **Note:** The `resume` method loads the start time from the Labkit context. If no covered experience data exists in the context, it behaves the same as calling methods on an unstarted experience (raises `UnstartedError` in development/test environments, or safely ignores in other environments).
152
+ **Note:** The `resume` method loads the start time from the Labkit context. If no covered experience data exists in the context, it behaves the same as calling methods on an unstarted experience and safely ignores the operation.
153
153
 
154
154
  ### Error Handling
155
155
 
@@ -182,4 +182,4 @@ end
182
182
 
183
183
  - In `development` and `test` environments, accessing a non-existent covered experience will raise a `NotFoundError`
184
184
  - In other environments, a null object is returned that safely ignores all method calls
185
- - Attempting to checkpoint or complete an unstarted experience will raise an `UnstartedError` in `development` and `test` environments
185
+ - Attempting to checkpoint or complete an unstarted experience will safely ignore the operation
@@ -3,8 +3,6 @@
3
3
  module Labkit
4
4
  module CoveredExperience
5
5
  CoveredExperienceError = Class.new(StandardError)
6
- UnstartedError = Class.new(CoveredExperienceError)
7
- CompletedError = Class.new(CoveredExperienceError)
8
6
  NotFoundError = Class.new(CoveredExperienceError)
9
7
  ReservedKeywordError = Class.new(CoveredExperienceError)
10
8
  end
@@ -90,7 +90,6 @@ module Labkit
90
90
  # Checkpoint the Covered Experience.
91
91
  #
92
92
  # @param extra [Hash] Additional data to include in the log event
93
- # @raise [UnstartedError] If the experience has not been started and RAILS_ENV is development or test.
94
93
  # @return [self]
95
94
  def checkpoint(**extra)
96
95
  return unless ensure_started!
@@ -119,7 +118,6 @@ module Labkit
119
118
  # Complete the Covered Experience.
120
119
  #
121
120
  # @param extra [Hash] Additional data to include in the log event
122
- # @raise [UnstartedError] If the experience has not been started and RAILS_ENV is development or test.
123
121
  # @return [self]
124
122
  def complete(**extra)
125
123
  return unless ensure_started!
@@ -166,10 +164,8 @@ module Labkit
166
164
  def ensure_started!
167
165
  return @start_time unless @start_time.nil?
168
166
 
169
- err = UnstartedError.new("Covered Experience #{@definition.covered_experience} not started")
170
-
171
- warn(err)
172
- raise(err) if %w[development test].include?(ENV['RAILS_ENV'])
167
+ warn("Covered Experience #{@definition.covered_experience} not started")
168
+ false
173
169
  end
174
170
 
175
171
  def completable(**extra, &)
@@ -188,10 +184,8 @@ module Labkit
188
184
  def ensure_incomplete!
189
185
  return true if @end_time.nil?
190
186
 
191
- err = CompletedError.new("Covered Experience #{@definition.covered_experience} already completed")
192
-
193
- warn(err)
194
- raise(err) if %w[development test].include?(ENV['RAILS_ENV'])
187
+ warn("Covered Experience #{@definition.covered_experience} already completed")
188
+ false
195
189
  end
196
190
 
197
191
  def urgency_threshold
@@ -199,6 +193,8 @@ module Labkit
199
193
  end
200
194
 
201
195
  def elapsed_time
196
+ return 0 unless @start_time
197
+
202
198
  last_time = @end_time || @checkpoint_time || @start_time
203
199
  last_time - @start_time
204
200
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.41.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate