Skip to content

Conversation

nikochiko
Copy link
Member

@nikochiko nikochiko commented Sep 17, 2025

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

You can visualize this using tuna:

python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

Copy link

coderabbitai bot commented Sep 17, 2025

📝 Walkthrough

Walkthrough

Reworked email parsing in routers/workspace.py: validate_emails_csv now extracts emails using a compiled regex (email_re) via findall instead of splitting by delimiters. Deduplication and normalization are done with a set comprehension that lowercases entries. The result is converted back to a list and truncated to max_emails. Validation still uses validate_email and raises ValidationError on invalid entries. The function signature and return type remain unchanged, and delimiter-related code was removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • devxpy

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix: capture all kinds of emails in workspace-invite csv input" is concise, single-sentence, and directly summarizes the primary change (improved email extraction/parsing for workspace-invite CSVs, as reflected in routers/workspace.py), making it clear to reviewers what the patch addresses. It avoids noise and accurately reflects the main changeset focus.
Description Check ✅ Passed The PR description follows the repository template: it contains the Q/A checklist, the collapsible "How to check import time" section with example commands, and the legal boilerplate, so the required template structure is present and largely complete. It would aid reviewers if the author adds a short one-paragraph summary of the code-level changes (files touched and the high-level behavior change), but the description meets the template requirements as provided.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch permissive-email-invites

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
routers/workspace.py (2)

292-292: Broaden local-part, tighten domain labels in regex (more capture, fewer false positives).

Current pattern misses valid chars like '!#$&*=/{}?^~ and wrongly allows _ in domain labels. Recommend:

  • Local-part: allow RFC‑5322 common set.
  • Domain: [A-Za-z0-9-] labels, TLD 2–63.

Apply this diff:

-email_re = re.compile(r"[\w\-\.+%]+@(?:[\w-]+\.)+[\w-]{2,}")
+# More permissive local-part, stricter domain labels (extraction only; Django validate_email does final validation)
+email_re = re.compile(
+    r"[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,63}"
+)

298-301: Avoid nondeterministic truncation; preserve order and lowercase domain only.

  • Set destroys input order; slicing after it can invite an arbitrary subset when >max_emails.
  • Lowercasing entire address alters case of local-part (technically case‑sensitive). Prefer domain‑only lowercasing and case‑insensitive dedup keys.

Apply this diff:

-emails = email_re.findall(emails_csv)
-emails = {email.lower() for email in emails}  # lowercase + remove duplicates
-emails = list(emails)[:max_emails]  # take up to max_emails from the list
+# Preserve input order, dedupe case-insensitively, and lowercase domain only
+seen = set()
+emails = []
+for m in email_re.finditer(emails_csv):
+    e = m.group(0)
+    local, _, domain = e.rpartition("@")
+    normalized = f"{local}@{domain.lower()}" if domain else e
+    key = normalized.casefold()
+    if key not in seen:
+        seen.add(key)
+        emails.append(normalized)
+emails = emails[:max_emails]

Note: Consider updating the textarea label (Lines 236–238) to drop “separated by commas” since parsing is now free‑form.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34a9f75 and 01cff04.

📒 Files selected for processing (1)
  • routers/workspace.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10.12, 1.8.3)

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