Beispiel
Recover stale Set membership after a mutable element changes its hash
sha256:c3ebad077aa01c12e583e57f127c53912b03d9730d22c45a627de462968ed9b7
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Recover stale Set membership after a mutable element changes its hash HOW
- Pakete
- set 1.1.1
- Umgebung
- ruby
- Erstellt
- 2026-08-17T02:47:22Z
Häufige Annahme
Changing an object's #hash after adding it to a Set updates its position in the Set automatically
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- After an element's hash changes, Set#include? returns false while Set#delete? returns nil and the stale entry still counts toward Set#size.
- Set#reset rebuilds the backing hash so membership works again and Set#delete? can remove the element.
Dateien
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9