Skip to content

docs: add Google-style docs to diracx-routers and remove D100-D300 from per-file-ignores for it - #1076

Merged
aldbr merged 17 commits into
DIRACGrid:mainfrom
martynia:janusz_rest2_googledocs_diracx-routers_1004
Oct 23, 2026
Merged

aldbr merged 17 commits into
DIRACGrid:mainfrom
martynia:janusz_rest2_googledocs_diracx-routers_1004

Conversation

@martynia

@martynia martynia commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Google style docs for routers.

Part of #1004

@martynia
martynia force-pushed the janusz_rest2_googledocs_diracx-routers_1004 branch from 8bb958b to f5b3e2e Compare October 16, 2026 10:26
@chrisburr

Copy link
Copy Markdown
Member

Thanks for this!

The issue with doing this for diracx-routers is that the docstrings are part of the public documentation in swagger and diracx-client. I'm going to push a fix to add the \f sequence that FastAPI uses to control what propagates to the OpenAPI spec.

@martynia
martynia requested a review from aldbr October 20, 2026 14:15
@martynia

Copy link
Copy Markdown
Contributor Author

Can we merge it before I do direct-logic?

@chrisburr

Copy link
Copy Markdown
Member

I think this is ready now.

@martynia

Copy link
Copy Markdown
Contributor Author

Thanks Chris, anybody to review this?

martynia and others added 14 commits October 23, 2026 15:51
Insert a form feed before the Google-style sections of every route
docstring so FastAPI truncates the OpenAPI description there, keeping
DI parameters and HTTPException details out of Swagger and the generated
clients. Restore caller-facing details dropped from the route
descriptions and merge the duplicated Args section of create_app_inner.
ClientMinVersionCheckMiddleware rejects unparsable client versions with a
400 rather than letting them through, rescheduling is not restricted to
failed or killed jobs, get_sandbox_file only returns 403 for PFNs outside
the user's sandbox area or not owned by them, and access policies must
deny with a 403.
Pydantic publishes the whole class docstring as the schema description,
so Google-style Attributes sections ended up verbatim in the OpenAPI
schema and the generated clients. Move each entry to a docstring below
its field and enable use_attribute_docstrings through a shared base
model, so that they become per-field descriptions instead.
…trings

Most of these sections duplicated existing field docstrings and also
leaked verbatim into the generated settings documentation. Enable
use_attribute_docstrings once on ServiceSettingsBase instead of on each
settings class.
Also check route descriptions for Returns and Yields sections, and
explain in the failure messages how to fix a leak.
Only the route docstrings need a real form feed. Ignoring D301 for the
whole repository hid backslashes in non-raw docstrings everywhere else,
such as the leak test's own docstring.
@martynia
martynia force-pushed the janusz_rest2_googledocs_diracx-routers_1004 branch from 4af83b9 to fe9b62a Compare October 23, 2026 14:51
aldbr added 3 commits October 23, 2026 17:37
- set_job_statuses: a 404 is returned only when no job could be updated;
  partial failures return 200 with the jobs listed under `failed`.
- initiate_device_flow: the verification URI has no <vo> segment; point
  to the returned verification_uri_complete instead.
- WMSAccessPolicy: describe what the policy enforces. Creating a job needs
  NORMAL_USER whatever other properties the token holds.
- submit_jdl_jobs: drop the hard-coded job limit, which lives in
  diracx-logic and is stated in the error response.
- RSS routes: replace four copies of the same Args/Returns/Raises
  sections with one public line on conditional requests and a pointer
  to _vo_view.
- Also reject "Note:" and "Example:" in the route description leak test.

Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
@aldbr
aldbr enabled auto-merge (squash) October 23, 2026 15:40
@aldbr
aldbr merged commit 308551e into DIRACGrid:main Oct 23, 2026
35 checks passed
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.

3 participants