LF-5225: Unable to create a farm in Belarus or Venezuela due to currency validation error#4097
Open
litefarm-pr-bot wants to merge 2 commits intointegrationfrom
Conversation
- Add BYN (Belarusian ruble, current) to farmModel currency enum alongside legacy BYR (pre-2016 redenomination) for backward compatibility - Add VES (Venezuelan bolívar soberano, current) to enum alongside legacy VEF (pre-2018 redenomination) for backward compatibility - Add migration to align Venezuela ISO in countries table: prod still had deprecated VEF; migration updates to VES, filtered defensively on both country_code and iso so it is a no-op on beta where VES is already present Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
units.currencyfield on theFarmmodel uses a hardcoded JSON Schema enum of allowed ISO 4217 currency codes. This enum was last updated several years ago and does not include codes introduced by two currency redenominations: Belarus replacedBYR(Belarusian ruble, old) withBYN(Belarusian ruble, current) in 2016, and Venezuela replacedVEF(bolívar fuerte, old) withVES(bolívar soberano, current) in 2018. When a user attempts to create a farm in either country, the app resolves the currency ISO from thecountriestable — which already contains the current codes — and submits it to the API, where Objection.js rejects it with aModelValidationenum error, blocking farm creation entirely.The fix adds
BYNandVESto the enum alongside the existing deprecated codesBYRandVEF. The old codes are intentionally kept: removing them would break validation for any existing farm records that were created when those codes were valid. A migration aligns Venezuela's ISO in thecountriestable between environments: production still heldVEFwhile beta had already been updated toVES. The migration filters on bothcountry_codeandiso, making it a no-op on beta (whereVESis already present) and safely idempotent.Note: Belarus required only the enum fix — both environments already store
BYNin thecountriestable. The environment divergence was specific to Venezuela. The table below summarises the full picture:BYR(pre-2016)BYNBYNBYNBYRonlyBYR+BYNVEF(pre-2018)VESVESVEF→ migrated toVESVEFonlyVEF+VESJira link: https://lite-farm.atlassian.net/browse/LF-5225
Type of change
How Has This Been Tested?
Changes reviewed in source code. The enum additions were verified against the countries table exports from both beta and production. The migration was verified to be defensive (filters on both
country_codeandiso) and confirmed to have identical starting state on both environments for all affected rows. No local API environment was spun up; CI will run the full test suite.Checklist:
pnpm i18nto help with this)