symforge 10.11.1

SymForge — in-memory code intelligence MCP server for Claude Code, Codex, and Gemini CLI
Documentation
name: CI

on:
  push:
    tags-ignore:
      - "v*"
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: "17 4 * * 1"

env:
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
  conventional-commits:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0

      - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: '3.12'

      - name: Validate pull request title
        if: github.event_name == 'pull_request'
        env:
          PR_TITLE: ${{ github.event.pull_request.title }}
        run: python execution/conventional_commits.py check-subject -- "$PR_TITLE"

      - name: Validate pushed commit subjects
        if: github.event_name == 'push'
        run: python execution/conventional_commits.py check-push-range "${{ github.event.before }}" "$GITHUB_SHA"

      - name: Validate manual run HEAD commit subject
        if: github.event_name == 'workflow_dispatch'
        run: python execution/conventional_commits.py check-range "HEAD^!"

  release-version:
    needs: conventional-commits
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0

      - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: '3.12'

      - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: '22'

      - name: Run version sync tests
        env:
          SYMFORGE_REQUIRE_SSHSIG: '1'
        run: python -m unittest discover -s execution -p 'test_*.py'

      - name: Verify every text blob in the index is LF
        shell: bash
        run: |
          set -euo pipefail
          # Six release-gating assertions compare a worktree read against a hash
          # taken over blob bytes. They are latent on these runners because Linux
          # checks out LF regardless, so a CRLF blob entering the index would go
          # unnoticed here and break every Windows checkout. The index census is
          # platform-independent, so it is checkable from ubuntu.
          offenders="$(git ls-files --eol | grep -vE '^i/(lf|-text|none)' || true)"
          if [[ -n "$offenders" ]]; then
            echo "::error::These blobs are not LF in the index:"
            printf '%s\n' "$offenders"
            exit 1
          fi

      - name: Verify Feature 020 V11 refreeze integrity
        run: python execution/refreeze_v11.py verify-internal --target-ref HEAD

      - name: Test and verify Feature 020 V11 lifecycle traceability
        run: |
          node scripts/validate-lifecycle-oracle-traceability.norm.test.cjs
          node scripts/validate-lifecycle-oracle-traceability.test.cjs
          node scripts/validate-lifecycle-oracle-traceability.cjs

      - name: Verify release metadata stays aligned
        run: python execution/version_sync.py check

  rust:
    needs: release-version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Free disk space for Rust builds
        run: bash execution/free_runner_disk.sh

      # rust-toolchain.toml is the single source of truth for the toolchain
      # version; rustup resolves it natively (channel + components).
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup toolchain install


      - name: Check Rust formatting
        run: cargo fmt --check

      - name: Assert single rmcp major (spec 025 FR-A4)
        # Two rmcp majors in one graph produce identically-named, incompatible
        # types. `cargo tree -d` cannot distinguish this (it lists any
        # duplicated crate's subtrees), so parse the metadata instead.
        run: |
          python3 - <<'EOF'
          import json, subprocess, sys
          md = json.loads(subprocess.run(
              ["cargo", "metadata", "--format-version", "1"],
              capture_output=True, text=True, check=True).stdout)
          majors = {}
          for p in md["packages"]:
              if p["name"] in ("rmcp", "rmcp-macros"):
                  majors.setdefault(p["name"], set()).add(p["version"].split(".")[0])
          bad = {k: sorted(v) for k, v in majors.items() if v != {"3"}}
          if bad or len(majors) < 2:
              sys.exit(f"rmcp major-version assertion failed: {majors}")
          print(f"rmcp majors OK: { {k: sorted(v) for k, v in majors.items()} }")
          EOF

      # `cargo check` used to run here as its own full dev-profile pass. Clippy
      # cannot reuse that work (different driver => different fingerprint), and
      # `clippy --all-targets` is a strict superset: the same rustc checks, more
      # lints, and more targets (`cargo check` covers lib+bins only). Keeping
      # both compiled the graph twice to learn the same thing.
      - name: Run clippy
        run: cargo clippy --all-targets -- -D warnings

      # stel_golden_replay needs gitignored phase0 corpora; without this step the
      # integration tests skip vacuously and CI misses regressions operators see
      # after cloning per tests/fixtures/phase0-corpus/README.md.
      - name: Clone phase0 golden-replay corpora
        run: bash execution/clone_phase0_corpora.sh

      - name: Run Rust tests
        run: cargo test --all-targets -- --test-threads=1

      # Slice 0's product is positive controls that MUST fail, so the step above
      # cannot check them: it runs the default suite, where every control is
      # `#[ignore]`d precisely so a deliberate RED does not turn main red. This
      # runs them and preserves the outcome as the contract's bounded CI-SLICE0
      # artifact -- one deterministic JSON record per case, no unbounded logs.
      # It fails when a control STOPS failing, which means either a fix landed
      # without its owning slice removing the attribute, or the control has gone
      # vacuous.
      - name: Preserve Feature 020 Slice 0 expected failures
        run: node scripts/slice0-oracle-artifact.cjs

      - name: Upload Slice 0 oracle contract
        if: ${{ always() }}
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: feature-020-slice-0-oracle-contract
          path: target/ci/lifecycle-v11/slice-0-oracle-contract.json
          if-no-files-found: error

      - name: Build release binary
        run: cargo build --release

      - name: Set up Node for tool-correctness harness
        uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: '22'

      # The harness grep oracle shells out to ripgrep as a completeness
      # tripwire. ubuntu-latest doesn't ship rg, so without this the oracle
      # silently degrades to REVIEW on every case — a disabled tripwire on a
      # non-interactive runner is worthless. Install it so the oracle runs.
      - name: Install ripgrep (harness grep oracle)
        run: sudo apt-get update && sudo apt-get install -y ripgrep

      - name: Verify tool correctness (both fixtures)
        run: |
          node scripts/verify-tools.cjs --bin target/release/symforge
          node scripts/verify-tools.cjs --fixture verify-tools-real --bin target/release/symforge

  embed-build:
    needs: release-version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      # rust-toolchain.toml is the single source of truth for the toolchain
      # version; rustup resolves it natively (channel + components).
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup toolchain install


      # Engine-only build for library embedders (e.g. AAP): no daemon / sidecar /
      # protocol-server / CLI surface. Makes "an embedder can build symforge" a
      # green gate, so a server-only break (e.g. a `#[cfg(unix)]` unsafe block that
      # a Windows-only check cfg's out) can never silently reach embedders.
      - name: Build engine-only embed feature
        run: cargo build --no-default-features --features embed

      - name: Clippy engine-only embed feature
        run: cargo clippy --no-default-features --features embed --lib -- -D warnings

      - name: Run embed-feature lib tests
        run: cargo test --no-default-features --features embed --lib -- --test-threads=1

  embed-musl:
    needs: release-version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      # rust-toolchain.toml is the single source of truth for the toolchain
      # version; rustup resolves it natively. A hardcoded `toolchain:` input
      # here silently loses when rust-toolchain.toml is bumped: cargo follows
      # the toml and auto-installs that toolchain WITHOUT the musl target,
      # which broke this job with E0463 "can't find crate for core" after the
      # 1.95.0 -> 1.96.0 bump.
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup toolchain install && rustup target add x86_64-unknown-linux-musl


      # Cross-compile the engine-only embed build to musl. AAP compiles the
      # SymForge engine inside musl guest-agent VMs, so a musl regression must
      # fail SymForge's own CI here, not downstream in AAP.
      #
      # musl-tools provides musl-gcc; the embed build statically links C deps
      # built by the `cc` crate (19 tree-sitter grammars, rusqlite `bundled`
      # sqlite) and by libgit2-sys (git2 `vendored-libgit2`, built via cmake,
      # which is preinstalled on ubuntu-latest). Both `cc` and cmake-rs honor
      # the target-scoped CC env var, so pointing it at musl-gcc makes every
      # C-compiled crate link cleanly against musl. All currently pinned
      # tree-sitter grammars ship pure-C scanners; if a future grammar bump
      # reintroduces a C++ (.cc) scanner, also set
      # CXX_x86_64_unknown_linux_musl (e.g. to a musl g++), since CC_<target>
      # does not redirect the C++ compiler.
      - name: Install musl C toolchain
        run: sudo apt-get update && sudo apt-get install -y musl-tools

      - name: Build engine-only embed feature for musl
        env:
          CC_x86_64_unknown_linux_musl: musl-gcc
        run: cargo build --no-default-features --features embed --target x86_64-unknown-linux-musl

      - name: Clippy engine-only embed feature for musl
        env:
          CC_x86_64_unknown_linux_musl: musl-gcc
        run: cargo clippy --no-default-features --features embed --target x86_64-unknown-linux-musl --lib -- -D warnings

  darwin-serve-port:
    needs: release-version
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      # rust-toolchain.toml is the single source of truth for the toolchain
      # version; rustup resolves it natively (channel + components).
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup toolchain install

      # `bind_listener` sets SO_REUSEADDR under `#[cfg(unix)]`, and macOS
      # arm64/x64 are published targets — but every other job is ubuntu-latest,
      # so the Darwin half of that gate ships unverified. It matters because
      # `bind_listener` is also the occupancy probe (`probe_free_listener`), so a
      # permitted wildcard-vs-specific overlap would let symforge bind
      # 127.0.0.1:8080 over a live wildcard-bound dev server (or bind, print a
      # healthy attach URL, and accept zero connections) instead of failing
      # loudly per FR-002/003. `tests/serve_port.rs` already encodes that
      # contract — `explicit_wildcard_over_live_specific_still_fails_loudly` is a
      # tautology on Linux and only has teeth here — it just had no Darwin
      # runner. One test binary, not a macOS matrix: this is the narrowest thing
      # that answers the question.

      - name: Run serve port-binding tests on Darwin
        run: cargo test --test serve_port -- --test-threads=1

  performance-smoke:
    needs: release-version
    if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      # rust-toolchain.toml is the single source of truth for the toolchain
      # version; rustup resolves it natively (channel + components).
      - name: Install Rust toolchain (rust-toolchain.toml)
        run: rustup toolchain install

      - name: Run ignored 1000-file load performance smoke
        run: cargo test --release --test live_index_integration test_load_perf_1000_files -- --ignored --test-threads=1

      - name: Run portable coupling calibration smoke
        run: cargo test --release --test coupling_calibration calibrate_current_repo_smoke -- --ignored --test-threads=1 --nocapture

  npm:
    needs: release-version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: 20

      - name: Test npm package
        working-directory: npm
        run: npm test