fix/seed-company-settings-pagination-batch-dry-run [ GSSOC ]#827
Conversation
|
@rudra3007-pro is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Hi @rudra3007-pro! 🙌 Thank you so much for your excellent contribution: "fix/seed-company-settings-pagination-batch-dry-run [ GSSOC ]"! We really appreciate the high-quality code and effort you have put into the platform. Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below. Once those manual steps are verified, we'll get your PR officially merged into the Let's build something amazing together! 🚀🔥 🌟 Community Support & Network Steps (Take 10 Seconds!)As we prepare our manual verification and merging queues, please make sure you have taken a moment to complete these required steps to finalize your points:
Note: Having these steps completed manually is required before your PR points are officially cleared. |
|
Hi @rudra3007-pro! 🙌 Thank you so much for your excellent contribution: "fix/seed-company-settings-pagination-batch-dry-run [ GSSOC ]"! We really appreciate the high-quality code and effort you have put into the platform. Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below. Once those manual steps are verified, we'll get your PR officially merged into the Let's build something amazing together! 🚀🔥 🌟 Community Support & Network Steps (Take 10 Seconds!)As we prepare our manual verification and merging queues, please make sure you have taken a moment to complete these required steps to finalize your points:
Note: Having these steps completed manually is required before your PR points are officially cleared. |
Closes #826
────────────────────────────────────────────────────────────
Summary
Fixes silent data truncation (> 1 000 rows), reduces N insert round-trips to 1,
eliminates the duplicate Supabase client, and adds a --dry-run flag for safe
production previews. All changes are backward-compatible; default behaviour
is identical for installations under 1 000 tickets.
────────────────────────────────────────────────────────────
What Changed
New helpers
_build_client()— constructs the Supabase client from env vars with a clearEnvironmentError if either variable is missing; called once in main and
passed down.
_fetch_all_pages(client, table, select)— range-based paginator that loopsuntil a page smaller than _SUPABASE_PAGE_SIZE (1 000) is returned. Used by
both
_get_unique_company_idsand_get_existing_company_ids._build_records(company_ids)— builds the list of dicts for batch insert,including an explicit
created_attimestamp._parse_args()— argparse-based CLI with--dry-runflag.seed_company_settings()
client: Clientanddry_run: boolinstead of creating its ownclient.
insert(records).execute().verify_seed()
client: Client— no secondcreate_client()call._get_unique_company_ids/_get_existing_company_idshelpers.Removed
count="exact"from all.select()calls (result was never read).create_client()calls inside both functions.────────────────────────────────────────────────────────────
Risk & Compatibility
created_at.--dry-runexits 0 always; existing CI invocations without the flag areunaffected.
────────────────────────────────────────────────────────────
Testing Done