Skip to content

LCORE-1348: Synced OpenAPI schema#1387

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-1348-synced-openapi-schema
Mar 24, 2026
Merged

LCORE-1348: Synced OpenAPI schema#1387
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-1348-synced-openapi-schema

Conversation

@tisnik
Copy link
Copy Markdown
Contributor

@tisnik tisnik commented Mar 24, 2026

Description

LCORE-1348: Synced OpenAPI schema

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-1348

Summary by CodeRabbit

Documentation

  • Enhanced API error documentation with expanded examples covering Kubernetes connectivity failures and cluster version issues
  • Clarified OKP configuration guidance for URL setup, environment variable handling, and Solr-based search filter functionality with practical examples

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

Walkthrough

API documentation enhancements to the OpenAPI schema and configuration reference documentation. The OpenAPI schema adds error response examples for Kubernetes API failures and cluster version errors, while configuration documentation clarifies environment variable behavior and filter query behavior for OkpConfiguration fields.

Changes

Cohort / File(s) Summary
OpenAPI Schema Examples
docs/openapi.json
Extended 503 Service Unavailable response examples across multiple endpoints with Kubernetes API connection failure details; extended 500 Internal Server Error examples for InternalServerErrorResponse with three labeled error cases (cluster version not found, permission denied, invalid cluster version).
Configuration Documentation
docs/openapi.md
Updated OkpConfiguration field documentation: rhokp_url now specifies environment variable fallback behavior and protocol requirements; chunk_filter_query redefined as an additional Solr boolean filter query with revised example. Type annotations removed from both field entries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'LCORE-1348: Synced OpenAPI schema' accurately reflects the main changes: updates to OpenAPI schema documentation files (openapi.json and openapi.md) with added examples and clarified documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/openapi.json`:
- Around line 8067-8070: The OpenAPI example's "cause" string doesn't match the
actual InvalidClusterVersionError message; change the example text to "Missing
or invalid 'clusterID' in ClusterVersion" by updating the example definition in
the response models (the example entry used in src/models/responses.py for this
error) so it matches what InvalidClusterVersionError produces via str(e), then
regenerate docs/openapi.json to reflect the updated example.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2bc94041-501e-4978-bd97-c6cb4dc124d4

📥 Commits

Reviewing files that changed from the base of the PR and between 39116c7 and 4fe4d05.

📒 Files selected for processing (2)
  • docs/openapi.json
  • docs/openapi.md

Comment on lines +8067 to +8070
"detail": {
"cause": "ClusterVersion missing required field: 'clusterID'",
"response": "Internal server error"
},
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Mar 24, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking InvalidClusterVersionError source messages and OpenAPI examples..."
rg -n -C2 "InvalidClusterVersionError|clusterID|ClusterVersion missing required field|Missing or invalid 'clusterID'" \
  src/authentication/k8s.py src/models/responses.py docs/openapi.json

Repository: lightspeed-core/lightspeed-stack

Length of output: 3643


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Searching for exception handlers and mappers for InvalidClusterVersionError ==="
rg -n "InvalidClusterVersionError" --type py -A 5 -B 2

echo ""
echo "=== Checking if src/models/responses.py has auto-generation markers ==="
head -n 20 src/models/responses.py

echo ""
echo "=== Searching for error message mapping or transformation logic ==="
rg -n "Missing or invalid|ClusterVersion missing required" --type py

Repository: lightspeed-core/lightspeed-stack

Length of output: 12731


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Finding where InvalidClusterVersionError is caught and handled ==="
rg -n "except.*InvalidClusterVersionError|InvalidClusterVersionError.*except" --type py -A 3 -B 1

echo ""
echo "=== Looking for exception handlers or middleware for K8s errors ==="
rg -n "K8sConfigurationError|K8sAuthenticationError" --type py -A 2 -B 1

echo ""
echo "=== Checking test context around line 912 ==="
sed -n '900,930p' tests/unit/authentication/test_k8s.py

Repository: lightspeed-core/lightspeed-stack

Length of output: 146


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Test context around line 912 ==="
sed -n '900,935p' tests/unit/authentication/test_k8s.py

echo ""
echo "=== Looking for general exception handlers for K8s errors ==="
rg -n "K8sConfigurationError|K8sAuthenticationError|K8sError" --type py -A 3 -B 1 | head -100

echo ""
echo "=== Searching for HTTPException handlers or error response generation ==="
rg -n "@.*exception|except Exception|def.*error" src/app --type py -A 2 | head -60

Repository: lightspeed-core/lightspeed-stack

Length of output: 9118


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Finding InternalServerErrorResponse definition ==="
rg -n "class InternalServerErrorResponse|def InternalServerErrorResponse" --type py -A 10

echo ""
echo "=== Complete exception handler context ==="
sed -n '450,475p' src/authentication/k8s.py

Repository: lightspeed-core/lightspeed-stack

Length of output: 2103


Update OpenAPI example to match actual error message from InvalidClusterVersionError.

At line 8068, the documented cause "ClusterVersion missing required field: 'clusterID'" does not match the actual error message raised at runtime. In src/authentication/k8s.py (line 219), InvalidClusterVersionError is raised with the message "Missing or invalid 'clusterID' in ClusterVersion". The exception handler at line 460-463 uses str(e) to populate the cause field, so no transformation occurs. Update src/models/responses.py (line 2452) and regenerate docs/openapi.json to reflect the actual message.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/openapi.json` around lines 8067 - 8070, The OpenAPI example's "cause"
string doesn't match the actual InvalidClusterVersionError message; change the
example text to "Missing or invalid 'clusterID' in ClusterVersion" by updating
the example definition in the response models (the example entry used in
src/models/responses.py for this error) so it matches what
InvalidClusterVersionError produces via str(e), then regenerate
docs/openapi.json to reflect the updated example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai create issue

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.

🧩 Analysis chain

@tisnik On it — creating an issue now to track the OpenAPI example vs. runtime error message mismatch. I’ll post the created issue link as soon as it’s ready.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

REPO="lightspeed-core/lightspeed-stack"
TITLE="Mismatch between OpenAPI 500 example and runtime InvalidClusterVersionError message"
ASSIGNEE="tisnik"

read -r -d '' BODY <<'EOF'
Summary
OpenAPI documentation example for InternalServerErrorResponse mentions a cause text that does not match the actual InvalidClusterVersionError message returned at runtime.

What’s affected
- docs/openapi.json: InternalServerErrorResponse examples (label: "invalid cluster version") currently show:
  "ClusterVersion missing required field: 'clusterID'".
- Runtime: src/authentication/k8s.py raises InvalidClusterVersionError with:
  "Missing or invalid 'clusterID' in ClusterVersion".
- The exception handler uses str(e) to populate the "detail.cause" field, so clients will see the latter message.

Why this matters
- API consumers and tests relying on documented examples may assert on the wrong message.
- Keeps the OpenAPI schema examples consistent with real responses.

Context and references
- PR: https://github.com/lightspeed-core/lightspeed-stack/pull/1387
- Comment: https://github.com/lightspeed-core/lightspeed-stack/pull/1387#discussion_r2979878538
- Requested by: `@tisnik`

Acceptance criteria
- The documented example(s) for InternalServerErrorResponse reflect the actual InvalidClusterVersionError message produced at runtime.

Note
This issue only tracks the documentation/schema mismatch.
EOF

# Create the issue and print resulting URL
gh issue create --repo "$REPO" --title "$TITLE" --assignee "$ASSIGNEE" --body "$BODY"

Length of output: 0


@tisnik Thanks for the heads-up. I retried creating the issue with diagnostics; posting the result above. If creation succeeded, you’ll see the issue URL and number. If auth or permission blocked it, the script output includes the failure details so we can adjust (e.g., grant the GitHub App permission to create issues or I can proceed without assigning).


🏁 Script executed:

#!/bin/bash
set -euo pipefail

REPO="lightspeed-core/lightspeed-stack"
TITLE="Mismatch between OpenAPI 500 example and runtime InvalidClusterVersionError message"
ASSIGNEE="tisnik"

echo "== gh version =="
gh --version || true
echo

echo "== gh auth status =="
if gh auth status >/dev/null 2>&1; then
  echo "AUTH=OK"
else
  echo "AUTH=FAILED"
fi
echo

echo "== Checking for existing issue with the same title =="
existing_json="$(gh issue list --repo "$REPO" --state all --search "\"$TITLE\" in:title" --json number,title,url,htmlUrl,state --limit 50 2>/dev/null || echo "[]")"
echo "$existing_json" | jq -r '.[] | "\(.number)\t\(.state)\t\(.title)\t\(.htmlUrl // .url)"' || true
if echo "$existing_json" | jq -e '. | length > 0' >/dev/null 2>&1; then
  echo
  echo "FOUND_EXISTING_URL=$(echo "$existing_json" | jq -r '.[0].htmlUrl // .[0].url')"
  exit 0
fi
echo

read -r -d '' BODY <<'EOF'
Summary
OpenAPI documentation example for InternalServerErrorResponse mentions a cause text that does not match the actual InvalidClusterVersionError message returned at runtime.

What’s affected
- docs/openapi.json: InternalServerErrorResponse examples (label: "invalid cluster version") currently show:
  "ClusterVersion missing required field: 'clusterID'".
- Runtime: src/authentication/k8s.py raises InvalidClusterVersionError with:
  "Missing or invalid 'clusterID' in ClusterVersion".
- The exception handler uses str(e) to populate the "detail.cause" field, so clients will see the latter message.

Why this matters
- API consumers and tests relying on documented examples may assert on the wrong message.
- Keeps the OpenAPI schema examples consistent with real responses.

Context and references
- PR: https://github.com/lightspeed-core/lightspeed-stack/pull/1387
- Comment: https://github.com/lightspeed-core/lightspeed-stack/pull/1387#discussion_r2979878538
- Requested by: `@tisnik`

Acceptance criteria
- The documented example(s) for InternalServerErrorResponse reflect the actual InvalidClusterVersionError message produced at runtime.

Note
This issue only tracks the documentation/schema mismatch.
EOF

echo "== Creating issue via GitHub REST (gh api) =="
set +e
create_json="$(gh api -X POST -H "Accept: application/vnd.github+json" "repos/$REPO/issues" \
  -f title="$TITLE" \
  -f body="$BODY" \
  -f "assignees[]=$ASSIGNEE" 2>&1)"
rc=$?
set -e

if [ $rc -ne 0 ]; then
  echo "First attempt (with assignee) failed, retrying without assignee..."
  set +e
  create_json="$(gh api -X POST -H "Accept: application/vnd.github+json" "repos/$REPO/issues" \
    -f title="$TITLE" \
    -f body="$BODY" 2>&1)"
  rc=$?
  set -e
fi

if [ $rc -eq 0 ]; then
  echo "$create_json" | jq -r '"CREATED_ISSUE=\(.html_url // .url)  NUMBER=#\(.number)"'
else
  echo "CREATE_FAILED_OUTPUT_START"
  echo "$create_json"
  echo "CREATE_FAILED_OUTPUT_END"
fi

Length of output: 185


@tisnik I attempted to open the issue, but the GitHub CLI wasn’t authenticated in this environment (gh auth status returned AUTH=FAILED), so no issue was created.

Here’s the ready-to-file issue. You can either:

  • Grant the CodeRabbit GitHub App “Issues: Read and write” permission on lightspeed-core/lightspeed-stack and ask me to retry, or
  • Create it manually using the content below (I’ll mark this thread accordingly once it’s opened).

Title
Mismatch between OpenAPI 500 example and runtime InvalidClusterVersionError message

Body
Summary
OpenAPI documentation example for InternalServerErrorResponse mentions a cause text that does not match the actual InvalidClusterVersionError message returned at runtime.

What’s affected

  • docs/openapi.json: InternalServerErrorResponse examples (label: "invalid cluster version") currently show:
    "ClusterVersion missing required field: 'clusterID'".
  • Runtime: src/authentication/k8s.py raises InvalidClusterVersionError with:
    "Missing or invalid 'clusterID' in ClusterVersion".
  • The exception handler uses str(e) to populate the "detail.cause" field, so clients will see the latter message.

Why this matters

  • API consumers and tests relying on documented examples may assert on the wrong message.
  • Keeps the OpenAPI schema examples consistent with real responses.

Context and references

Acceptance criteria

  • The documented example(s) for InternalServerErrorResponse reflect the actual InvalidClusterVersionError message produced at runtime.

Note
This issue only tracks the documentation/schema mismatch.

Next steps

  • If you enable the permission, ping me with “retry issue creation” and I’ll create it (assigning to you). If you prefer, I can also open it without an assignee.

@tisnik tisnik merged commit 131fc01 into lightspeed-core:main Mar 24, 2026
24 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.

1 participant