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

BReg: the facility example's address correction writes the untrimmed postal code

Aperta Adatta ai principianti
#2,227 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
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend, testing

Direzione di ricerca

Leggi products/breg/examples/facility/plans/correct-address.rhai, in particolare la pulizia dell’input e l’assegnazione dell’effetto intorno alla riga 20. Poi esamina crates/registry-bregctl/tests/refactor_cli_contract.rs per vedere come costruisce l’esempio facility ed esegue action-test. Aggiungi un caso con un codice postale con spazi iniziali e finali che si aspetti "1234"; il lavoro è concluso quando il caso passa e l’effetto memorizza il valore senza spazi.

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

Descrizione

area:breg bug

The facility example's address correction Action trims the postal code, checks it, and then
writes the original input. products/breg/examples/facility/plans/correct-address.rhai reads
the input on line 2, calls postal_code.trim() on line 3 (Rhai's trim changes the string in
place and returns nothing), refuses an empty value on line 4, and then on line 20 sets the field
from ctx.inputs["postal-code"] instead of postal_code. A padded value passes the check and is
stored with its spaces. Readers copy this example as the pattern for input cleanup, so it
teaches the bug.

Minimal repro, with a copy of products/breg/examples/facility in facility/:

cat > in.json <<'E'
{"facility":"00000000-0000-4000-8000-000000000001","address-line":"2 Market Street","city":"Example city","postal-code":" 1234 "}
E
cat > trimmed.json <<'E'
{"effects":[{"id":"facility-address","set":{"address-line":"2 Market Street","city":"Example city","postal-code":"1234"}}]}
E
bregctl --format json project action-test --action correct-address --input in.json --expect trimmed.json facility

The run fails with action-test.expect.mismatch at expect/effects/0/set/postal-code. The same
run passes when the expectation's postal-code is " 1234 ".

Expected: the effect sets postal-code to "1234".

Likely fix: on line 20 of correct-address.rhai, write "postal-code": postal_code. The docs
page docs/site/src/content/docs/configure/breg-actions.mdx excerpts only lines 1 to 11 of this
script (its test-excerpt), so the excerpt gate is unaffected.

Tests: the example has no action-test case today. crates/registry-bregctl/tests/refactor_cli_contract.rs
already builds a project from products/breg/examples/facility; an action-test run there with
a padded postal code and an --expect of "1234" would pin the behavior. The example's own
examples/inputs/correction.json uses an unpadded postal code, so it does not catch this.

Lingua principale
Rust
Stelle
2
Fork
0
Merge medio
9h 19m
PR unite (30g)
275

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 registrystack/registry-stack

Tutte le issue di registrystack/registry-stack

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.