Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 38 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: memorylayer-core-python/pyproject.toml

- name: Install package with dev and local extras
- name: Install package with dev and context extras
working-directory: memorylayer-core-python
run: pip install -e ".[dev,local]"
run: pip install -e ".[dev,context]"

- name: Lint with ruff
working-directory: memorylayer-core-python
Expand All @@ -52,7 +50,7 @@ jobs:

- name: Run tests
working-directory: memorylayer-core-python
run: pytest tests/ -m "not slow and not integration and not llm and not llm_quality"
run: pytest tests/ -m "not slow and not integration and not llm and not llm_quality" -x

# ──────────────────────────────────────────────────────────────────
# Python SDK (memorylayer-sdk-python)
Expand All @@ -66,8 +64,6 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: memorylayer-sdk-python/pyproject.toml

- name: Install package with dev extras
working-directory: memorylayer-sdk-python
Expand All @@ -83,13 +79,39 @@ jobs:

- name: Run tests
working-directory: memorylayer-sdk-python
run: pytest tests/
run: pytest tests/ -x

# ──────────────────────────────────────────────────────────────────
# TypeScript packages
# ──────────────────────────────────────────────────────────────────
build-typescript-sdk:
name: "TypeScript: memorylayer-sdk (build)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "22"

- name: Install dependencies
working-directory: memorylayer-sdk-typescript
run: npm ci

- name: Build
working-directory: memorylayer-sdk-typescript
run: npm run build

- name: Upload SDK build artifacts
uses: actions/upload-artifact@v4
with:
name: memorylayer-sdk-dist
path: memorylayer-sdk-typescript/dist/
retention-days: 1

test-typescript:
name: "TypeScript: ${{ matrix.package.name }}"
needs: build-typescript-sdk
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -102,13 +124,17 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: ${{ matrix.package.dir }}/package-lock.json
node-version: "22"

- name: Download SDK build artifacts
uses: actions/download-artifact@v4
with:
name: memorylayer-sdk-dist
path: memorylayer-sdk-typescript/dist/

- name: Install dependencies
working-directory: ${{ matrix.package.dir }}
run: npm install
run: npm ci

- name: Build
working-directory: ${{ matrix.package.dir }}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ node-modules/
.venv/
__pycache__/
*.pyc
uv.lock
package-lock.json
uv.lock
81 changes: 81 additions & 0 deletions memorylayer-cc-plugin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions memorylayer-core-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ target-version = "py312"

[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP"]
ignore = [
"E402", # module-level imports not at top — lazy imports used to avoid circular deps
"E501", # line too long — handled by formatter, some long strings intentional
"UP042", # str+Enum inheritance — StrEnum requires Python 3.11+ migration
"UP031", # printf-style formatting — used intentionally in logging
"F841", # unused variables — some intentional in batch/pipeline patterns
"F821", # undefined name — forward references and dynamic imports
"N806", # variable in function should be lowercase — established naming conventions
]

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""API routers for MemoryLayer.ai."""

EXT_MULTI_API_ROUTERS = 'memorylayer-server-api-routers'
EXT_MULTI_API_ROUTERS = "memorylayer-server-api-routers"
20 changes: 9 additions & 11 deletions memorylayer-core-python/src/memorylayer_server/api/health.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
"""Health check endpoints for MemoryLayer.ai API."""
import logging

from typing import Dict
import logging

from fastapi import APIRouter, status, Depends
from fastapi import APIRouter, Depends, status
from fastapi.responses import JSONResponse
from scitrera_app_framework import Plugin, Variables

from ..lifecycle.fastapi import get_logger
from . import EXT_MULTI_API_ROUTERS

router = APIRouter(tags=['health'])
router = APIRouter(tags=["health"])


@router.get("/health")
async def health_check() -> Dict[str, str]:
async def health_check() -> dict[str, str]:
"""
Basic health check endpoint.

Expand All @@ -25,7 +24,9 @@ async def health_check() -> Dict[str, str]:


@router.get("/health/ready")
async def readiness_check(logger: logging.Logger = Depends(get_logger), ) -> JSONResponse:
async def readiness_check(
logger: logging.Logger = Depends(get_logger),
) -> JSONResponse:
"""
Readiness check endpoint verifying database and cache connectivity.

Expand All @@ -40,6 +41,7 @@ async def readiness_check(logger: logging.Logger = Depends(get_logger), ) -> JSO
# Check database connectivity
try:
from memorylayer_server.services.storage import get_storage_backend

storage = get_storage_backend()
is_healthy = await storage.health_check()
checks["services"]["database"] = "connected" if is_healthy else "disconnected"
Expand All @@ -53,11 +55,7 @@ async def readiness_check(logger: logging.Logger = Depends(get_logger), ) -> JSO
# Cache is optional and not yet configured via plugin
checks["services"]["cache"] = "not_configured"

status_code = (
status.HTTP_200_OK
if checks["status"] == "ready"
else status.HTTP_503_SERVICE_UNAVAILABLE
)
status_code = status.HTTP_200_OK if checks["status"] == "ready" else status.HTTP_503_SERVICE_UNAVAILABLE

return JSONResponse(content=checks, status_code=status_code)

Expand Down
Loading
Loading