Skip to content

feat: Enhance seed_data command with currency, country, and Faker l…#664

Merged
ashwin31 merged 1 commit intomasterfrom
sf_import
Mar 1, 2026
Merged

feat: Enhance seed_data command with currency, country, and Faker l…#664
ashwin31 merged 1 commit intomasterfrom
sf_import

Conversation

@ashwin31
Copy link
Copy Markdown
Member

@ashwin31 ashwin31 commented Mar 1, 2026

…ocale options, and update frontend dependencies.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added demonstration video to README for product overview and onboarding reference.
  • New Features

    • Added support for custom currency and country configuration during test data seeding operations.
  • Chores

    • Updated frontend dependencies and development tools to latest stable versions.
    • Optimized frontend build configuration.

…ocale options, and update frontend dependencies.
Copilot AI review requested due to automatic review settings March 1, 2026 07:50
import adapter from '@sveltejs/adapter-node';

const config = { kit: {
const config = { vitePlugin: {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca6afa and a6a4b67.

⛔ Files ignored due to path filters (1)
  • frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • README.md
  • backend/common/management/commands/seed_data.py
  • frontend/package.json
  • frontend/svelte.config.js
  • frontend/vite.config.js

📝 Walkthrough

Walkthrough

The pull request enhances the seed data command with currency and country customization options, updates frontend dependencies with incremental version bumps, adjusts Svelte and Vite configuration for improved bundling, and adds a demonstration video link to the README.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added demonstration video link reference to docs/media/demo.webm after coverage badge.
Backend Seeding
backend/common/management/commands/seed_data.py
Added COUNTRY_FAKER_LOCALES mapping and --currency/--country CLI options with validation. Updated create_org method signature to accept currency and country parameters, which now propagate to Org defaults. Faker initialization uses country-specific locale. Console output includes Currency, Country, and Locale information.
Frontend Dependencies
frontend/package.json
Incremental version bumps across multiple dependencies (@sveltejs/kit, svelte, @types/node, globals, libphonenumber-js, @sentry/sveltekit, axios, svelte-check, @sveltejs/adapter-node). Added vite 7.3.1 to devDependencies.
Frontend Configuration
frontend/svelte.config.js
Added top-level vitePlugin property with prebundleSvelteLibraries set to false, while preserving existing kit configuration.
Frontend Build Config
frontend/vite.config.js
Removed optimizeDeps exclusion for 'esm-env', discontinuing explicit dependency optimization override.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 With currencies dancing and countries taking flight,
The seedlings now sprout in each locale's light!
Frontend deps fresh, Vite configs refined,
A demo awaits—see what we've designed!
From hopping through code to bundling with care,
This patch brings improvements everywhere! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sf_import

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ashwin31 ashwin31 merged commit d6a2960 into master Mar 1, 2026
7 of 8 checks passed
@ashwin31 ashwin31 deleted the sf_import branch March 1, 2026 07:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the Django seed_data management command to support specifying organization currency/country (and aligning Faker locale accordingly), and updates the SvelteKit frontend build configuration/dependencies (notably Sentry/SvelteKit-related tooling).

Changes:

  • Add --currency / --country options to seed_data and use them when creating orgs and address-related records.
  • Initialize Faker using a locale derived from the provided country code.
  • Update frontend dependencies/lockfile and adjust Svelte/Vite config related to dependency prebundling.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/vite.config.js Removes optimizeDeps.exclude for esm-env while keeping Sentry/Tailwind/SvelteKit Vite plugin setup.
frontend/svelte.config.js Disables prebundling of Svelte libraries via vitePlugin.prebundleSvelteLibraries.
frontend/package.json Bumps SvelteKit/Sentry/Axios/etc. versions.
frontend/pnpm-lock.yaml Updates dependency graph to match the bumped frontend packages (including new transitive deps).
backend/common/management/commands/seed_data.py Adds currency/country CLI options, sets Faker locale from country, and uses org defaults for country/currency in seeded records.
README.md Adds a demo video link.
Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

def handle(self, *args, **options):
# Initialize Faker
# Initialize Faker with locale matching the country
country = options["country"].upper()
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

country is normalized to uppercase for locale selection, but the normalized value isn’t persisted back into options. Later seed_all() passes options["country"] into create_org(), so org/default_country (and downstream Contact/Account/Lead countries) can end up lowercased or otherwise different from what’s logged. Consider normalizing once (e.g., overwrite options["country"] with the uppercased value) and consistently pass/store the normalized country code.

Suggested change
country = options["country"].upper()
country = options["country"].upper()
options["country"] = country

Copilot uses AI. Check for mistakes.
Comment on lines 280 to +286
seed = options.get("seed")
if seed:
random.seed(seed)
self.fake = Faker(["en_US"])
self.fake = Faker([locale])
Faker.seed(seed)
else:
self.fake = Faker(["en_US", "en_GB", "en_CA", "en_AU"])
self.fake = Faker([locale])
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

if seed: treats 0 as “no seed”, so --seed 0 won’t actually seed random/Faker and will produce non-deterministic results. Use an explicit None check (e.g., if seed is not None:) so all integer seeds work.

Copilot uses AI. Check for mistakes.
Comment on lines +213 to +218
parser.add_argument(
"--country",
type=str,
default="US",
help="Default country code for organizations (default: US). Examples: US, GB, CA, AU, DE, FR, IN",
)
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

--country accepts any string, but Org.default_country is a CharField(max_length=2, choices=COUNTRIES). Passing a value longer than 2 characters (or not in the allowed choices) will raise a DB error during Org.objects.create(...) or create inconsistent seed data. Consider constraining the argument (choices and/or length validation) and normalizing to uppercase at parse-time.

Copilot uses AI. Check for mistakes.
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