-
Notifications
You must be signed in to change notification settings - Fork 0
Codex/pr6 fix #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 26 commits
3e4ac3e
8add219
df26ff1
e99ccc6
a1a55bf
2534b86
5bd9de3
051c9c1
cc5821a
8a3cd47
d74331e
59516d4
684c6c9
aaf4d9f
4d7bf73
143bdf7
ad6f5f0
588db81
9131353
10fa6f1
8a97319
f53b589
97b1c36
b84c017
bdd4daa
03d5bbe
d30c886
d9b8925
e1fa0f0
63179af
818236a
ee67fe5
9e98fa6
f3a5302
9b10eba
42a32be
4f8ebc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| name: Chaos Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| experiment: | ||
| description: 'Experiment to run' | ||
| required: true | ||
| default: all | ||
| type: choice | ||
| options: | ||
| - all | ||
| - pod-kill | ||
| - kafka-consumer-pause | ||
| - redis-outage | ||
| - projection-lag | ||
| - network-partition | ||
| namespace: | ||
| description: 'Target namespace' | ||
| required: true | ||
| default: grainguard-dev | ||
| schedule: | ||
| # Run full suite every Saturday at 02:00 UTC (off-peak) | ||
| - cron: '0 2 * * 6' | ||
|
|
||
| env: | ||
| NAMESPACE: ${{ github.event.inputs.namespace || 'grainguard-dev' }} | ||
|
|
||
| jobs: | ||
| chaos: | ||
| name: Chaos — ${{ github.event.inputs.experiment || 'all' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
Comment on lines
+29
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Serialize chaos runs per namespace. Because the allowlist currently collapses every run onto Suggested fix chaos:
name: Chaos — ${{ github.event.inputs.experiment || 'all' }}
runs-on: ubuntu-latest
timeout-minutes: 30
+ concurrency:
+ group: chaos-${{ github.event.inputs.namespace || 'grainguard-dev' }}
+ cancel-in-progress: false🤖 Prompt for AI Agents |
||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Configure kubectl | ||
| uses: azure/setup-kubectl@v3 | ||
| with: | ||
| version: 'v1.29.0' | ||
|
|
||
| - name: Set kubeconfig | ||
| run: | | ||
| mkdir -p "$HOME/.kube" | ||
| echo "${{ secrets.KUBECONFIG_DEV }}" | base64 -d > "$HOME/.kube/config" | ||
| chmod 600 "$HOME/.kube/config" | ||
|
|
||
| - name: Install Chaos Toolkit | ||
| run: | | ||
| pip install --quiet \ | ||
| chaostoolkit==1.19.0 \ | ||
| chaostoolkit-kubernetes==0.26.4 \ | ||
| chaostoolkit-verification==0.3.0 | ||
|
|
||
| - name: Make scripts executable | ||
| run: chmod +x tests/chaos/*.sh | ||
|
|
||
| - name: Run — all experiments | ||
| if: ${{ github.event.inputs.experiment == 'all' || github.event_name == 'schedule' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| KAFKA_BOOTSTRAP: kafka:9092 | ||
| GATEWAY_URL: ${{ secrets.CHAOS_GATEWAY_URL }} | ||
| PROMETHEUS_URL: ${{ secrets.CHAOS_PROMETHEUS_URL }} | ||
| TEST_JWT: ${{ secrets.CHAOS_TEST_JWT }} | ||
| run: bash tests/chaos/run-all.sh | ||
|
Comment on lines
+71
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested fix - name: Run — all experiments
if: ${{ github.event.inputs.experiment == 'all' || github.event_name == 'schedule' }}
env:
NAMESPACE: ${{ env.NAMESPACE }}
KAFKA_BOOTSTRAP: kafka:9092
GATEWAY_URL: ${{ secrets.CHAOS_GATEWAY_URL }}
PROMETHEUS_URL: ${{ secrets.CHAOS_PROMETHEUS_URL }}
TEST_JWT: ${{ secrets.CHAOS_TEST_JWT }}
+ STRICT_ALERT_CHECK: "1"
run: bash tests/chaos/run-all.sh🤖 Prompt for AI Agents |
||
|
|
||
| - name: Run — pod-kill | ||
| if: ${{ github.event.inputs.experiment == 'pod-kill' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| run: chaos run tests/chaos/pod-kill.yaml | ||
|
|
||
| - name: Run — kafka-consumer-pause | ||
| if: ${{ github.event.inputs.experiment == 'kafka-consumer-pause' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| KAFKA_BOOTSTRAP: kafka:9092 | ||
| run: bash tests/chaos/kafka-consumer-pause.sh | ||
|
|
||
| - name: Run — redis-outage | ||
| if: ${{ github.event.inputs.experiment == 'redis-outage' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| GATEWAY_URL: ${{ secrets.CHAOS_GATEWAY_URL }} | ||
| TEST_JWT: ${{ secrets.CHAOS_TEST_JWT }} | ||
| run: bash tests/chaos/redis-outage.sh | ||
|
|
||
| - name: Run — projection-lag | ||
| if: ${{ github.event.inputs.experiment == 'projection-lag' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| KAFKA_BOOTSTRAP: kafka:9092 | ||
| PROMETHEUS_URL: ${{ secrets.CHAOS_PROMETHEUS_URL }} | ||
| STRICT_ALERT_CHECK: "1" | ||
| run: bash tests/chaos/projection-lag.sh | ||
|
|
||
| - name: Run — network-partition | ||
| if: ${{ github.event.inputs.experiment == 'network-partition' }} | ||
| env: | ||
| NAMESPACE: ${{ env.NAMESPACE }} | ||
| run: chaos run tests/chaos/network-partition.yaml | ||
|
|
||
| - name: Upload chaos logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: chaos-results-${{ github.run_number }} | ||
| path: tests/chaos/results/ | ||
| retention-days: 30 | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Notify Slack on failure | ||
| if: failure() | ||
| uses: slackapi/slack-github-action@v1.26.0 | ||
| with: | ||
| payload: | | ||
| { | ||
| "text": ":fire: Chaos experiment *${{ github.event.inputs.experiment || 'all' }}* FAILED on `${{ env.NAMESPACE }}` — <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" | ||
| } | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHAOS_WEBHOOK }} | ||
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,13 +20,13 @@ jobs: | |
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.24" | ||
| go-version: "1.25" | ||
| cache: true | ||
|
|
||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| version: v1.62 | ||
| version: v1.64.8 | ||
| args: --timeout=5m | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| go-test: | ||
|
|
@@ -37,7 +37,7 @@ jobs: | |
|
|
||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.24" | ||
| go-version: "1.25" | ||
| cache: true | ||
|
|
||
| - name: Download deps | ||
|
|
@@ -79,7 +79,12 @@ jobs: | |
| working-directory: apps/${{ matrix.app }} | ||
|
|
||
| - name: ESLint | ||
| run: npm run lint | ||
| run: | | ||
| if npm run | grep -qE '^[[:space:]]+lint'; then | ||
| npm run lint | ||
| else | ||
| echo "No lint script for ${{ matrix.app }}; skipping ESLint step" | ||
| fi | ||
|
Comment on lines
81
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't let a missing This changes the job from “lint these apps” to “lint them if a script happens to exist.” A renamed or removed script will now silently green the check. If an app should be exempt, remove it from the matrix or model that exception explicitly. 🤖 Prompt for AI Agents |
||
| working-directory: apps/${{ matrix.app }} | ||
|
|
||
| - name: Typecheck | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,74 @@ | ||||||||||||||||||||||||||||||
| name: E2E Tests | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||
| branches: [master] | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||
| e2e: | ||||||||||||||||||||||||||||||
| name: Playwright E2E | ||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||
| timeout-minutes: 20 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Set up Node.js | ||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| node-version: "20" | ||||||||||||||||||||||||||||||
| cache: npm | ||||||||||||||||||||||||||||||
| cache-dependency-path: apps/dashboard/package-lock.json | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install dashboard deps | ||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||
| working-directory: apps/dashboard | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install E2E deps | ||||||||||||||||||||||||||||||
| run: npm install --save-dev @playwright/test typescript ts-node | ||||||||||||||||||||||||||||||
| working-directory: tests/e2e | ||||||||||||||||||||||||||||||
|
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid Using ♻️ Suggested fix - name: Install E2E deps
- run: npm install --save-dev `@playwright/test` typescript ts-node
+ run: npm ci
working-directory: tests/e2eOr if no lockfile exists: - name: Install E2E deps
- run: npm install --save-dev `@playwright/test` typescript ts-node
+ run: npm install `@playwright/test` typescript ts-node
working-directory: tests/e2e📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install Playwright browsers | ||||||||||||||||||||||||||||||
| run: npx playwright install --with-deps chromium firefox | ||||||||||||||||||||||||||||||
| working-directory: tests/e2e | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Build dashboard | ||||||||||||||||||||||||||||||
| run: npm run build | ||||||||||||||||||||||||||||||
| working-directory: apps/dashboard | ||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| VITE_AUTH0_DOMAIN: ${{ secrets.VITE_AUTH0_DOMAIN }} | ||||||||||||||||||||||||||||||
| VITE_AUTH0_CLIENT_ID: ${{ secrets.VITE_AUTH0_CLIENT_ID }} | ||||||||||||||||||||||||||||||
| VITE_AUTH0_AUDIENCE: ${{ secrets.VITE_AUTH0_AUDIENCE }} | ||||||||||||||||||||||||||||||
| VITE_BFF_URL: ${{ secrets.E2E_BFF_URL }} | ||||||||||||||||||||||||||||||
| VITE_GATEWAY_URL: ${{ secrets.E2E_GATEWAY_URL }} | ||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Serve dashboard | ||||||||||||||||||||||||||||||
| run: npx serve -s dist -l 5173 & | ||||||||||||||||||||||||||||||
| working-directory: apps/dashboard | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Wait for server | ||||||||||||||||||||||||||||||
| run: npx wait-on http://localhost:5173 --timeout 30000 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Run Playwright tests | ||||||||||||||||||||||||||||||
| run: npx playwright test --config playwright.config.ts | ||||||||||||||||||||||||||||||
| working-directory: tests/e2e | ||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| E2E_BASE_URL: http://localhost:5173 | ||||||||||||||||||||||||||||||
| VITE_AUTH0_CLIENT_ID: ${{ secrets.VITE_AUTH0_CLIENT_ID }} | ||||||||||||||||||||||||||||||
| VITE_AUTH0_AUDIENCE: ${{ secrets.VITE_AUTH0_AUDIENCE }} | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Upload Playwright report | ||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| name: playwright-report-${{ github.run_number }} | ||||||||||||||||||||||||||||||
| path: tests/e2e/playwright-report/ | ||||||||||||||||||||||||||||||
| retention-days: 14 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Upload test results (JUnit) | ||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| name: playwright-results-${{ github.run_number }} | ||||||||||||||||||||||||||||||
| path: tests/e2e/playwright-results.xml | ||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add The JUnit XML artifact upload is missing settings that the HTML report upload has. This could cause workflow failures if the file is missing: ♻️ Suggested fix - name: Upload test results (JUnit)
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-results-${{ github.run_number }}
path: tests/e2e/playwright-results.xml
+ retention-days: 14
+ if-no-files-found: ignore📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,139 @@ | ||||||||||||||||||||||||||||||
| name: Performance Budget | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||
| branches: [master] | ||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||
| - "apps/gateway/**" | ||||||||||||||||||||||||||||||
| - "apps/bff/**" | ||||||||||||||||||||||||||||||
| - "scripts/load-tests/**" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||
| perf: | ||||||||||||||||||||||||||||||
| name: k6 Performance Budget | ||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||
| timeout-minutes: 15 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| services: | ||||||||||||||||||||||||||||||
| # Spin up the gateway and BFF as Docker Compose services | ||||||||||||||||||||||||||||||
| # so k6 can hit them without needing a live cluster | ||||||||||||||||||||||||||||||
| postgres: | ||||||||||||||||||||||||||||||
| image: postgres:16-alpine | ||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||
| - 5432:5432 | ||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| POSTGRES_USER: grainguard | ||||||||||||||||||||||||||||||
| POSTGRES_PASSWORD: grainguard | ||||||||||||||||||||||||||||||
| POSTGRES_DB: grainguard | ||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||
| options: >- | ||||||||||||||||||||||||||||||
| --health-cmd pg_isready | ||||||||||||||||||||||||||||||
| --health-interval 10s | ||||||||||||||||||||||||||||||
| --health-timeout 5s | ||||||||||||||||||||||||||||||
| --health-retries 5 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| redis: | ||||||||||||||||||||||||||||||
| image: redis:7-alpine | ||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||
| - 6379:6379 | ||||||||||||||||||||||||||||||
| options: >- | ||||||||||||||||||||||||||||||
| --health-cmd "redis-cli ping" | ||||||||||||||||||||||||||||||
| --health-interval 10s | ||||||||||||||||||||||||||||||
| --health-retries 5 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Set up Node.js | ||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| node-version: "20" | ||||||||||||||||||||||||||||||
| cache: npm | ||||||||||||||||||||||||||||||
| cache-dependency-path: apps/gateway/package-lock.json | ||||||||||||||||||||||||||||||
|
Comment on lines
+46
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Cache key only includes gateway dependencies. The ♻️ Suggested fix to include both lockfiles - name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
- cache-dependency-path: apps/gateway/package-lock.json
+ cache-dependency-path: |
+ apps/gateway/package-lock.json
+ apps/bff/package-lock.json📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install gateway deps | ||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||
| working-directory: apps/gateway | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install BFF deps | ||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||
| working-directory: apps/bff | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Start gateway in background | ||||||||||||||||||||||||||||||
| run: npx ts-node src/server.ts & | ||||||||||||||||||||||||||||||
| working-directory: apps/gateway | ||||||||||||||||||||||||||||||
|
Comment on lines
+61
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Background processes lack cleanup on failure. Gateway and BFF are started with Consider adding a cleanup step: 🛠️ Suggested cleanup stepAdd after the artifact upload step: - name: Cleanup background processes
if: always()
run: |
pkill -f "ts-node src/server.ts" || trueAlso applies to: 82-84 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| PORT: 3000 | ||||||||||||||||||||||||||||||
| NODE_ENV: development | ||||||||||||||||||||||||||||||
| AUTH_ENABLED: "false" | ||||||||||||||||||||||||||||||
| DATABASE_URL: postgres://grainguard:grainguard@localhost:5432/grainguard | ||||||||||||||||||||||||||||||
| REDIS_URL: redis://localhost:6379 | ||||||||||||||||||||||||||||||
|
Comment on lines
+64
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The gateway env block is using names the app ignores.
🛠️ Suggested change- DATABASE_URL: postgres://grainguard:grainguard@localhost:5432/grainguard
- REDIS_URL: redis://localhost:6379
+ READ_DATABASE_URL: postgres://grainguard:grainguard@localhost:5432/grainguard
+ WRITE_DATABASE_URL: postgres://grainguard:grainguard@localhost:5432/grainguard?sslmode=disable
+ REDIS_HOST: localhost
+ REDIS_PORT: 6379📝 Committable suggestion
Suggested change
🧰 Tools🪛 Checkov (3.2.510)[medium] 68-69: Basic Auth Credentials (CKV_SECRET_4) 🪛 YAMLlint (1.38.0)[error] 65-65: too many spaces after colon (colons) [error] 66-66: too many spaces after colon (colons) [error] 67-67: too many spaces after colon (colons) [error] 68-68: too many spaces after colon (colons) [error] 69-69: too many spaces after colon (colons) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| JWKS_URL: ${{ secrets.PERF_JWKS_URL }} | ||||||||||||||||||||||||||||||
| JWT_ISSUER: ${{ secrets.PERF_JWT_ISSUER }} | ||||||||||||||||||||||||||||||
| JWT_AUDIENCE: ${{ secrets.PERF_JWT_AUDIENCE }} | ||||||||||||||||||||||||||||||
| ALLOWED_ORIGINS: http://localhost:5173 | ||||||||||||||||||||||||||||||
| STRIPE_SECRET_KEY: sk_test_placeholder | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| STRIPE_WEBHOOK_SECRET: whsec_placeholder | ||||||||||||||||||||||||||||||
| STRIPE_PRICE_STARTER: price_placeholder | ||||||||||||||||||||||||||||||
| STRIPE_PRICE_PROFESSIONAL: price_placeholder | ||||||||||||||||||||||||||||||
| STRIPE_PRICE_ENTERPRISE: price_placeholder | ||||||||||||||||||||||||||||||
| DASHBOARD_URL: http://localhost:5173 | ||||||||||||||||||||||||||||||
| AUTH0_DOMAIN: placeholder.auth0.com | ||||||||||||||||||||||||||||||
| AUTH0_MANAGEMENT_CLIENT_ID: placeholder | ||||||||||||||||||||||||||||||
| AUTH0_MANAGEMENT_CLIENT_SECRET: placeholder | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Start BFF in background | ||||||||||||||||||||||||||||||
| run: npx ts-node src/server.ts & | ||||||||||||||||||||||||||||||
| working-directory: apps/bff | ||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| PORT: 4000 | ||||||||||||||||||||||||||||||
| NODE_ENV: development | ||||||||||||||||||||||||||||||
| AUTH_ENABLED: "false" | ||||||||||||||||||||||||||||||
| POSTGRES_HOST: localhost | ||||||||||||||||||||||||||||||
| POSTGRES_PORT: 5432 | ||||||||||||||||||||||||||||||
| POSTGRES_USER: grainguard | ||||||||||||||||||||||||||||||
| POSTGRES_PASSWORD: grainguard | ||||||||||||||||||||||||||||||
| POSTGRES_DB: grainguard | ||||||||||||||||||||||||||||||
|
Comment on lines
+91
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BFF Postgres is wired with the wrong variables.
🛠️ Suggested change- POSTGRES_HOST: localhost
- POSTGRES_PORT: 5432
- POSTGRES_USER: grainguard
- POSTGRES_PASSWORD: grainguard
- POSTGRES_DB: grainguard
+ READ_DATABASE_URL: postgres://grainguard:grainguard@localhost:5432/grainguard📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| REDIS_HOST: localhost | ||||||||||||||||||||||||||||||
| REDIS_PORT: 6379 | ||||||||||||||||||||||||||||||
| ELASTICSEARCH_URL: http://localhost:9200 | ||||||||||||||||||||||||||||||
| CASSANDRA_HOST: localhost | ||||||||||||||||||||||||||||||
| CASSANDRA_PORT: 9042 | ||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if the load test script references endpoints that might need Elasticsearch or Cassandra
rg -n -C3 'search|elastic|cassandra' scripts/load-tests/performance-budget.js || echo "No direct references found"
# Check BFF datasources for how these are used
fd -t f -e ts datasources --exec cat {} \; 2>/dev/null | head -100Repository: pahuldeepp/GrainGuard- Length of output: 92 🏁 Script executed: # Read the perf.yml workflow to understand what's being tested
cat -n .github/workflows/perf.ymlRepository: pahuldeepp/GrainGuard- Length of output: 5663 🏁 Script executed: # Check what's in the load test script
cat -n scripts/load-tests/performance-budget.jsRepository: pahuldeepp/GrainGuard- Length of output: 5897 🏁 Script executed: # Check if there's a docker-compose or service setup in the workflow
fd -t f docker-compose | xargs cat 2>/dev/nullRepository: pahuldeepp/GrainGuard- Length of output: 50378 🏁 Script executed: # Look for any references to elasticsearch or cassandra in the BFF codebase
rg -l 'elasticsearch|cassandra' --type ts --type jsRepository: pahuldeepp/GrainGuard- Length of output: 171 🏁 Script executed: # Check BFF datasource initialization
head -50 apps/bff/src/datasources/elasticsearch.tsRepository: pahuldeepp/GrainGuard- Length of output: 1352 🏁 Script executed: head -50 apps/bff/src/datasources/cassandra.tsRepository: pahuldeepp/GrainGuard- Length of output: 1356 🏁 Script executed: # Check if BFF server initialization requires these datasources
grep -A 20 "datasources" apps/bff/src/server.ts | head -40Repository: pahuldeepp/GrainGuard- Length of output: 48 🏁 Script executed: # Look for server.ts to see initialization
cat -n apps/bff/src/server.ts | head -100Repository: pahuldeepp/GrainGuard- Length of output: 3961 🏁 Script executed: # Search for where elasticsearch and cassandra are actually used in resolvers
rg -n "search\.|getCassandraClient|searchDevices|getTelemetryHistory" apps/bff/src/resolvers.ts | head -30Repository: pahuldeepp/GrainGuard- Length of output: 500 Add missing Elasticsearch and Cassandra service containers to the k6 performance test workflow. The BFF environment references 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| AUTH0_DOMAIN: placeholder.auth0.com | ||||||||||||||||||||||||||||||
| AUTH0_AUDIENCE: placeholder | ||||||||||||||||||||||||||||||
| AUTH0_ORG_CLAIM: org_id | ||||||||||||||||||||||||||||||
| JWKS_URL: https://example.invalid/.well-known/jwks.json | ||||||||||||||||||||||||||||||
| JWT_ISSUER: https://example.invalid/ | ||||||||||||||||||||||||||||||
| JWT_AUDIENCE: placeholder | ||||||||||||||||||||||||||||||
| ALLOWED_ORIGINS: http://localhost:5173 | ||||||||||||||||||||||||||||||
| JWT_SECRET: dev-secret | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Wait for gateway | ||||||||||||||||||||||||||||||
| run: npx wait-on tcp:3000 --timeout 30000 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Wait for BFF | ||||||||||||||||||||||||||||||
| run: npx wait-on tcp:4000 --timeout 30000 | ||||||||||||||||||||||||||||||
|
Comment on lines
+110
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the gateway or BFF fail to start within the timeout, the workflow silently continues and k6 runs against non-existent services. This produces confusing failures and wastes CI time. 🛠️ Suggested fix - name: Wait for gateway
- continue-on-error: true
run: npx wait-on tcp:3000 --timeout 30000
- name: Wait for BFF
- continue-on-error: true
run: npx wait-on tcp:4000 --timeout 30000📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install k6 | ||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||
| curl -L https://github.com/grafana/k6/releases/download/v0.51.0/k6-v0.51.0-linux-amd64.tar.gz | tar xz | ||||||||||||||||||||||||||||||
| sudo mv k6-v0.51.0-linux-amd64/k6 /usr/local/bin/k6 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Run performance budget | ||||||||||||||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||
|
Comment on lines
+123
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
k6 can exit non-zero when a threshold is breached, but this step is forced green, so the workflow never blocks a regression. The artifact upload already uses 🛠️ Suggested change - name: Run performance budget
- continue-on-error: true
run: |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| mkdir -p scripts/load-tests/results | ||||||||||||||||||||||||||||||
| k6 run \ | ||||||||||||||||||||||||||||||
| --env GATEWAY_URL=http://localhost:3000 \ | ||||||||||||||||||||||||||||||
| --env BFF_URL=http://localhost:4000 \ | ||||||||||||||||||||||||||||||
| --env JWT=dev-ci-token \ | ||||||||||||||||||||||||||||||
| scripts/load-tests/performance-budget.js | ||||||||||||||||||||||||||||||
| # k6 exits 99 if thresholds are breached — non-blocking until infra is stable | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Upload performance results | ||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| name: perf-results-${{ github.run_number }} | ||||||||||||||||||||||||||||||
| path: scripts/load-tests/results/ | ||||||||||||||||||||||||||||||
| retention-days: 30 | ||||||||||||||||||||||||||||||
| if-no-files-found: ignore | ||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.