Incrementing a value into the negative does not work
- Lingua principale
- Ruby
- Stelle
- 700
- Fork
- 29
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
When using the [`increment`](https://github.com/github/github-ds/blob/f964ab2d75272d5b5d2fef68416abcab7bd2dc3a/lib/github/kv.rb#L287) method, if you increment the value below 0, the output is unexpected and subsequent `increment`s fail.
```ruby
> GitHub.kv.get(kv_key).value! { 0 }
nil
> GitHub.kv.increment(kv_key)
1
> GitHub.kv.get(kv_key).value! { 0 }
"1"
> GitHub.kv.increment(kv_key, amount: -2)
18446744073709551615
> GitHub.kv.get(kv_key).value! { 0 }
"18446744073709551615"
> GitHub.kv.increment(kv_key, amount: 2)
eval error: GitHub::KV::InvalidValueError
vendor/gems/3.2.2/ruby/3.2.0/gems/github-ds-0.5.2.10.g8cf56ba:in `block in increment'
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start in lib/github/kv.rb at the increment method around line 287 and reproduce the documented sequence, including the negative amount. Done means incrementing below zero produces the intended value and a later positive increment no longer raises InvalidValueError; add or update focused coverage if the repository provides a relevant test location.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- ruby
- Ambito
- database
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100