Skip to content

fix: validate job description max length of 255 characters#205

Merged
b-per merged 1 commit into
mainfrom
fix/validate-description-max-length
Apr 20, 2026
Merged

fix: validate job description max length of 255 characters#205
b-per merged 1 commit into
mainfrom
fix/validate-description-max-length

Conversation

@b-per
Copy link
Copy Markdown
Collaborator

@b-per b-per commented Apr 20, 2026

Summary

  • Adds max_length=255 to the description field on JobDefinition, giving users a clear Pydantic validation error instead of a silent HTTP 500 from the API
  • Updates the generated JSON schema (load_job_schema.json) with maxLength: 255
  • Adds tests covering the boundary (255 accepts, 256 rejects) for both Pydantic and JSON schema validation

Closes #204

Root cause

The dbt Cloud API enforces a 255-character limit on job descriptions but returns a generic 500 error with no useful message. The limit is not documented in the API spec.

Test plan

  • uv run pytest tests/schemas/test_job.py::TestDescriptionValidation — all 4 tests pass
  • uv run pytest — full suite (171 tests) passes
  • Manually verified against the API: 255-char description succeeds, 256-char description fails with 400

The dbt Cloud API silently returns a 500 error when a job description
exceeds 255 characters. Add a Pydantic max_length=255 constraint so
users get a clear validation error before the API call is made.
@github-actions
Copy link
Copy Markdown
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/dbt_jobs_as_code
   main.py31016048%120–123, 129, 168–169, 200–203, 209, 245–329, 400–405, 418–419, 437–438, 442–444, 461–510, 539–597, 628–673, 678–679, 683
src/dbt_jobs_as_code/client
   __init__.py1794674%16, 53–54, 62, 99–100, 119–120, 139–140, 155–156, 170–171, 187–188, 205, 215, 295–310, 333, 349–350, 360–372, 375–386, 391–400
src/dbt_jobs_as_code/cloud_yaml_mapping
   change_set.py2353087%27–29, 59, 65–66, 155, 212, 224, 247, 251–252, 258–260, 275–278, 334–348, 401–423, 459–473
src/dbt_jobs_as_code/importer
   __init__.py27774%14–15, 22–27
src/dbt_jobs_as_code/schemas
   __init__.py23291%68, 78
   common_types.py60395%67–68, 91
   config.py14193%18
   job.py133795%237, 242, 258–268
TOTAL118425678% 

Tests Skipped Failures Errors Time
171 0 💤 0 ❌ 0 🔥 13.414s ⏱️

@b-per
Copy link
Copy Markdown
Collaborator Author

b-per commented Apr 20, 2026

CI passed 🚀

@b-per b-per merged commit d00ec29 into main Apr 20, 2026
6 checks passed
@b-per b-per deleted the fix/validate-description-max-length branch April 20, 2026 13:49
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.

[Bug] Job creation fails with generic error 500 if the job description is too long

1 participant