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

on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]

jobs:
frontend-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci || npm install

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.

P2: The npm ci || npm install fallback masks dependency drift. When package-lock.json is out of sync with package.json, npm ci fails and the fallback runs npm install, which silently resolves whatever versions are current instead of the locked, reproducible set — the exact regression this CI is meant to catch. Use npm ci alone so lock-file inconsistencies fail the build loudly.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 22:

<comment>The `npm ci || npm install` fallback masks dependency drift. When package-lock.json is out of sync with package.json, `npm ci` fails and the fallback runs `npm install`, which silently resolves whatever versions are current instead of the locked, reproducible set — the exact regression this CI is meant to catch. Use `npm ci` alone so lock-file inconsistencies fail the build loudly.</comment>

<file context>
@@ -0,0 +1,47 @@
+        cache-dependency-path: frontend/package-lock.json
+    - name: Install dependencies
+      working-directory: ./frontend
+      run: npm ci || npm install
+    - name: Run lint
+      working-directory: ./frontend
</file context>

- name: Run lint
working-directory: ./frontend
run: npx eslint src
- name: Run build
working-directory: ./frontend
run: npm run build
env:
CI: true

backend-ci:
runs-on: ubuntu-latest
services:
redis:
image: redis:alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
qdrant:
image: qdrant/qdrant:latest
ports:
- 6333:6333
- 6334:6334
mongo:

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.

P2: mongo and qdrant services have no health checks, so their containers can still be starting when the backend test step runs. Add health-check options (e.g. mongo mongosh --eval "db.adminCommand('ping')" with an interval) so the service is ready before the startup test, matching the redis service.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 49:

<comment>mongo and qdrant services have no health checks, so their containers can still be starting when the backend test step runs. Add health-check options (e.g. mongo `mongosh --eval "db.adminCommand('ping')"` with an interval) so the service is ready before the startup test, matching the redis service.</comment>

<file context>
@@ -31,6 +31,25 @@ jobs:
+        ports:
+          - 6333:6333
+          - 6334:6334
+      mongo:
+        image: mongo:latest
+        ports:
</file context>

image: mongo:latest
ports:
- 27017:27017
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install dependencies
working-directory: ./backend
run: npm ci || npm install
- name: Test backend startup
working-directory: ./backend
run: |
cp .env.example .env
node index.js &
SERVER_PID=$!
sleep 10
kill -0 $SERVER_PID
kill $SERVER_PID
Comment on lines +71 to +72

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.

P2: The backend startup test only verifies that the node process is still alive (kill -0 $SERVER_PID), not that the HTTP server actually started or is healthy. kill -0 returns success for any running process, so the step passes even when the server fails to bind its port or runs in a degraded state — for example, if Redis/Qdrant connection fails, the server stays up but /health returns 503 (Redis errors are logged, not fatal), and CI still goes green. Use the application's existing /health endpoint (listening on PORT=4000 from .env.example) and poll it for a 200 instead of a fixed sleep 10 plus a process-liveness check.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 71:

<comment>The backend startup test only verifies that the node process is still alive (`kill -0 $SERVER_PID`), not that the HTTP server actually started or is healthy. `kill -0` returns success for any running process, so the step passes even when the server fails to bind its port or runs in a degraded state — for example, if Redis/Qdrant connection fails, the server stays up but `/health` returns 503 (Redis errors are logged, not fatal), and CI still goes green. Use the application's existing `/health` endpoint (listening on PORT=4000 from `.env.example`) and poll it for a 200 instead of a fixed `sleep 10` plus a process-liveness check.</comment>

<file context>
@@ -44,4 +63,10 @@ jobs:
+        node index.js &
+        SERVER_PID=$!
+        sleep 10
+        kill -0 $SERVER_PID
+        kill $SERVER_PID
</file context>

Loading
Loading