Skip to content

API v3: add build parity fields and cold-storage commands#12794

Open
ericholscher wants to merge 12 commits intomainfrom
fix/api-v3-build-fields-11179
Open

API v3: add build parity fields and cold-storage commands#12794
ericholscher wants to merge 12 commits intomainfrom
fix/api-v3-build-fields-11179

Conversation

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Feb 19, 2026

Fixes #11179

This updates the build API v3 endpoint to unblock dashboard usage without API v2 fallbacks.

  • adds build response parity fields (docs_url, commit_url, builder, commands)
  • keeps expand=config available on the build endpoint
  • adds cold-storage command loading support on build detail
  • extracts shared cold-storage command loading into readthedocs.api.v2.utils.get_build_commands_from_storage and reuses it from both API v2 and API v3
  • updates API v3 build fixtures/tests and adds a cold-storage regression test

Validation run in this branch:

  • pre-commit checks pass on commit
  • targeted pytest invocations are blocked by an existing local test DB/migration issue in this workspace (projects_addonsconfig.notifications_disable_pr NOT NULL)

Screenshot

Screenshot 2026-02-19 at 5 39 55 PM

Generated by Copilot.

@ericholscher ericholscher requested a review from a team as a code owner February 19, 2026 10:10
@ericholscher
Copy link
Member Author

Pretty happy where this ended up. I almost went down the config rabbit hole but figured that would just make this PR even larger.

@ericholscher ericholscher requested a review from humitos February 20, 2026 06:44
@ericholscher
Copy link
Member Author

Actually looks like the config rabbithole was just merged :)

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going in the correct direction, I'd say. We just need to refactor a little the fields structure of the URL fields to keep the pattern we already have in other serializers.

if commands is not None:
data["commands"] = commands

return Response(data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we are changing the logic here when not settings.RTD_SAVE_BUILD_COMMANDS_TO_STORAGE.
The old code runs return super().retrieve(*args, **kwargs) and now we will be running return Response(serializer.data) instead.

Is that the same?

Comment on lines +115 to +116
self.build.config = {"property": "test value"}
self.build.save()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we moving this outside the fixture.get? We should be able to put it there to avoid an extra DB call.

Comment on lines +209 to +210
docs_url = serializers.SerializerMethodField()
commit_url = serializers.SerializerMethodField()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These attributes should be inside the urls field. We have a specific serializer to add more of these: BuildURLsSerializer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should use urls.documenation instead of urls.docs to keep consistency with the VersionURLsSerializer

Comment on lines +155 to +163
"id",
"build",
"command",
"description",
"output",
"exit_code",
"start_time",
"end_time",
"run_time",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove these fields since we are not using them.

Suggested change
"id",
"build",
"command",
"description",
"output",
"exit_code",
"start_time",
"end_time",
"run_time",
"id",
"command",
"output",
"exit_code",
"start_time",
"end_time",
"run_time",

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.

API v3: BuildCommands and missing fields to build v3 API

2 participants