Skip to content

Downgrade missing required CSV column from error to warning#161

Open
claudear wants to merge 1 commit intomainfrom
fix/csv-missing-required-column-warning-v2
Open

Downgrade missing required CSV column from error to warning#161
claudear wants to merge 1 commit intomainfrom
fix/csv-missing-required-column-warning-v2

Conversation

@claudear
Copy link

Summary

  • When importing a CSV that doesn't include all required columns from the database schema, the validateCSVHeaders method was throwing an exception that aborted the entire import
  • Changed the behavior to emit a warning instead, allowing the import to proceed with null values for missing columns
  • The database layer will handle actual constraint violations per-row, giving users partial import instead of total failure
  • This fixes the Sentry error CLOUD-3K9V: "CSV header validation failed: Missing required column: 'texte'" (11 occurrences)

Test plan

  • Added testValidateCSVHeadersMissingRequiredColumnDoesNotThrow — verifies missing required columns no longer throw
  • Added testValidateCSVHeadersAllRequiredPresent — verifies no issues when all required columns exist
  • All existing CSV tests continue to pass

🤖 Generated with Claude Code

When importing a CSV that doesn't contain all required columns defined
in the database schema, the validation was throwing an exception that
halted the entire import. This changes the behavior to emit a warning
instead, allowing the import to proceed with null values for missing
columns. The database layer will handle any actual constraint violations
on a per-row basis.

Fixes: CLOUD-3K9V

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@claudear has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 40061ba8-92e2-439d-8cb0-e591f82a9a97

📥 Commits

Reviewing files that changed from the base of the PR and between bbdd8ef and 0707a0f.

📒 Files selected for processing (2)
  • src/Migration/Sources/CSV.php
  • tests/Migration/Unit/General/CSVTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/csv-missing-required-column-warning-v2

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.

@claudear
Copy link
Author

Fix Confidence: 95/100

The fix is minimal and targeted: changing a throw to a warning in validateCSVHeaders. The root cause is clear from the error message and code. All CI checks pass. The only slight uncertainty is whether downstream consumers expect the exception for control flow, but the CSV.exportGroupDatabases already catches Throwable and converts to an error, so the warning path is strictly better for users.

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.

1 participant