Skip to content

fix: correct Encarnación spelling and accent-insensitive address matching (4.x) - #709

Open
kaio-donadelli wants to merge 5 commits into
4.xfrom
feat/loc-28704-pry-encarnacion-4x
Open

fix: correct Encarnación spelling and accent-insensitive address matching (4.x)#709
kaio-donadelli wants to merge 5 commits into
4.xfrom
feat/loc-28704-pry-encarnacion-4x

Conversation

@kaio-donadelli

@kaio-donadelli kaio-donadelli commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

Backport Paraguay Encarnación spelling fix to 4.x, including saved-address compatibility and postal code selector fixes.

Summary

  • Rename EncarnacionEncarnación in react/country/PRY.js
  • Align validateAddress.js with main (accent-insensitive matching, geolocation-aware normalizers)
  • Resolve nested optionsMap and postal code lookups with cleanStr
  • Fix SelectPostalCode blank value for saved addresses with legacy spelling
  • Fix SLV geolocation example in messages/en.json (was Ljubljana)
  • Sync missing geolocation example keys in messages/context.json from main

Tests

  • validateAddress, fields, postalCode, and SelectPostalCode regression tests with country/__mocks__ fixtures

Tracked in LOC-28704

kaio-donadelli and others added 2 commits August 26, 2026 08:11
LOC-28704 — cocacolapy requested the accented city name in Itapúa.

Co-authored-by: Cursor <cursoragent@cursor.com>
Backport 33 geolocation example keys from main so lint:locales passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-pr-sentinel

vtex-pr-sentinel Bot commented Aug 26, 2026

Copy link
Copy Markdown

🛡️ SDD Check — action required

I couldn't detect an SDD in this PR. Please check one option below (requires write access to the repo):

  • SDD lives in another PR — paste the SDD PR URL here:
  • This PR doesn't need an SDD
  • SDD applies, but I'm not adopting it in this PR

@fdaciuk fdaciuk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um achado bloqueante: o rename quebra a validação de endereços já salvos com a grafia antiga.

Comment thread react/country/PRY.js
Comment thread messages/context.json Outdated
Comment thread CHANGELOG.md Outdated
Use accent-insensitive matching for saved addresses, fix SLV example, and add regression test.

Co-authored-by: Cursor <cursoragent@cursor.com>

@fdaciuk fdaciuk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dois cenários deixam o campo de CEP em branco mesmo com o endereço validado (Paraguai e países de 3 níveis), e a correção do exemplo do SLV não chega ao usuário final.

Comment thread react/validateAddress.js Outdated
Comment thread react/validateAddress.js Outdated
Comment thread messages/context.json
Comment thread react/validateAddress.test.js
Normalize nested optionsMap keys, resolve SelectPostalCode values, align
validateAddress with main, and fix SLV geolocation example in en.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kaio-donadelli kaio-donadelli changed the title fix: correct Encarnación spelling in Paraguay country data fix: correct Encarnación spelling and accent-insensitive address matching (4.x) Aug 27, 2026
Replace Ljubljana placeholder with San Salvador address, keeping each locale prefix.

Co-authored-by: Cursor <cursoragent@cursor.com>

@fdaciuk fdaciuk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assunto anterior todo resolvido. Ficaram 4 pontos novos no diff deste round, um deles é só uma pergunta.

Comment thread react/validateAddress.js
}

function getOptionValueNormalizer(fieldName, address) {
if (address[fieldName]?.geolocationAutoCompleted) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isso é intencional? Para campos vindos de geolocalização, a comparação continua exigindo acento certo (normalizeOptionValueStrict), então o mesmo problema de acento que este PR resolve para endereços salvos manualmente pode persistir aqui. Combinado com omitAutoCompletedFields, o campo inválido fica oculto do formulário sem o usuário conseguir corrigir. Se for proposital (fix restrito a endereços salvos), pode ignorar.

expect(validCityOption.valid).toBe(true)
})

it('should validate if a field option matches even if accents differ', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nenhum teste cobre o caminho estrito de geolocationAutoCompleted (linha 159 de validateAddress.js). Todos os testes de acento aqui usam endereços sem essa flag — se a condição for invertida por engano, a suíte continua passando. Vale um teste cobrindo esse caminho.

'Encarnacion',
'city',
validAddress,
accentInsensitiveValidationRules

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esse teste validava o arquivo real react/country/PRY.js (via pryRules) — o arquivo cujo erro de grafia este PR corrige. Trocado por accentInsensitiveValidationRules, um mock próprio, nenhum teste no repositório lê mais o PRY.js real. Se o acento for perdido de novo lá, nenhum teste avisa.

option.postalCode === postalCodeValue
)

return matchingOption ? matchingOption.label : fieldValue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getResolvedPostalCodeFieldLabel tem três caminhos e só o caminho feliz é testado. Faltam casos para: sem CEP salvo (deveria retornar null, linha 70) e quando o CEP salvo não bate com nenhuma opção — aqui a função devolve o valor bruto e o select volta a ficar em branco, reproduzindo em silêncio o bug que este PR corrige.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants