googleapis / googleapis/ruby-cloud-env
warmup_time: nil crashes metadata existence checks
- 主要言語
- Ruby
- スター
- 16
- フォーク
- 12
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
## Summary
`ComputeMetadata#warmup_time` is writable and documented as a duration, but assigning `nil` to disable the warmup window leads to arithmetic/comparison errors in both `ensure_existence` and `post_update_existence`.
## Reproduction
On current `main` (`7936c72eb2c809214858f47473aafb04c6bbf469`):
1. Create a `ComputeMetadata` instance.
2. Set `warmup_time = nil`.
3. Call `ensure_existence`, or exercise a failed existence update.
The former evaluates `@startup_time + nil`; the latter compares time against the same expression.
## Proposed correction
Treat `nil` as no warmup window: use the normal minimum one-second explicit check in `ensure_existence`, and allow a failed existence probe to settle to `:no` immediately. I verified the focused disabled-warmup model and the full current suite (91 runs / 419 assertions / 0 failures / 0 errors / 2 skips).
If `nil` is not intended to be supported, rejecting it in the writer would make the contract explicit; silently accepting it and failing later is the current correctness issue.
I used an AI coding assistant during investigation and verification. I am opening this issue first because this repository requires tests and a Google CLA for pull requests; I have not modified repository tests or signed a CLA as part of this audit.
コントリビューションガイド
調査の方向性
ComputeMetadata#warmup_time から始め、その ensure_existence と post_update_existence での使用箇所を追跡します。nil の warmup_time に対するリグレッションカバレッジを追加し、ensure_existence が最小限の明示的チェックを使用し、失敗した存在プローブが :no に落ち着くことを確認します。無効化されたウォームアップに関する対象モデルテストと完全なスイートを実行して、完了を確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ruby
- 領域
- cloud
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 72/100