Skip to content

LCORE-2572: Updated description for /providers, /shields and /rags endpoints.#1927

Merged
tisnik merged 4 commits into
lightspeed-core:mainfrom
tisnik:lcore-2572-2
Jun 15, 2026
Merged

LCORE-2572: Updated description for /providers, /shields and /rags endpoints.#1927
tisnik merged 4 commits into
lightspeed-core:mainfrom
tisnik:lcore-2572-2

Conversation

@tisnik

@tisnik tisnik commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

LCORE-2572: Updated description for /providers, /shields and /rags endpoints.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-2572

Summary by CodeRabbit

  • Documentation
    • Standardized API endpoint documentation with explicit HTTP error status codes (401, 403, 500, 503) and detailed error response structures
    • Enhanced clarity on error details including response and cause information
    • Updated service branding to "Lightspeed Core Stack (LCS)" in documentation
    • Improved consistency in parameter and return value documentation across endpoints

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Docstrings for three endpoint handlers (shields, providers, rags) are rewritten to enumerate HTTP status codes 401/403/500/503 with structured detail fields and explicit parameter descriptions. The changes are propagated to the generated docs/openapi.json descriptions and the rendered docs/openapi.md, which also gains minor doc-level fixes.

Changes

Endpoint docstring and OpenAPI documentation updates

Layer / File(s) Summary
Source endpoint docstring expansions
src/app/endpoints/shields.py, src/app/endpoints/providers.py, src/app/endpoints/rags.py
shields_endpoint_handler, providers_endpoint_handler, and rags_endpoint_handler docstrings are expanded with explicit ### Raises entries for 401/403/500/503 including response/cause detail fields; rags_endpoint_handler also gains a ### Parameters section for request and auth.
OpenAPI JSON description propagation
docs/openapi.json
The "description" strings for all three operation objects are replaced with the updated docstring text.
OpenAPI Markdown doc updates
docs/openapi.md
Service name updated to "Lightspeed Core Stack (LCS)", Components TOC entry added, trailing slash removed from the Base URL example, and ### Raises/### Returns sections for GET /v1/shields, GET /v1/providers, and GET /v1/rags rewritten with explicit status-code lists.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: updating endpoint descriptions for three specific API endpoints (/providers, /shields, /rags).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/openapi.json`:
- Line 1503: The docs/openapi.json file is out of sync with the generated
OpenAPI schema from the source routes and docstrings, causing CI checks to fail.
Regenerate the file by running the command: uv run python
scripts/generate_openapi_schema.py docs/openapi.json, which will update
docs/openapi.json to match the current source definitions. After regeneration,
commit the updated docs/openapi.json artifact to ensure the OpenAPI contract
stays consistent across all layers and passes CI validation.

In `@docs/openapi.md`:
- Line 8: The table of contents link on line 8 references the anchor `#apis`,
but the heading `🛠️ APIs` will likely generate a different slug because the
emoji is included in the heading text. Update the TOC link to match the actual
slug that will be generated from the `🛠️ APIs` heading, or verify and use the
correct anchor reference that corresponds to how the markdown processor handles
the emoji in the heading slug.
- Around line 1250-1256: The markdown structure in the docs/openapi.md file has
formatting issues that violate Markdownlint rules. At docs/openapi.md lines
1250-1256, add blank lines before and after the ### Raises section to properly
separate it from surrounding content. At docs/openapi.md lines 1349-1356,
similarly add blank lines before and after the ### Raises section for proper
markdown spacing. At docs/openapi.md lines 2182-2195, add the missing blank
lines around the ### Returns and ### Raises sections, and outdent the Returns
bullet point items that are currently indented as if they were code
blocks—ensure they align with standard bullet point indentation. These changes
will resolve the Markdownlint failures and ensure correct rendering of the
documentation sections.

In `@src/app/endpoints/rags.py`:
- Around line 77-78: Fix the indentation inconsistency in the Returns section of
the docstring around lines 77-78. The list item "- RAGListResponse: List of RAG
identifiers." currently has 8 spaces of indentation but should have only 4
spaces to match the consistent style used in shields.py and providers.py. Reduce
the indentation by removing 4 spaces from the beginning of the list item line.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 774ad33f-bbfe-4e41-9f49-c320517f7202

📥 Commits

Reviewing files that changed from the base of the PR and between 750ff7f and 15939db.

📒 Files selected for processing (5)
  • docs/openapi.json
  • docs/openapi.md
  • src/app/endpoints/providers.py
  • src/app/endpoints/rags.py
  • src/app/endpoints/shields.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Pylinter
  • GitHub Check: build-pr
  • GitHub Check: unit_tests (3.12)
  • GitHub Check: unit_tests (3.13)
  • GitHub Check: E2E: library mode / ci / group 1
  • GitHub Check: E2E: server mode / ci / group 2
  • GitHub Check: E2E: server mode / ci / group 3
  • GitHub Check: E2E: library mode / ci / group 2
  • GitHub Check: E2E: library mode / ci / group 3
  • GitHub Check: E2E Tests for Lightspeed Evaluation job
  • GitHub Check: E2E: server mode / ci / group 1
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.py: Use absolute imports for internal modules: from authentication import get_auth_dependency
Llama Stack imports: Use from llama_stack_client import AsyncLlamaStackClient
Check constants.py for shared constants before defining new ones
All modules must start with descriptive docstrings explaining purpose
Use logger = get_logger(__name__) from log.py for module logging
All functions must have complete type annotations for parameters and return types, use modern syntax (str | int), and include descriptive docstrings
Use snake_case with descriptive, action-oriented names for functions (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns; return new data structures instead of modifying function parameters
Use async def for I/O operations and external API calls
Use standard log levels with clear purposes: debug() for diagnostic info, info() for program execution, warning() for unexpected events, error() for serious problems
All classes must have descriptive docstrings explaining purpose and use PascalCase with standard suffixes: Configuration, Error/Exception, Resolver, Interface
Abstract classes must use ABC with @abstractmethod decorators
Follow Google Python docstring conventions with required sections: Parameters, Returns, Raises, and Attributes for classes

Files:

  • src/app/endpoints/shields.py
  • src/app/endpoints/rags.py
  • src/app/endpoints/providers.py
src/app/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

src/app/**/*.py: FastAPI dependencies: Import from fastapi module for APIRouter, HTTPException, Request, status, Depends
Use FastAPI HTTPException with appropriate status codes for API endpoints and handle APIConnectionError from Llama Stack

Files:

  • src/app/endpoints/shields.py
  • src/app/endpoints/rags.py
  • src/app/endpoints/providers.py
🧠 Learnings (1)
📚 Learning: 2026-04-06T20:18:07.852Z
Learnt from: major
Repo: lightspeed-core/lightspeed-stack PR: 1463
File: src/app/endpoints/rlsapi_v1.py:266-271
Timestamp: 2026-04-06T20:18:07.852Z
Learning: In the lightspeed-stack codebase, within `src/app/endpoints/` inference/MCP endpoints, treat `tools: Optional[list[Any]]` in MCP tool definitions as an intentional, consistent typing pattern (used across `query`, `responses`, `streaming_query`, `rlsapi_v1`). Do not raise or suggest this as a typing issue during code review; changing it in isolation could break endpoint typing consistency across the codebase.

Applied to files:

  • src/app/endpoints/shields.py
  • src/app/endpoints/rags.py
  • src/app/endpoints/providers.py
🪛 GitHub Actions: OpenAPI (Spectral) / 0_spectral.txt
docs/openapi.json

[error] 1-1: OpenAPI schema check failed. diff -u docs/openapi.json /tmp/openapi-generated.json indicates docs/openapi.json is out of date. Regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json

🪛 GitHub Actions: OpenAPI (Spectral) / spectral
docs/openapi.json

[error] 1-1: CI check failed: docs/openapi.json is out of date (diff -u docs/openapi.json /tmp/openapi-generated.json). Regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json

🪛 markdownlint-cli2 (0.22.1)
docs/openapi.md

[warning] 8-8: Link fragments should be valid

(MD051, link-fragments)


[warning] 1250-1250: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 1349-1349: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2182-2182: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2186-2186: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2194-2194: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 2195-2195: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

🔇 Additional comments (2)
src/app/endpoints/shields.py (1)

47-67: LGTM!

src/app/endpoints/providers.py (1)

63-80: LGTM!

Comment thread docs/openapi.json
],
"summary": "Shields Endpoint Handler",
"description": "Handle requests to the /shields endpoint.\n\nProcess GET requests to the /shields endpoint, returning a list of available\nshields from the Llama Stack service.\n\n### Parameters:\n- request: The incoming HTTP request (used by middleware).\n- auth: Authentication tuple from the auth dependency (used by middleware).\n\n### Returns:\n- ShieldsResponse: An object containing the list of available shields.\n\n### Raises:\n- HTTPException: If unable to connect to the Llama Stack server or if\n shield retrieval fails for any reason.",
"description": "Handle requests to the /shields endpoint.\n\nProcess GET requests to the /shields endpoint, returning a list of available\nshields from the Llama Stack service.\n\n### Parameters:\n- request: The incoming HTTP request (used by middleware).\n- auth: Authentication tuple from the auth dependency (used by middleware).\n\n### Raises:\n- HTTPException: with status 401 for unauthorized access.\n- HTTPException: with status 403 if permission is denied.\n- HTTPException: with status 500 and a detail object containing `response`\n and `cause` when service configuration is wrong or incomplete.\n- HTTPException: with status 503 and a detail object containing `response`\n and `cause` when unable to connect to Llama Stack.\n\n### Returns:\n- ShieldsResponse: An object containing the list of available shields.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Regenerate and commit docs/openapi.json from source routes/docstrings before merge.

docs/openapi.json is currently out of sync with generated output, and CI already fails on this exact diff check. Please regenerate with uv run python scripts/generate_openapi_schema.py docs/openapi.json and commit the updated artifact so the OpenAPI contract stays consistent across layers. Based on pipeline failures and the generation script contract, this is a deterministic mismatch, not a speculative warning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openapi.json` at line 1503, The docs/openapi.json file is out of sync
with the generated OpenAPI schema from the source routes and docstrings, causing
CI checks to fail. Regenerate the file by running the command: uv run python
scripts/generate_openapi_schema.py docs/openapi.json, which will update
docs/openapi.json to match the current source definitions. After regeneration,
commit the updated docs/openapi.json artifact to ensure the OpenAPI contract
stays consistent across all layers and passes CI validation.

Source: Pipeline failures

Comment thread docs/openapi.md
<!-- vim-markdown-toc GFM -->

* [🛠️ APIs](#-apis)
* [🛠️ APIs](#apis)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix the top-level TOC link.

#apis likely does not match the slug for the 🛠️ APIs heading, so this navigation link will not resolve correctly.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 8-8: Link fragments should be valid

(MD051, link-fragments)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openapi.md` at line 8, The table of contents link on line 8 references
the anchor `#apis`, but the heading `🛠️ APIs` will likely generate a different
slug because the emoji is included in the heading text. Update the TOC link to
match the actual slug that will be generated from the `🛠️ APIs` heading, or
verify and use the correct anchor reference that corresponds to how the markdown
processor handles the emoji in the heading slug.

Comment thread docs/openapi.md
Comment on lines +1250 to +1256
### Raises:
- HTTPException: with status 401 for unauthorized access.
- HTTPException: with status 403 if permission is denied.
- HTTPException: with status 500 and a detail object containing `response`
and `cause` when service configuration is wrong or incomplete.
- HTTPException: with status 503 and a detail object containing `response`
and `cause` when unable to connect to Llama Stack.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize the markdown structure in the updated endpoint sections.

These blocks are missing the blank-line spacing Markdownlint expects, and the GET /v1/rags Returns item is indented like a code block. That will keep the docs lint-failing and can render the sections incorrectly.

  • docs/openapi.md#L1250-L1256: add blank lines around ### Raises / ### Returns.
  • docs/openapi.md#L1349-L1356: add blank lines around ### Raises / ### Returns.
  • docs/openapi.md#L2182-L2195: add the missing blank lines and outdent the Returns bullet.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 1250-1250: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

📍 Affects 1 file
  • docs/openapi.md#L1250-L1256 (this comment)
  • docs/openapi.md#L1349-L1356
  • docs/openapi.md#L2182-L2195
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/openapi.md` around lines 1250 - 1256, The markdown structure in the
docs/openapi.md file has formatting issues that violate Markdownlint rules. At
docs/openapi.md lines 1250-1256, add blank lines before and after the ### Raises
section to properly separate it from surrounding content. At docs/openapi.md
lines 1349-1356, similarly add blank lines before and after the ### Raises
section for proper markdown spacing. At docs/openapi.md lines 2182-2195, add the
missing blank lines around the ### Returns and ### Raises sections, and outdent
the Returns bullet point items that are currently indented as if they were code
blocks—ensure they align with standard bullet point indentation. These changes
will resolve the Markdownlint failures and ensure correct rendering of the
documentation sections.

Comment thread src/app/endpoints/rags.py
Comment on lines +77 to +78
### Returns:
- RAGListResponse: List of RAG identifiers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix indentation inconsistency in the Returns section.

The Returns section has extra indentation that breaks consistency with shields.py and providers.py. The list item should use 4 spaces of indentation (one level), not 8 spaces (two levels).

    ### Returns:
-        - RAGListResponse: List of RAG identifiers.
+    - RAGListResponse: List of RAG identifiers.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Returns:
- RAGListResponse: List of RAG identifiers.
### Returns:
- RAGListResponse: List of RAG identifiers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/endpoints/rags.py` around lines 77 - 78, Fix the indentation
inconsistency in the Returns section of the docstring around lines 77-78. The
list item "- RAGListResponse: List of RAG identifiers." currently has 8 spaces
of indentation but should have only 4 spaces to match the consistent style used
in shields.py and providers.py. Reduce the indentation by removing 4 spaces from
the beginning of the list item line.

@tisnik tisnik merged commit 24ec6e4 into lightspeed-core:main Jun 15, 2026
38 of 39 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 18, 2026
16 tasks
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.

1 participant