Skip to content

ROB-1370 Fix docs build: use pydantic.v1.fields in autorobusta - #2171

Merged
Avi-Robusta merged 1 commit into
masterfrom
fix-docs-pydantic-v1-fields
Sep 8, 2026
Merged

ROB-1370 Fix docs build: use pydantic.v1.fields in autorobusta#2171
Avi-Robusta merged 1 commit into
masterfrom
fix-docs-pydantic-v1-fields

Conversation

@Avi-Robusta

Copy link
Copy Markdown
Contributor

Problem

The build-docs action fails:

File "docs/_ext/autorobusta.py", line 151, in PydanticModelDirective
    def __get_readable_field_type(field: pydantic.fields.ModelField):
AttributeError: module 'pydantic.fields' has no attribute 'ModelField'

The extension documents pydantic v1 models (it already imports BaseModel and ModelField from pydantic.v1), but three helpers still referenced the v2 top-level pydantic.fields, which has neither ModelField nor the SHAPE_* constants.

Fix

import pydantic.v1.fields and use the v1 ModelField / pydantic.v1.fields.SHAPE_* names.

Testing

  • Extension imports cleanly.
  • Ran the two previously-crashing helpers (__get_readable_field_type, __get_sample_value) over every field of a real model — both work.
  • A full local sphinx-build stops earlier on an unrelated sphinx_immaterial.google_fonts 403 fetching the Google Fonts API, which is a local network/API-key issue, not this code; CI should get past it.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Docker image ready for ae97a1e (built in 4m 3s)

⚠️ Warning: does not support ARM (ARM images are built on release only - not on every PR)

Use this tag to pull the image for testing.

📋 Copy commands

⚠️ Temporary images are deleted after 30 days. Copy to a permanent registry before using them:

gcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ae97a1e
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ae97a1e me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae97a1e
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae97a1e

Patch Helm values in one line:

helm upgrade --install robusta robusta/robusta \
  --reuse-values \
  --set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ae97a1e

@Avi-Robusta Avi-Robusta changed the title Fix docs build: use pydantic.v1.fields in autorobusta ROB-1370 Fix docs build: use pydantic.v1.fields in autorobusta Sep 8, 2026
The extension documents pydantic v1 models but referenced the v2
top-level pydantic.fields, which has no ModelField or SHAPE_* names.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Avi-Robusta
Avi-Robusta force-pushed the fix-docs-pydantic-v1-fields branch from 31ce5c3 to f15aa9f Compare September 8, 2026 13:27
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 06647d03-5a0e-4d0e-bd8a-f8ef68c90487

📥 Commits

Reviewing files that changed from the base of the PR and between 8df33a3 and f15aa9f.

📒 Files selected for processing (1)
  • docs/_ext/autorobusta.py

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

The documentation extension now references Pydantic v1 field types and shape constants through the pydantic.v1 namespace.

Changes

Pydantic v1 compatibility

Layer / File(s) Summary
Migrate documentation extension to Pydantic v1
docs/_ext/autorobusta.py
The extension imports Pydantic v1 fields, uses ModelField annotations, and compares field shapes with Pydantic v1 constants.

Priority: ⬇️ Low — Defer this docs-build compatibility fix because its narrow scope is limited to Pydantic v1 field imports in the Sphinx extension.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to f15aa

The documentation extension now uses Pydantic v1 field APIs, restoring compatibility for model-field rendering without identified remaining merge risk.

Suggested reviewers: naomi-robusta

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the Pydantic v1 namespace issue, the code fix, and the testing results. It directly matches the changeset.
Title check ✅ Passed The title clearly identifies the documentation build fix and the use of pydantic.v1.fields. It accurately summarizes the main change.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-docs-pydantic-v1-fields

Comment @coderabbitai help to get the list of available commands.

@Avi-Robusta
Avi-Robusta enabled auto-merge (squash) September 8, 2026 13:28
@Avi-Robusta
Avi-Robusta merged commit c263d48 into master Sep 8, 2026
7 checks passed
@Avi-Robusta
Avi-Robusta deleted the fix-docs-pydantic-v1-fields branch September 8, 2026 13:37
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