Skip to content

Commit dec9b0f

Browse files
authored
Merge branch 'openshift:main' into postgres-remaining-quota-update
2 parents f50e160 + 44e9076 commit dec9b0f

22 files changed

+882
-411
lines changed

.tekton/lightspeed-service-pull-request.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ spec:
172172
- name: name
173173
value: git-clone-oci-ta
174174
- name: bundle
175-
value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:0d80f66610efd1f957700f61dcd5080689321b10ad544e136d58fc4673290d1b
175+
value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:3a920a83fc0135aaae2730fe9d446eb2da2ffc9d63a34bceea04afd24653bdee
176176
- name: kind
177177
value: task
178178
resolver: bundles
@@ -203,7 +203,7 @@ spec:
203203
- name: name
204204
value: prefetch-dependencies-oci-ta
205205
- name: bundle
206-
value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.2@sha256:dc82a7270aace9b1c26f7e96f8ccab2752e53d32980c41a45e1733baad76cde6
206+
value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.2@sha256:970285e3b0495961199523b566e0dd92ec2e29bedbcf61d8fc67106b06d0f923
207207
- name: kind
208208
value: task
209209
resolver: bundles
@@ -253,7 +253,7 @@ spec:
253253
- name: name
254254
value: buildah-remote-oci-ta
255255
- name: bundle
256-
value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.5@sha256:5e59c05455619580f4383010726f7db8440ecf6959882e9053ac697dd6d277fd
256+
value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.6@sha256:ac05dabe8b6b446f974cf2b6ef1079cfaa9443d7078c2ebe3ec79aa650e1b5b2
257257
- name: kind
258258
value: task
259259
resolver: bundles
@@ -284,7 +284,7 @@ spec:
284284
- name: name
285285
value: build-image-index
286286
- name: bundle
287-
value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.1@sha256:79784d53749584bc5a8de32142ec4e2f01cdbf42c20d94e59280e0b927c8597d
287+
value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.1@sha256:d94cad7f41be61074dd21c7dff26dab9217c3435a16f62813c1cb8382dd9aae6
288288
- name: kind
289289
value: task
290290
resolver: bundles
@@ -310,7 +310,7 @@ spec:
310310
- name: name
311311
value: source-build-oci-ta
312312
- name: bundle
313-
value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:36d44f2924f60da00a079a9ab7ce25ad8b2ad593c16d90509203c125ff0ccd46
313+
value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:2a290f91fdccf4c9ef726a1605163bc14904e1dbf9837ac6d2621caddd10f98e
314314
- name: kind
315315
value: task
316316
resolver: bundles
@@ -383,7 +383,7 @@ spec:
383383
- name: name
384384
value: ecosystem-cert-preflight-checks
385385
- name: bundle
386-
value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:dae8e28761cee4ab0baf04ab9f8f1a4b3cee3c7decf461fda2bacc5c01652a60
386+
value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:9568c51a5158d534248908b9b561cf67d2826ed4ea164ffd95628bb42380e6ec
387387
- name: kind
388388
value: task
389389
resolver: bundles
@@ -437,7 +437,7 @@ spec:
437437
- name: name
438438
value: sast-shell-check-oci-ta
439439
- name: bundle
440-
value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:bf7bdde00b7212f730c1356672290af6f38d070da2c8a316987b5c32fd49e0b9
440+
value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:f950c3cefcff91de751f4d24a297c3312a2b265dd54478193ba1330791976c35
441441
- name: kind
442442
value: task
443443
resolver: bundles
@@ -463,7 +463,7 @@ spec:
463463
- name: name
464464
value: sast-unicode-check-oci-ta
465465
- name: bundle
466-
value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.3@sha256:a2bde66f6b4164620298c7d709b8f08515409404000fa1dc2260d2508b135651
466+
value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.3@sha256:1cf8f6f6e991e1820cbebddaf9f38442a2ea5669956c9ffc2b7e4698ae7e99be
467467
- name: kind
468468
value: task
469469
resolver: bundles
@@ -530,7 +530,7 @@ spec:
530530
- name: name
531531
value: push-dockerfile-oci-ta
532532
- name: bundle
533-
value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.1@sha256:2bc5b3afc5de56da0f06eac60b65e86f6b861b16a63f48579fc0bac7d657e14c
533+
value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.1@sha256:14fba04580b236e4206a904b86ee2fd8eeaa4163f7619a9c2602d361e4f74c51
534534
- name: kind
535535
value: task
536536
resolver: bundles

.tekton/lightspeed-service-push.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ spec:
171171
- name: name
172172
value: git-clone-oci-ta
173173
- name: bundle
174-
value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:0d80f66610efd1f957700f61dcd5080689321b10ad544e136d58fc4673290d1b
174+
value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:3a920a83fc0135aaae2730fe9d446eb2da2ffc9d63a34bceea04afd24653bdee
175175
- name: kind
176176
value: task
177177
resolver: bundles
@@ -202,7 +202,7 @@ spec:
202202
- name: name
203203
value: prefetch-dependencies-oci-ta
204204
- name: bundle
205-
value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.2@sha256:dc82a7270aace9b1c26f7e96f8ccab2752e53d32980c41a45e1733baad76cde6
205+
value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.2@sha256:970285e3b0495961199523b566e0dd92ec2e29bedbcf61d8fc67106b06d0f923
206206
- name: kind
207207
value: task
208208
resolver: bundles
@@ -252,7 +252,7 @@ spec:
252252
- name: name
253253
value: buildah-remote-oci-ta
254254
- name: bundle
255-
value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.5@sha256:5e59c05455619580f4383010726f7db8440ecf6959882e9053ac697dd6d277fd
255+
value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.6@sha256:ac05dabe8b6b446f974cf2b6ef1079cfaa9443d7078c2ebe3ec79aa650e1b5b2
256256
- name: kind
257257
value: task
258258
resolver: bundles
@@ -283,7 +283,7 @@ spec:
283283
- name: name
284284
value: build-image-index
285285
- name: bundle
286-
value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.1@sha256:79784d53749584bc5a8de32142ec4e2f01cdbf42c20d94e59280e0b927c8597d
286+
value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.1@sha256:d94cad7f41be61074dd21c7dff26dab9217c3435a16f62813c1cb8382dd9aae6
287287
- name: kind
288288
value: task
289289
resolver: bundles
@@ -309,7 +309,7 @@ spec:
309309
- name: name
310310
value: source-build-oci-ta
311311
- name: bundle
312-
value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:36d44f2924f60da00a079a9ab7ce25ad8b2ad593c16d90509203c125ff0ccd46
312+
value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:2a290f91fdccf4c9ef726a1605163bc14904e1dbf9837ac6d2621caddd10f98e
313313
- name: kind
314314
value: task
315315
resolver: bundles
@@ -382,7 +382,7 @@ spec:
382382
- name: name
383383
value: ecosystem-cert-preflight-checks
384384
- name: bundle
385-
value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:dae8e28761cee4ab0baf04ab9f8f1a4b3cee3c7decf461fda2bacc5c01652a60
385+
value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:9568c51a5158d534248908b9b561cf67d2826ed4ea164ffd95628bb42380e6ec
386386
- name: kind
387387
value: task
388388
resolver: bundles
@@ -436,7 +436,7 @@ spec:
436436
- name: name
437437
value: sast-shell-check-oci-ta
438438
- name: bundle
439-
value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:bf7bdde00b7212f730c1356672290af6f38d070da2c8a316987b5c32fd49e0b9
439+
value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:f950c3cefcff91de751f4d24a297c3312a2b265dd54478193ba1330791976c35
440440
- name: kind
441441
value: task
442442
resolver: bundles
@@ -462,7 +462,7 @@ spec:
462462
- name: name
463463
value: sast-unicode-check-oci-ta
464464
- name: bundle
465-
value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.3@sha256:a2bde66f6b4164620298c7d709b8f08515409404000fa1dc2260d2508b135651
465+
value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.3@sha256:1cf8f6f6e991e1820cbebddaf9f38442a2ea5669956c9ffc2b7e4698ae7e99be
466466
- name: kind
467467
value: task
468468
resolver: bundles
@@ -529,7 +529,7 @@ spec:
529529
- name: name
530530
value: push-dockerfile-oci-ta
531531
- name: bundle
532-
value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.1@sha256:2bc5b3afc5de56da0f06eac60b65e86f6b861b16a63f48579fc0bac7d657e14c
532+
value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.1@sha256:14fba04580b236e4206a904b86ee2fd8eeaa4163f7619a9c2602d361e4f74c51
533533
- name: kind
534534
value: task
535535
resolver: bundles

AGENTS.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# OpenShift LightSpeed Service - Development Guide for Claude
2+
3+
## Project Overview
4+
OpenShift LightSpeed (OLS) is an AI-powered assistant service for OpenShift built with FastAPI, LangChain, and LlamaIndex. It provides AI responses to OpenShift/Kubernetes questions using various LLM backends.
5+
6+
## Key Architecture
7+
- **FastAPI/Uvicorn** - REST API server
8+
- **LangChain/LlamaIndex** - LLM integration and RAG
9+
- **Modular Provider System** - Support for OpenAI, Azure OpenAI, WatsonX, RHEL AI, etc.
10+
- **Async/Await** - Throughout the codebase
11+
- **Pydantic Models** - Configuration and data validation
12+
13+
## Code Standards
14+
15+
### Python Version & Dependencies
16+
- **Python 3.11/3.12** - Target version py311 in all code
17+
- **PDM** - Package manager (not pip/poetry)
18+
- **Dependencies** - Always check existing imports before adding new ones
19+
20+
### Code Quality Tools
21+
- **Ruff** - Linting (Google docstring convention)
22+
- **Black** - Code formatting
23+
- **MyPy** - Type checking (strict mode)
24+
- **Bandit** - Security scanning
25+
- **Coverage** - 90%+ unit test coverage required
26+
27+
### Style Guidelines
28+
- **Line Length**: 100 characters
29+
- **Docstrings**: Google style, imperative mood for functions
30+
- **Type Hints**: Required for all function signatures
31+
- **No Comments**: Code should be self-documenting unless explicitly requested
32+
- **Imports**: Absolute imports, grouped per PEP8
33+
34+
### File Organization
35+
```
36+
ols/
37+
├── app/ # FastAPI application (main.py, routers, endpoints)
38+
├── src/ # Core business logic
39+
│ ├── auth/ # Authentication (k8s, noop)
40+
│ ├── cache/ # Conversation caching (memory, postgres)
41+
│ ├── llms/ # LLM providers and loading
42+
│ ├── query_helpers/ # Query processing utilities
43+
│ └── utils/ # Shared utilities
44+
├── constants.py # Global constants
45+
└── utils/ # Configuration and utilities
46+
```
47+
48+
## Testing Strategy
49+
50+
### Test Structure
51+
```
52+
tests/
53+
├── unit/ # Unit tests (pytest, mocking)
54+
├── integration/ # Integration tests with real services
55+
├── e2e/ # End-to-end tests against running service
56+
└── benchmarks/ # Performance benchmarks
57+
```
58+
59+
### Testing Practices
60+
- **pytest** - Testing framework
61+
- **pytest-asyncio** - For async test support
62+
- **Mock extensively** - Use unittest.mock for external dependencies
63+
- **Fixtures** - Use conftest.py for shared test setup
64+
- **Coverage** - Aim for 90%+ coverage, measured per test type
65+
- **Test Naming** - `test_<function>_<scenario>` pattern
66+
67+
### Test Commands
68+
```bash
69+
make test-unit # Unit tests only
70+
make test-integration # Integration tests
71+
make test-e2e # End-to-end tests
72+
make test # All tests
73+
make coverage-report # Generate HTML coverage report
74+
```
75+
76+
## Configuration Patterns
77+
78+
### Config Structure
79+
- **YAML-based** - Primary config in `olsconfig.yaml`
80+
- **Pydantic Models** - All config classes in `ols/app/models/config.py`
81+
- **Environment Variables** - `OLS_CONFIG_FILE` for config path
82+
- **Validation** - Extensive validation with custom validators
83+
84+
### Provider Configuration
85+
LLM providers follow consistent patterns:
86+
```yaml
87+
llm_providers:
88+
- name: provider_name
89+
type: openai|azure_openai|watsonx|bam|...
90+
url: "api_endpoint"
91+
credentials_path: path/to/api/key
92+
models:
93+
- name: model_name
94+
```
95+
96+
## Development Workflow
97+
98+
### Setup
99+
```bash
100+
make install-deps # Install all dependencies
101+
make run # Start development server
102+
```
103+
104+
### Code Quality
105+
```bash
106+
make format # Format code (black + ruff)
107+
make verify # Run all linters and type checks
108+
make check-types # MyPy type checking only
109+
make security-check # Bandit security scan
110+
```
111+
112+
### Key Development Practices
113+
1. **Always run linters** - `make verify` before commits
114+
2. **Type everything** - Use proper type hints throughout
115+
3. **Test thoroughly** - Write tests for new functionality
116+
4. **Follow patterns** - Study existing code for consistency
117+
5. **Configuration validation** - Use Pydantic models for all config
118+
6. **Error handling** - Use custom exception classes
119+
7. **Async/await** - Use async patterns for I/O operations
120+
8. **Security first** - Never log secrets, use secure patterns
121+
122+
### Code Review Checklist
123+
- [ ] Type hints on all functions
124+
- [ ] Tests cover new functionality
125+
- [ ] Docstrings follow Google convention
126+
- [ ] No hardcoded credentials or secrets
127+
- [ ] Follows existing naming patterns
128+
- [ ] Proper error handling with custom exceptions
129+
- [ ] Async/await used appropriately
130+
- [ ] Configuration uses Pydantic models
131+
132+
## Common Patterns
133+
134+
### Error Handling
135+
```python
136+
from ols.utils.errors import SomeCustomError
137+
138+
def validate_something(data: str) -> None:
139+
if not data:
140+
raise SomeCustomError("Validation failed")
141+
```
142+
143+
### Configuration Classes
144+
```python
145+
from pydantic import BaseModel, field_validator
146+
147+
class ConfigClass(BaseModel):
148+
field: str
149+
150+
@field_validator("field")
151+
@classmethod
152+
def validate_field(cls, value: str) -> str:
153+
return value
154+
```
155+
156+
### Provider Interface
157+
Study existing providers in `ols/src/llms/providers/` for implementation patterns.
158+
159+
### Testing with Mocks
160+
```python
161+
from unittest.mock import Mock, patch
162+
import pytest
163+
164+
@patch("ols.module.external_dependency")
165+
def test_function(mock_dep):
166+
mock_dep.return_value = "expected_result"
167+
# test logic
168+
```
169+
170+
## Performance Considerations
171+
- Use async/await for I/O operations
172+
- Cache expensive operations appropriately
173+
- Monitor token usage and context windows
174+
- Consider memory usage for conversation history
175+
176+
## Security Guidelines
177+
- Never commit secrets or API keys
178+
- Use environment variables and file-based secrets
179+
- Validate all inputs with Pydantic
180+
- Use TLS for all external communications
181+
- Follow principle of least privilege
182+
183+
Run `make help` to see all available commands.

0 commit comments

Comments
 (0)