From b895331cb138f75fca0215db774d03293be34bf9 Mon Sep 17 00:00:00 2001 From: Sam Clemente Date: Sun, 27 Sep 2026 22:34:41 -0500 Subject: [PATCH 1/3] test: stop the retention scheduler racing the MCP naming suite `withMcpToolNamingApp` boots the full app, so `SkillUsageRetentionLifecycle` spawns a detached prune at boot. Its per-project DELETEs take a write lock on the same shared in-memory SQLite database the suite is inserting into, which intermittently failed the suite with "database is locked". Disable the scheduler the way SkillUsageRouteTests and SkillUsageAnalyticsTests already do. Co-Authored-By: Claude Opus 5 (1M context) --- services/mcp-gateway/Tests/AppTests/McpToolNamingTests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/mcp-gateway/Tests/AppTests/McpToolNamingTests.swift b/services/mcp-gateway/Tests/AppTests/McpToolNamingTests.swift index 169f041..60a51e9 100644 --- a/services/mcp-gateway/Tests/AppTests/McpToolNamingTests.swift +++ b/services/mcp-gateway/Tests/AppTests/McpToolNamingTests.swift @@ -909,6 +909,9 @@ private func withMcpToolNamingApp( let (apply, restore) = mcpToolNamingTemporaryEnv([ "USE_SQLITE": "1", "USE_MEMORY_SESSIONS": "1", + // The retention scheduler prunes once at boot; its deletes race this suite's inserts and + // lock the shared in-memory SQLite database. + "DISABLE_SKILL_USAGE_RETENTION_SCHEDULER": "1", "MCP_OAUTH_ENABLED": "0", "FRONTEND_URL": "http://localhost:3000", "DATABASE_URL": nil, From 12576e5edffdb1103ec55c93bcc8fc4e054856d3 Mon Sep 17 00:00:00 2001 From: Sam Clemente Date: Sun, 27 Sep 2026 22:34:41 -0500 Subject: [PATCH 2/3] ci: drop the unused changed-path detection job The `ci` job never declared `needs: changes` and read none of the four outputs, so the job and `scripts/ci-detect-changes.sh` fed nothing. Path filtering now lives in each Railway service's `watchPatterns`. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 19 -------- AGENTS.md | 2 +- README.md | 2 +- docs/test-plans/README.md | 2 +- scripts/ci-detect-changes.sh | 92 ------------------------------------ 5 files changed, 3 insertions(+), 114 deletions(-) delete mode 100755 scripts/ci-detect-changes.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98fbe37..83faf1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,25 +15,6 @@ permissions: contents: read jobs: - changes: - name: Detect changed paths - runs-on: ubuntu-latest - outputs: - web: ${{ steps.filter.outputs.web }} - mcp_gateway: ${{ steps.filter.outputs.mcp_gateway }} - packages: ${{ steps.filter.outputs.packages }} - ci: ${{ steps.filter.outputs.ci }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Detect changed paths - id: filter - env: - GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }} - run: bash scripts/ci-detect-changes.sh - ci: name: Test and build runs-on: macos-latest diff --git a/AGENTS.md b/AGENTS.md index 70ada58..9a025ca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,7 +7,7 @@ - The repository is organized as a Stygian-style Bun/Turbo monorepo: `apps/web` for the Next.js dashboard, `services/mcp-gateway` for the Swift/Vapor backend, and `packages/*` for shared contracts/types. - Backend code lives under `services/mcp-gateway/Sources/App`; stale references to `Sources/MyContextProtocol`, `services/backend`, or `services/frontend` should be corrected when touched. - Development and production run on Railway with isolated Web, Gateway, and Postgres environments. The former Fly, Supabase, and Vercel production resources were permanently removed after the Railway cutover. -- CI is designed to run on GitHub Actions through `.github/workflows/ci.yml`, `scripts/ci.sh`, and `scripts/ci-detect-changes.sh`; Depot workflows are legacy and should not be reintroduced. +- CI is designed to run on GitHub Actions through `.github/workflows/ci.yml` and `scripts/ci.sh`; Depot workflows are legacy and should not be reintroduced. - Railway deploys through its GitHub integration (`dev` → Development, `main` → Production, Wait for CI on); do not reintroduce Actions deploy jobs or `railway up` deploy scripts. - The frontend was merged into this repository by git subtree from the archived `Stygian-Tech/my-context-protocol-frontend` history. - `mcp-server-kit` is the canonical external Swift package for reusable MCP protocol primitives. Local two-repo development may use a sibling checkout; GitHub Actions and Railway remote builds require a published Git revision. diff --git a/README.md b/README.md index 8dc877c..df0e4a7 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ GitHub Actions is the source of truth for CI. The single workflow at `.github/wo bash scripts/ci.sh ``` -The workflow detects changes with `scripts/ci-detect-changes.sh`, runs the Bun/Turbo workspace checks, and runs Swift tests/builds for `services/mcp-gateway`. Railway's GitHub integration deploys `dev` to Development and `main` to Production once those checks pass. +The workflow runs the Bun/Turbo workspace checks and the Swift tests/builds for `services/mcp-gateway`. Railway's GitHub integration deploys `dev` to Development and `main` to Production once those checks pass. ### Deployment diff --git a/docs/test-plans/README.md b/docs/test-plans/README.md index 910d87c..d3b69f0 100644 --- a/docs/test-plans/README.md +++ b/docs/test-plans/README.md @@ -11,4 +11,4 @@ | Development deployment | Merge to `dev` | Railway GitHub integration deploys `dev` after CI passes | | Production deployment | Merge `dev` into `main` | Railway GitHub integration deploys `main` after CI passes | -CI uses `scripts/ci-detect-changes.sh` for path detection and `scripts/ci.sh` as the shared local/GitHub entrypoint. +CI uses `scripts/ci.sh` as the shared local/GitHub entrypoint. diff --git a/scripts/ci-detect-changes.sh b/scripts/ci-detect-changes.sh deleted file mode 100755 index 607199c..0000000 --- a/scripts/ci-detect-changes.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# Detect changed path filters for CI without depending on a marketplace action. -set -euo pipefail - -BASE="" -HEAD="${GITHUB_SHA:-HEAD}" -MATCH_ALL=0 - -case "${GITHUB_EVENT_NAME:-}" in - pull_request|pull_request_target) - BASE="${GITHUB_EVENT_PULL_REQUEST_BASE_SHA:-}" - if [ -z "$BASE" ] && [ -n "${GITHUB_BASE_REF:-}" ]; then - BASE="$(git rev-parse --verify "origin/${GITHUB_BASE_REF}^{commit}" 2>/dev/null || git rev-parse --verify "${GITHUB_BASE_REF}^{commit}" 2>/dev/null || true)" - fi - if [ -z "$BASE" ]; then - echo "error: pull request change detection requires GITHUB_EVENT_PULL_REQUEST_BASE_SHA or a resolvable GITHUB_BASE_REF" >&2 - exit 1 - fi - ;; - push) - BASE="${GITHUB_EVENT_BEFORE:-}" - if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then - MATCH_ALL=1 - fi - ;; - *) - MATCH_ALL=1 - ;; -esac - -to_pathspec() { - local spec="$1" - if [[ "$spec" == *"*"* ]]; then - printf ':(glob)%s' "$spec" - else - printf '%s' "$spec" - fi -} - -filter_changed() { - local name="$1" - shift - local out="${GITHUB_OUTPUT:?GITHUB_OUTPUT is required}" - - if [ "$MATCH_ALL" = "1" ]; then - echo "${name}=true" >> "$out" - return - fi - - local spec pathspec - for spec in "$@"; do - pathspec="$(to_pathspec "$spec")" - if [ -n "$(git diff --name-only "$BASE" "$HEAD" -- "$pathspec")" ]; then - echo "${name}=true" >> "$out" - return - fi - done - - echo "${name}=false" >> "$out" -} - -filter_changed web \ - 'apps/web/**' \ - '.railway/**' \ - 'packages/**' \ - 'package.json' \ - 'bun.lock' \ - 'turbo.json' \ - 'scripts/ci.sh' \ - 'scripts/ci-detect-changes.sh' \ - '.github/workflows/ci.yml' - -filter_changed mcp_gateway \ - 'services/mcp-gateway/**' \ - '.railway/**' \ - 'scripts/ci.sh' \ - 'scripts/ci-detect-changes.sh' \ - '.github/workflows/ci.yml' - -filter_changed packages \ - 'packages/**' \ - 'package.json' \ - 'bun.lock' \ - 'turbo.json' \ - '.github/workflows/ci.yml' - -filter_changed ci \ - 'scripts/**' \ - '.github/workflows/**' \ - 'package.json' \ - 'bun.lock' \ - 'turbo.json' From 1b1907d3e9d658fc6059ef814a555862f0fe3ac2 Mon Sep 17 00:00:00 2001 From: Sam Clemente Date: Sun, 27 Sep 2026 22:34:42 -0500 Subject: [PATCH 3/3] docs: note the expected Railway sleepApplication plan diff Railway omits `sleepApplication` from a service's deploy config once app sleep is off, so `railway config plan` reports `null -> false` for Gateway and Web in both environments on every run. Co-Authored-By: Claude Opus 5 (1M context) --- railway/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/railway/README.md b/railway/README.md index 1ce89aa..3e60e6d 100644 --- a/railway/README.md +++ b/railway/README.md @@ -22,6 +22,10 @@ railway config apply Repeat with `--environment production` after the Development change is verified. +`railway config plan` always lists `sleepApplication: null → false` for Gateway and Web in both +environments. Railway reports the field as unset rather than `false` once serverless is off, so the +declared value never matches and the line is expected noise, not a pending change. + Keep each repository-backed service root directory at `/`. The Gateway Dockerfile is intentionally located at the repository root because Railway builds it from the monorepo root. Set Gateway database fields to the corresponding `${{Postgres.PG*}}` reference variables so runtime traffic