Skip to content

Conversation

@RamiNoodle733
Copy link

@RamiNoodle733 RamiNoodle733 commented Feb 6, 2026

Summary

This PR fixes issue #2084 where the "none" severity value causes a validation error in TestResultDBRowSchema when using dbt-fusion.

Problem

dbt-fusion returns severity as the string "none" (lowercase) instead of null/None. This caused a validation error:

ERROR — Could not generate the report - Error: 1 validation error for TestResultDBRowSchema
severity
 none is not an allowed value (type=type_error.none.not_allowed)

Solution

Added a Pydantic validator normalize_severity to TestResultDBRowSchema that:

  1. Converts the string "none" (case-insensitive) to Python None
  2. Preserves other severity values as-is
  3. Handles None values correctly

Changes

  • Modified elementary/monitor/fetchers/tests/schema.py - Added normalize_severity validator
  • Added tests/unit/monitor/fetchers/tests/test_schema.py - Comprehensive tests for severity validation

Testing

All 8 new tests pass:

  • test_severity_error
  • test_severity_warn
  • test_severity_none_string_lowercase
  • test_severity_none_string_uppercase
  • test_severity_none_string_mixed_case
  • test_severity_python_none
  • test_severity_missing_field
  • test_severity_empty_string

Fixes #2084

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed severity field normalization to consistently handle different representations of null values across data adapters.

…BRowSchema

- Add validator to normalize "none" string values to None
- This fixes validation errors when using dbt-fusion which returns
  "none" as a string instead of null/None
- Add comprehensive tests for severity field validation
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

👋 @RamiNoodle733
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

The PR adds a pre-validator to the TestResultDBRowSchema that normalizes the severity field, converting string values of "none" (case-insensitive) and Python None to None, while preserving other values. Comprehensive unit tests validate the normalization behavior across multiple scenarios.

Changes

Cohort / File(s) Summary
Severity Validation Logic
elementary/monitor/fetchers/tests/schema.py
Adds a pre-validator using Pydantic's validator decorator that normalizes severity field values: converts string "none" (case-insensitive) to None, preserves Python None, and leaves other values unchanged.
Test Coverage
tests/unit/monitor/fetchers/tests/test_schema.py
Introduces comprehensive unit tests for severity field handling with a base_test_result fixture and TestTestResultDBRowSchema class covering: preservation of "ERROR" and "WARN" values, normalization of various "none" case variations to None, handling of Python None, missing severity fields, and empty string edge cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A "none" string was causing quite the fright,
But the validator fixed it right!
Case-insensitive, None stays true,
Tests confirm what the schema will do. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically references the issue being fixed (#2084) and describes the main change: handling 'none' severity values in TestResultDBRowSchema.
Linked Issues check ✅ Passed The PR fully addresses the requirements from issue #2084 by implementing a validator that converts string 'none' to None, preserving other values, and includes comprehensive tests for the normalization logic.
Out of Scope Changes check ✅ Passed All changes are within scope: the validator addition in schema.py and corresponding unit tests in test_schema.py directly address the reported validation error without introducing unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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.

"Validation error in TestResultDBRowSchema: severity 'none' is not an allowed value"

1 participant