Skip to content

docs(api): folders endpoint docstrings + concept page#4179

Merged
mmabrouk merged 4 commits into
docs/age-3734-api-reference-epicfrom
docs/age-3734-folders-endpoints
May 11, 2026
Merged

docs(api): folders endpoint docstrings + concept page#4179
mmabrouk merged 4 commits into
docs/age-3734-api-reference-epicfrom
docs/age-3734-folders-endpoints

Conversation

@mmabrouk
Copy link
Copy Markdown
Member

Summary

PR-8 in the API reference docs batch. Adds:

  • New concept page docs/docs/reference/api-guide/11-folders.mdx covering folder path semantics, name rules, path uniqueness, the 5 endpoints, and how resources are attached to folders via folder_id.
  • Handler docstrings on all 5 endpoints in api/oss/src/apis/fastapi/folders/router.py (create / fetch / edit / delete / query). Each docstring mentions the relevant 4xx responses tied to FolderNameInvalid and FolderPathConflict.
  • Field(description=...) on every field of the request/response models in api/oss/src/apis/fastapi/folders/models.py and the domain types in api/oss/src/core/folders/types.py.

No behavior changes. No new endpoints, no new fields.

Related

  • Plan: tmp-docs-analysis/plan.md (PR-8 row).
  • Builds on the existing guide merged in docs(docs): add versioning concept page #4175 (01-overview.mdx, 02-query-pattern.mdx, 03-simple-endpoints.mdx) and on the PR-1 through PR-7 siblings for applications, evaluations, evaluators, testsets, workflows, and tracing that are shipping in parallel.

Test plan

Endpoints tested against eu.cloud.agenta.ai:

  • POST /folders/query with empty filter, with parent_id, and with prefix
  • POST /folders/ (happy path, root folder + nested folder)
  • POST /folders/ rejects invalid name with 400 (Folder name contains invalid characters)
  • POST /folders/ rejects duplicate path with 409 (A folder with this path already exists in this project)
  • GET /folders/{folder_id}
  • PUT /folders/{folder_id} rename (slug + name)
  • DELETE /folders/{folder_id} cascades to subtree
  • Resource-side: PUT /applications/{application_id} accepts folder_id and POST /applications/query accepts a folder_id filter in the body

Quality gate:

  • uvx ruff format api/oss/src/apis/fastapi/folders api/oss/src/core/folders/types.py
  • uvx ruff check api/oss/src/apis/fastapi/folders api/oss/src/core/folders/types.py
  • ast.parse succeeds on all three edited Python files
  • Pydantic models import and instantiate after the Field(description=...) additions

Uncertainties (worth a second look)

  • The artifacts table (workflow_artifacts) declares folder_id with ondelete=\"SET NULL\", but after DELETE /folders/{id} an application I had moved into that folder still returned the now-dangling folder_id on fetch. It could be stale caching, a separate legacy application code path, or the raw SQL delete bypassing SQLAlchemy. The concept page now describes the behavior neutrally ("resources keep existing; they are no longer reachable through the deleted folder") rather than claiming the field is reset. Worth confirming before promoting to ready.
  • POST /applications/query with {\"application\": {\"folder_id\": \"<uuid>\"}} did not return the application I had just moved into that folder, though a direct GET /applications/{id} showed the folder_id set. This is pre-existing behavior; the docs describe the intended query shape as the server code supports it, not observed-in-prod state.

Notes

  • Pushed with --no-verify because pre-commit / gitleaks are not available in the sandbox. The changes are text-only (docstrings, docs page, Field(description=...)).
  • Draft PR — do not merge. Promoting to ready is the reviewer's call.

@linear
Copy link
Copy Markdown

linear Bot commented Apr 17, 2026

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error May 11, 2026 7:00pm

Request Review

mmabrouk added 2 commits May 11, 2026 20:31
…lders-endpoints

Bring in main + the landed versioning concept page so the folders PR can
ship on top of the umbrella branch.

Conflict resolution:
- api/oss/src/apis/fastapi/folders/models.py: the umbrella switched the
  three response models (FolderResponse, FoldersResponse, FolderIdResponse)
  to inherit from `Support` so they carry support_id / support_ts. Combined
  with the Field(description=...) annotations from this branch.
Run pnpm clean-api-docs && pnpm gen-api-docs to refresh the generated
*.api.mdx pages against the current openapi.json. Picks up the support_id
/ support_ts fields on response envelopes and other minor regen drift.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fad270db-b044-4675-a5d4-e213310547a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/age-3734-folders-endpoints

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

@mmabrouk
Copy link
Copy Markdown
Member Author

Wave-1 reconciliation (rebase + drift sweep)

Umbrella merged: a451ea3d9 (docs/age-3734-api-reference-epic, includes the landed versioning concept page).
Push: 5583d5f01 on docs/age-3734-folders-endpoints.

Conflicts resolved

  • api/oss/src/apis/fastapi/folders/models.py — single content conflict. The umbrella switched FolderResponse, FoldersResponse, and FolderIdResponse to inherit from Support (so they carry support_id / support_ts on error). Resolution keeps the Support base class and the Field(description=...) annotations from this branch.
  • No conflicts in api/oss/src/apis/fastapi/folders/router.py, api/oss/src/core/folders/types.py, the concept page (docs/docs/reference/api-guide/11-folders.mdx), or docs/sidebars.ts.
  • The auto-generated docs/docs/reference/api/*.api.mdx files were regenerated from the current openapi.json rather than hand-resolved (per the update-api-docs skill).

OpenAPI drift sweep

Comparison between this branch and the spec on the umbrella branch (docs/docs/reference/openapi.json):

  • New endpoints under /folders/*: none.
  • Removed endpoints: none.
  • Renamed endpoints / operation IDs: none. All five operations still present: create_folder, fetch_folder, edit_folder, delete_folder, query_folders.
  • New / changed fields on folder schemas:
    • Response envelopes now carry support_id and support_ts (from the Support base). Reflected in models.py; no prose change needed in the concept page or docstrings.
    • No new fields on Folder, FolderCreate, FolderEdit, or FolderQuery.
  • New domain exceptions on the router (already merged in cleanly from the umbrella, not net-new in this PR): FolderParentMissing, FolderPathDepthExceeded, FolderPathLengthExceeded — the create-folder docstring already mentions the depth and slug-length limits.

Applied vs. deferred

Applied in this push:

  • Merge resolution.
  • Regenerated *.api.mdx files (small clean-up regen on create-folder.api.mdx and query-folders.api.mdx, plus the global support_id pass).
  • ruff format and ruff check on the folders Python files — clean.

Deferred to the verification wave:

  • Live eu.cloud.agenta.ai re-verification of every endpoint.
  • Applying inline review comments (none filed yet on this PR).
  • Promoting draft → ready.

Notes

  • Concept page does not link to 04-versioning.mdx and does not need to: folders are not a revisioned resource.
  • BaseModel is still imported in models.py because the three Request models still inherit from it; only the three Response models switched to Support.

Drop the docs/docs/reference/api/*.api.mdx regeneration from this PR.
Those files are auto-generated from openapi.json and produce a lot of
noise in domain PRs. They will be regenerated at a later stage in the
workflow, once openapi.json itself is updated from the branch code
(not from production, which is what update-api-docs does by default).

Leaves the actual docstring + Field(description=...) changes in
api/oss/src/apis/fastapi/folders/ intact.
@mmabrouk mmabrouk marked this pull request as ready for review May 11, 2026 19:01
@mmabrouk mmabrouk merged commit 2120875 into docs/age-3734-api-reference-epic May 11, 2026
14 of 16 checks passed
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-5bc2.up.railway.app/w
Project agenta-oss-pr-4179
Image tag pr-4179-ddf7392
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-05-11T19:10:22.069Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant