Skip to content

fix: resolve Sentry validation errors causing 177+ production failures#10

Merged
saksham-nexla merged 11 commits intomainfrom
fix/sentry-validation-errors
Jan 31, 2026
Merged

fix: resolve Sentry validation errors causing 177+ production failures#10
saksham-nexla merged 11 commits intomainfrom
fix/sentry-validation-errors

Conversation

@saksham-nexla
Copy link
Copy Markdown
Member

Summary

This PR fixes 4 production issues identified in Sentry (organization: nexla-z4) that were causing 177+ validation errors in production. The root causes were incomplete enum definitions, overly strict field requirements, and a missing API method parameter.

Sentry Issues Fixed

1. EXPRESS-1K - DestinationType enum missing connector types

Metric Value
Events 91
Users Impacted 4
Error ValidationError: 1 validation error for Nexset - data_sinks.0.sink_type: Input should be 's3', 'gcs', ... or 'pinecone' [type=enum, input_value='supabase', input_type=str]
Culprit nexla_sdk/resources/base_resource.py:103 in _parse_response()

Root Cause: The DestinationType enum was incomplete and missing supabase and 25+ other connector types that the API can return.

Fix: Added 27 missing connector types to DestinationType enum in nexla_sdk/models/destinations/enums.py:

  • SUPABASE, AZURE_DATA_LAKE, MIN_IO_S3, WEBDAV
  • ORACLE_AUTONOMOUS, SNOWFLAKE_DCR, AS400, AWS_ATHENA, AZURE_SYNAPSE
  • CLOUDSQL_MYSQL, CLOUDSQL_POSTGRES, CLOUDSQL_SQLSERVER, DB2, FIREBOLT
  • GCP_ALLOYDB, GCP_SPANNER, HANA_JDBC, HIVE, NETSUITE_JDBC, SYBASE, TERADATA
  • DELTA_LAKE_AZURE_BLB, DELTA_LAKE_AZURE_DATA_LAKE, DELTA_LAKE_S3, S3_ICEBERG
  • JMS, TIBCO, SOAP, NEXLA_MONITOR

2. EXPRESS-1J - DataSinkSimplified required fields should be Optional

Metric Value
Events 58
Users Impacted 3
Error ValidationError: 3 validation errors for Nexset - data_sinks.0.owner_id: Field required, data_sinks.0.org_id: Field required, data_sinks.0.sink_type: enum error
Culprit nexla_sdk/resources/nexsets.py:47 in get()

Root Cause: The DataSinkSimplified model had owner_id and org_id defined as required int fields, but the API sometimes returns data sinks without these fields.

Fix: Changed owner_id and org_id from int to Optional[int] = None in nexla_sdk/models/nexsets/responses.py.


3. EXPRESS-2A - Notification.resource_id should be Optional

Metric Value
Events 22
Users Impacted 1
Error ValidationError: 1 validation error for Notification - resource_id: Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType]
Culprit nexla_sdk/resources/notifications.py:80 in list()

Root Cause: The Notification model had resource_id defined as required int, but the API can return null for this field.

Fix: Changed resource_id from int to Optional[int] = None in nexla_sdk/models/notifications/responses.py.


4. EXPRESS-27 - FlowsResource.get() missing include_run_metrics parameter

Metric Value
Events 6
Users Impacted 1
Error TypeError: FlowsResource.get() got an unexpected keyword argument 'include_run_metrics'
Culprit nexla_sdk/resources/flows.py in get()

Root Cause: The FlowsResource.get() method only accepted flow_id and flows_only parameters, but callers expected include_run_metrics to be supported (which was already supported by list()).

Fix: Added include_run_metrics: bool = False parameter to FlowsResource.get() in nexla_sdk/resources/flows.py.


Files Changed

File Change
nexla_sdk/models/destinations/enums.py Added 27 missing connector types to DestinationType enum
nexla_sdk/models/nexsets/responses.py Made owner_id and org_id Optional in DataSinkSimplified
nexla_sdk/models/notifications/responses.py Made resource_id Optional in Notification
nexla_sdk/resources/flows.py Added include_run_metrics parameter to get()

Test Plan

  • All 197 unit tests pass
  • Code formatted with pre-commit hooks (ruff, black, isort)
  • Integration tests (require API credentials)

Impact

This fix will resolve 177+ production validation errors currently occurring in the Sentry dashboard.

…mports

- Removed CustodianUser from the imports and __all__ definitions in marketplace-related modules to streamline the model structure.
- Updated relevant files to reflect these changes, enhancing code clarity and maintainability.
Add comprehensive skill documentation and helper scripts for Nexla SDK:
- SKILL.md: skill definition and capabilities reference
- EXAMPLES.md: recipes and usage patterns for common workflows
- REFERENCE.md: detailed API reference and configuration guide
- scripts/: utility scripts for resource management, health checks, and operations
  - nexla_quickstart.py: quick sanity check for auth and listings
  - list_resources.py: list and filter resources by type and name
  - deploy_flow.py: deploy flows from configuration files
  - get_resource_logs.py: fetch logs for resources
  - health_check.py: validate system health and connectivity
  - batch_operations.py: batch create/update operations
  - circuit_breaker.py: circuit breaker pattern for resilience
  - retry_helpers.py: exponential backoff and retry utilities
- Add webhooks resource with models for webhook management
- Enhance flows resource with additional API methods
- Expand skill documentation with ACCESS_CONTROL.md and TRANSFORMS.md
- Update EXAMPLES.md and REFERENCE.md with comprehensive guides
- Add manage_access.py utility script for access control operations
Resolved conflicts in:
- nexla_sdk/client.py: Keep webhooks import and create_webhook_client method
- nexla_sdk/models/__init__.py: Keep webhook models in exports
- nexla_sdk/resources/flows.py: Keep enhanced docstrings and typed return values
- Create tests/unit/test_webhooks.py with 18 tests covering WebhooksResource
  - Model validation tests for WebhookSendOptions and WebhookResponse
  - Core functionality tests for send_one_record and send_many_records
  - Authentication tests for query and header auth methods
  - Error handling tests for network failures
  - HTTP client lazy creation tests

- Rewrite tests/unit/test_flows.py to fix tests that were never running
  - Add pytestmark = pytest.mark.unit (was missing, causing 0 tests selected)
  - Switch from MagicMock to MockHTTPClient.add_response pattern
  - Use access_token auth to avoid double HTTP calls from token fetch
  - Add model validation tests (FlowLogsResponse, FlowMetricsApiResponse, etc.)
  - Add tests for new methods: docs_recommendation, get_logs, get_metrics
  - Add tests for new parameters: access_role, async_mode

- Update tests/test_client_init.py with create_webhook_client tests

- Update tests/utils/mock_builders.py with new response builders
- Use shared mock_client fixture instead of local fixtures
- Replace MagicMock with add_response/assert_request_made pattern
- Make assertion helpers more flexible with optional field checks
- Reduce code duplication across test files
Pytest 9 deprecates applying marks to fixtures. The integration_client
fixture already handles skipping internally via pytest.skip() calls.
…low models

This commit fixes 4 production issues identified in Sentry that were causing
177+ validation errors:

- EXPRESS-1K (91 events): DestinationType enum missing 'supabase'
- EXPRESS-1J (58 events): DataSinkSimplified missing Optional fields + enum
- EXPRESS-2A (22 events): Notification.resource_id should be Optional
- EXPRESS-27 (6 events): FlowsResource.get() missing include_run_metrics param

Changes:
- Add 27 missing connector types to DestinationType enum including supabase
- Make DataSinkSimplified.owner_id and org_id Optional
- Make Notification.resource_id Optional
- Add include_run_metrics parameter to FlowsResource.get()
Resolved conflict in nexla_sdk/resources/flows.py by keeping
the current branch's formatting style (double quotes, consistent
line breaks).
- Standardize import ordering and grouping
- Apply consistent quote style (double quotes)
- Add trailing commas for better diffs
- Fix whitespace and line breaks
- Clean up docstring formatting
@saksham-nexla saksham-nexla merged commit 0e82428 into main Jan 31, 2026
6 of 7 checks passed
@saksham-nexla saksham-nexla deleted the fix/sentry-validation-errors branch February 1, 2026 02:53
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