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
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI

on:
push:
branches:
- main
- master
paths:
- 'pkgs/bay/**'
- 'pkgs/ship/**'
- '.github/workflows/ci.yml'
pull_request:
branches:
- main
- master
paths:
- 'pkgs/bay/**'
- 'pkgs/ship/**'
- '.github/workflows/ci.yml'

jobs:
test-bay:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/bay

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run tests
env:
PYTHONPATH: .
run: uv run python -m pytest tests/unit

e2e-bay:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/bay

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run E2E tests (Docker Container)
run: |
chmod +x tests/scripts/test_docker_container.sh
./tests/scripts/test_docker_container.sh

test-ship:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/ship

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: uv sync --all-extras --dev

# Assuming ship has tests, if not this step might fail or do nothing.
# Based on file list, ship has tests/integration but maybe not unit tests yet.
# We'll try to run pytest if tests directory exists.
- name: Run tests
run: |
if [ -d "tests" ]; then
uv run pytest tests
else
echo "No tests directory found for ship"
fi
25 changes: 25 additions & 0 deletions pkgs/bay/app/services/ship/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,31 @@ async def forward_request_to_ship(
) as response:
if response.status == 200:
data = await response.json()

# Log full response at DEBUG level
logger.debug(f"Full ship exec response for {request.type}: {data}")

# Create summary for INFO level to avoid noise and data exposure
summary = {}
if isinstance(data, dict):
# Whitelist specific safe fields
for k in ["status", "exit_code", "execution_count", "success", "error"]:
if k in data:
summary[k] = data[k]

# Summarize other fields
for k, v in data.items():
if k not in summary:
if isinstance(v, str):
summary[f"{k}_len"] = len(v)
elif isinstance(v, (list, dict)):
summary[f"{k}_size"] = len(v)
else:
summary[f"{k}_type"] = type(v).__name__
else:
summary = {"type": type(data).__name__}

logger.info(f"Ship exec response for {request.type}: {summary}")
return ExecResponse(success=True, data=data)
else:
error_text = await response.text()
Expand Down
4 changes: 2 additions & 2 deletions pkgs/bay/app/services/ship/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def create_ship(self, request: CreateShipRequest, session_id: str) -> Ship
initial_ttl=request.ttl,
)
await db_service.create_session_ship(session_ship)
await db_service.increment_ship_session_count(available_ship.id)
available_ship = await db_service.increment_ship_session_count(available_ship.id)

# Recalculate ship's TTL based on all sessions' expiration times
await self._recalculate_and_schedule_cleanup(available_ship.id)
Expand Down Expand Up @@ -177,7 +177,7 @@ async def create_ship(self, request: CreateShipRequest, session_id: str) -> Ship
initial_ttl=request.ttl,
)
await db_service.create_session_ship(session_ship)
await db_service.increment_ship_session_count(ship.id)
ship = await db_service.increment_ship_session_count(ship.id)

# Schedule TTL cleanup
await self._schedule_cleanup(ship.id, ship.ttl)
Expand Down
Loading