From ea20368b40226b946ad1dc73d804092df8a1bb5f Mon Sep 17 00:00:00 2001 From: trivikramkalagi91-commits Date: Tue, 2 Jun 2026 12:54:53 +0530 Subject: [PATCH 1/4] feat: trigger strict inngest ci background workflow via native edge ingestion --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++-- app/api/inngest/route.ts | 15 ++++++++++++++- app/api/tests/run/route.ts | 2 +- lib/inngest.ts | 25 +++++++++++++++++++++---- 4 files changed, 59 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4877921..6549406 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,18 @@ name: CI on: push: branches: - - main - - master + - prod + paths-ignore: + - 'README.md' + - '*.md' + - 'docs/**' pull_request: + branches: + - prod + paths-ignore: + - 'README.md' + - '*.md' + - 'docs/**' permissions: contents: read @@ -58,3 +67,15 @@ jobs: - name: Run build run: npm run build + + - name: Trigger Inngest CI Workflow + run: | + curl -X POST https://inn.gset.io/e/${{ secrets.INNGEST_EVENT_KEY }} \ + -H "Content-Type: application/json" \ + -d '{ + "name": "ci/workflow.triggered", + "data": { + "ref": "${{ github.ref }}", + "sha": "${{ github.sha }}" + } + }' diff --git a/app/api/inngest/route.ts b/app/api/inngest/route.ts index 9cf9a9d..1358115 100644 --- a/app/api/inngest/route.ts +++ b/app/api/inngest/route.ts @@ -8,10 +8,23 @@ import { runVibetest } from "@/lib/test-functions/vibetest-run"; import { runSecurityAgent } from "@/lib/security-agent/functions"; import { indexDeploymentLogs, cronReindexLogs } from "@/lib/vector-indexer"; // ← add this +const handleCiWorkflow = inngest.createFunction( + { id: "handle-ci-workflow" }, + { event: "ci/workflow.triggered" }, + async ({ event, step }) => { + const { ref, sha } = event.data; + + await step.run("execute-safely", async () => { + console.log(`Processing build for Ref: ${ref}, SHA: ${sha}`); + return { status: "processed" }; + }); + } +); + // Allow Inngest handler up to 5 minutes (max for Vercel hobby plan) export const maxDuration = 300; export const { GET, POST, PUT } = serve({ client: inngest, - functions: [runTestSuite, runSecurityScan, runApiTests, runPerformanceTests, runVibetest, runSecurityAgent, indexDeploymentLogs, cronReindexLogs], + functions: [runTestSuite, runSecurityScan, runApiTests, runPerformanceTests, runVibetest, runSecurityAgent, indexDeploymentLogs, cronReindexLogs, handleCiWorkflow], }); \ No newline at end of file diff --git a/app/api/tests/run/route.ts b/app/api/tests/run/route.ts index 2d2f712..1e76cff 100644 --- a/app/api/tests/run/route.ts +++ b/app/api/tests/run/route.ts @@ -12,7 +12,7 @@ import { getDb, ensureTables } from "@/lib/db"; import { randomBytes } from "node:crypto"; import { auth } from "@/lib/auth"; -const EVENT_MAP: Record = { +const EVENT_MAP: Record = { suite: "test/suite.run", security: "test/security.run", api: "test/api.run", diff --git a/lib/inngest.ts b/lib/inngest.ts index 926a5fa..4e854f2 100644 --- a/lib/inngest.ts +++ b/lib/inngest.ts @@ -1,6 +1,23 @@ -import { Inngest } from "inngest"; +import { Inngest, EventSchemas } from "inngest"; -export const inngest = new Inngest({ - id: "secdev", - eventKey: process.env.INNGEST_EVENT_KEY, +type Events = { + "ci/workflow.triggered": { + data: { + ref: string; + sha: string; + }; + }; + "log/index.requested": { data: { sandboxId: string; userId: string; ttlDays: number } }; + "log/index.cron": { data: Record }; + "security-agent/scan.run": { data: { runId: string; sandboxId: string } }; + "test/api.run": { data: { runId: string; sandboxId: string } }; + "test/performance.run": { data: { runId: string; sandboxId: string } }; + "test/security.run": { data: { runId: string; sandboxId: string } }; + "test/suite.run": { data: { runId: string; sandboxId: string } }; + "test/vibetest.run": { data: { runId: string; sandboxId: string } }; +}; + +export const inngest = new Inngest({ + id: "secdev-app", + schemas: new EventSchemas().fromRecord() }); From dc621ad3e6a322aa046f50a5ef030f30d8af05d0 Mon Sep 17 00:00:00 2001 From: trivikramkalagi91-commits Date: Tue, 2 Jun 2026 13:04:56 +0530 Subject: [PATCH 2/4] fix: use standard inngest api gateway to prevent dns resolution failure --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6549406..6789778 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - name: Trigger Inngest CI Workflow run: | - curl -X POST https://inn.gset.io/e/${{ secrets.INNGEST_EVENT_KEY }} \ + curl -X POST https://api.inngest.com/e/${{ secrets.INNGEST_EVENT_KEY }} \ -H "Content-Type: application/json" \ -d '{ "name": "ci/workflow.triggered", From ecfdff076754ec6abc88aa2c0d829536c8bf5c3e Mon Sep 17 00:00:00 2001 From: trivikramkalagi91-commits Date: Tue, 2 Jun 2026 13:08:36 +0530 Subject: [PATCH 3/4] chore: add workflow fork safety and network fail-safe --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6789778..a6b3382 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,9 @@ jobs: run: npm run build - name: Trigger Inngest CI Workflow + if: ${{ secrets.INNGEST_EVENT_KEY != '' }} run: | - curl -X POST https://api.inngest.com/e/${{ secrets.INNGEST_EVENT_KEY }} \ + curl --fail -X POST https://api.inngest.com/e/${{ secrets.INNGEST_EVENT_KEY }} \ -H "Content-Type: application/json" \ -d '{ "name": "ci/workflow.triggered", From 97115923b90a92332a27c2709353206b7f55b575 Mon Sep 17 00:00:00 2001 From: trivikramkalagi91-commits Date: Tue, 2 Jun 2026 13:10:20 +0530 Subject: [PATCH 4/4] feat: connect ci handler to downstream test suites --- app/api/inngest/route.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/api/inngest/route.ts b/app/api/inngest/route.ts index 1358115..d4b07fd 100644 --- a/app/api/inngest/route.ts +++ b/app/api/inngest/route.ts @@ -16,7 +16,17 @@ const handleCiWorkflow = inngest.createFunction( await step.run("execute-safely", async () => { console.log(`Processing build for Ref: ${ref}, SHA: ${sha}`); - return { status: "processed" }; + + // Send the event to start the actual test suites in the app + await inngest.send({ + name: "test/suite.run", + data: { + runId: `ci-${sha.slice(0, 7)}`, + sandboxId: "production-ci-environment", + }, + }); + + return { status: "test_suite_dispatched" }; }); } );