Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[correctness][missing-coverage][sort] Strict uniqueness checks lack numeric-key equivalence coverage

Chiusa Adatta ai principianti
#639 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli, testing

Direzione di ricerca

Inizia da tests/scenarios/cmd/sort/flags/check_unique_numeric_keys.yaml, la posizione suggerita per il test di regressione, e confrontalo con TestSortCheckUniqueDuplicates, che copre record uguali anziché record distinti con chiavi uguali. Esegui i test degli scenari sort in ./tests usando il comando mostrato nell’issue. Il lavoro è completato quando il caso di regressione verifica che sort -cu -t: -k2,2n rifiuta chiavi selezionate numericamente equivalenti, come GNU sort.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Generated by the rshell behavior correctness scanner.

  • Contract: BEH-007
  • Classification: missing-coverage
  • Impact: low
  • Target: sort
  • Scanned commit: 514d1cb8188fda6b1accca5955dfab3b0e8aa34a

Existing strict-uniqueness check tests use identical whole records. They do not establish that distinct records with numerically equivalent selected keys count as disorder under -cu. The implementation correctly rejected the tested equivalent keys; no defect was demonstrated.

Contract sources
  • docs/BEHAVIOR_CONTRACTS.md:63-66: Deterministic numeric sorting and record ordering must match the selected oracle.
  • SHELL_FEATURES.md:33: Supports combined check, unique, separator, and key options.
  • GNU sort --help and /usr/bin/sort: -u with -c checks strict ordering; numeric keys 1 and 01 compare equally.
Implementation references
  • builtins/sort/sort.go:343-347: Uniqueness disables the whole-record fallback comparison.
  • builtins/sort/sort.go:1209-1219: Treats equal adjacent comparison keys as disorder when unique checking is enabled.

Fixture setup

No files required. Both engines ran twice with LC_ALL=C from fresh zz_correctness_scan_ temporary directories.

Reproducer

printf 'a:1\na:01\nb:2\n' | sort -cu -t: -k2,2n

Commands used:

  • GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell
  • /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort,rshell:printf -c "printf 'a:1\na:01\nb:2\n' | sort -cu -t: -k2,2n"
  • LC_ALL=C bash -c "printf 'a:1\na:01\nb:2\n' | sort -cu -t: -k2,2n"
  • GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/^cmd$/^sort$/^(basic|flags|errors|help|pathological|zz_correctness_scan_cases)$' -count=2 -timeout 240s

Verification

  • Reproduction runs: 2
  • Reference: Matched GNU coreutils 9.4 twice, including exact stdin disorder diagnostic and status. Temporary scenario passed twice. Existing TestSortCheckUniqueDuplicates covers equal records rather than distinct records with equal keys.
  • Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_check_unique_keys.yaml; removed after verification. Script, stdout, and stderr used YAML |+ scalars.
  • Suggested regression-test location: tests/scenarios/cmd/sort/flags/check_unique_numeric_keys.yaml

Fingerprint: 51465031c50fd881568a759c4f11f4765cd221bee89cf82c2615f946c6a8cc74

Lingua principale
Go
Stelle
31
Fork
3
Merge medio
1g 2h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DataDog/rshell

Tutte le issue di DataDog/rshell

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.