Repository navigation
The ingest pass and loom code describe skip the description writer on the fake LLM
#17527
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| # release/** too: a supported line's patches get the same checks. | |
| on: | |
| push: | |
| branches: [main, "release/**"] | |
| pull_request: | |
| branches: [main, "release/**"] | |
| workflow_dispatch: | |
| inputs: | |
| expected_sha: | |
| description: Exact generated translation commit to validate | |
| required: true | |
| type: string | |
| # A new push to a pull request cancels its superseded run. Every push (to main | |
| # or a release/X.Y line) runs to completion in its own group, so a failure on | |
| # one merge commit is never hidden by the next one. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| # Every job only reads the repository; none needs a write scope. | |
| permissions: | |
| contents: read | |
| env: | |
| PYTHON_VERSION: "3.12" | |
| NODE_VERSION: "22" | |
| RUST_CODEGEN_VERSION: "1.84.1" | |
| # The Python jobs install the exact versions in uv.lock with this uv. | |
| UV_VERSION: "0.12.19" | |
| jobs: | |
| validate-ref: | |
| name: validate requested commit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - name: Bind a dispatched run to its generated commit | |
| env: | |
| EVENT: ${{ github.event_name }} | |
| REF: ${{ github.ref }} | |
| SHA: ${{ github.sha }} | |
| EXPECTED_SHA: ${{ inputs.expected_sha }} | |
| run: | | |
| if [ "$EVENT" = "workflow_dispatch" ]; then | |
| test "$REF" = "refs/heads/i18n/update" | |
| [[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]] | |
| test "$SHA" = "$EXPECTED_SHA" | |
| fi | |
| clickhouse: | |
| needs: validate-ref | |
| name: the ClickHouse release this run tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| outputs: | |
| image: ${{ steps.resolve.outputs.image }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # `latest` moves; every job of this run takes the release it names now. | |
| # Assigned first: a failed lookup then fails the step instead of writing "image=". | |
| - id: resolve | |
| run: | | |
| image=$(bash dev/clickhouse_release.sh) | |
| echo "image=$image" >> "$GITHUB_OUTPUT" | |
| lint: | |
| needs: validate-ref | |
| name: ruff + mypy-gate | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: ruff | |
| run: ruff check server extractor sdk/python tests scripts .claude | |
| - name: Install Rust formatter for generated contracts | |
| run: | | |
| rustup toolchain install "$RUST_CODEGEN_VERSION" --profile minimal --component rustfmt | |
| rustup override set "$RUST_CODEGEN_VERSION" | |
| - name: generated Rust contracts are current | |
| run: | | |
| python scripts/codegen/sdk_rust_gen.py --check | |
| python scripts/codegen/sdk_rust_gen.py --fixtures --check | |
| - name: ruff format | |
| run: ruff format --check . | |
| # The Python SDK's op table, TypedDicts and per-op client are generated | |
| # from the registry; a server change that alters a wire shape | |
| # must regenerate them in the same PR. | |
| - name: generated loom/ops.py and loom/client.py are current | |
| run: | | |
| python scripts/codegen/sdk_py_gen.py --check | |
| python scripts/codegen/sdk_py_client_gen.py --check | |
| python scripts/codegen/sdk_py_admin_gen.py --check | |
| # The Codex plugin's hook scripts, library and skills are copies of the | |
| # Claude Code plugin's; a change to one must be synced. The check compares | |
| # bytes and the executable bit. | |
| - name: codex plugin copies are current (bytes and executable bit) | |
| run: python scripts/codegen/agent_plugin_sync.py --check | |
| # docs/reference/ (configuration and the generated tables) and | |
| # server/operations/reach_manifest.py are generated too; the unit suite | |
| # checks them, this step fails faster. | |
| - name: docs reference and reach manifest are current | |
| run: | | |
| python scripts/codegen/settings_reference.py --check | |
| python scripts/codegen/settings_schema.py --check | |
| python scripts/codegen/docs_reference.py --check | |
| python scripts/codegen/op_reach_census.py --check | |
| # The SDK ships py.typed: it is type-checked strictly | |
| # on its own, apart from the server's ratchet below. | |
| - name: mypy --strict on the Python SDK | |
| run: mypy --strict sdk/python/loom | |
| # mypy is gated as a RATCHET, not all-or-nothing: the codebase carries | |
| # pre-existing strict-mypy errors frozen as a baseline in | |
| # scripts/gates/mypy_baseline.json. This step fails only on NEW errors past that | |
| # baseline; lower the baseline as the debt is paid down. | |
| - name: mypy-gate | |
| run: python scripts/gates/mypy_gate.py | |
| # Function-length ratchet: ruff PLR0915 against a | |
| # committed per-file baseline that only shrinks — no file may gain an | |
| # oversized function; today's inventory is tolerated until split. | |
| - name: function-length-gate | |
| run: python scripts/gates/function_length_gate.py | |
| # Content-based, not filename-based: .gitignore only stops the next file | |
| # with a name you already thought of. | |
| - name: no committed secrets | |
| run: python scripts/gates/check_no_secrets.py | |
| # The unit suite in parts, each on its own runner (LOOM_TEST_SHARD, whole files: | |
| # tests/_shards.py) and over that runner's cores; unit-coverage combines their | |
| # coverage data and applies the floors. | |
| unit: | |
| name: pytest unit part ${{ matrix.part }} | |
| needs: [validate-ref, clickhouse] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Patch coverage and the unit test instructions also use this part count. | |
| part: [1, 2, 3, 4, 5, 6] | |
| env: | |
| LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }} | |
| # No ClickHouse service: unit tests skip cleanly when env config is absent. | |
| # The clickhouse binary is installed for clickhouse-local / -format checks. | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Node runs the TypeScript SDK's credentials beside the Python SDK's | |
| # (test_sdk_ts_credentials_compat.py). | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: Fetch origin/main for the migration-number check | |
| run: git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main | |
| # The clickhouse binary (as clickhouse-local and clickhouse-format) for the | |
| # unit tests that run production SQL locally, such as the pending-grant | |
| # checks. The run's release, so the parser and engine are the | |
| # integration job's server. | |
| - name: Install the clickhouse binary | |
| run: | | |
| id=$(docker create "$LOOM_CLICKHOUSE_IMAGE") | |
| sudo docker cp -L "$id:/usr/bin/clickhouse" /usr/local/bin/clickhouse | |
| docker rm "$id" >/dev/null | |
| sudo ln -sf clickhouse /usr/local/bin/clickhouse-format | |
| clickhouse local --query "SELECT version()" | |
| # Random order over one worker per core, so a test that depends on another | |
| # fails here; reproduce a failure as tests/README.md describes. | |
| - name: Install the native worker debugger | |
| if: matrix.part == 3 | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install --no-install-recommends -y gdb | |
| - name: Prepare native diagnostic core policy | |
| if: matrix.part == 3 | |
| env: | |
| NATIVE_RUNNER_ENVIRONMENT: ${{ runner.environment }} | |
| NATIVE_JOB_CONTAINER_ID: ${{ job.container.id }} | |
| run: | | |
| test "$NATIVE_RUNNER_ENVIRONMENT" = github-hosted | |
| test "$RUNNER_OS" = Linux | |
| test -z "$NATIVE_JOB_CONTAINER_ID" | |
| sudo sysctl -w kernel.core_pattern=core | |
| test "$(cat /proc/sys/kernel/core_pattern)" = core | |
| - name: Check native worker transport and termination | |
| if: matrix.part == 3 | |
| run: | | |
| ulimit -S -c 0 | |
| python -m tests.unit.test_native_worker --mechanism | |
| - name: pytest unit (this part, random order) | |
| env: | |
| SHARD_PART: ${{ matrix.part }} | |
| LOOM_TEST_SHARD: ${{ matrix.part }}/${{ strategy.job-total }} | |
| COVERAGE_FILE: .coverage.unit-${{ matrix.part }} | |
| run: | | |
| SEED="${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}" | |
| echo "pytest-randomly seed: $SEED" | |
| NATIVE_ARGS=() | |
| if [ "${SHARD_PART}" = 3 ]; then | |
| ulimit -S -c 0 | |
| NATIVE_ARGS=(--native-worker-signatures) | |
| fi | |
| pytest tests/unit -vv -n auto -p randomly -p tests._worker_status --randomly-seed="$SEED" --durations=15 \ | |
| "${NATIVE_ARGS[@]}" \ | |
| --cov=server --cov=sdk/python/loom --cov-branch --cov-report= \ | |
| --junitxml="junit-unit-${SHARD_PART}.xml" | |
| # Also after a failure: the failing part's test times are what a reader needs. | |
| - name: Upload this part's coverage data and test times | |
| if: always() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: coverage-unit-${{ matrix.part }} | |
| path: | | |
| .coverage.unit-${{ matrix.part }} | |
| junit-unit-${{ matrix.part }}.xml | |
| .pytest_cache/worker-status/ | |
| include-hidden-files: true | |
| if-no-files-found: warn | |
| # A re-run of one failed part replaces the data its first attempt uploaded. | |
| overwrite: true | |
| unit-coverage: | |
| name: pytest unit coverage, floors and bench | |
| needs: [validate-ref, unit] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: Download the parts' coverage data and test times | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: coverage-unit-* | |
| merge-multiple: true | |
| # This run's seconds per test file, the weights the next split balances by | |
| # when committed as tests/shard_weights.json (tests/_shards.py). | |
| - name: Shard weights from this run | |
| run: python -m tests._shards junit-unit-*.xml | |
| - name: Upload shard weights | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: shard-weights | |
| path: tests/shard_weights.json | |
| # One data file per part, measured in the same checkout path, so they combine | |
| # into the totals one run over the whole suite measures. | |
| - name: Combine coverage (floor 40%) | |
| run: | | |
| coverage combine .coverage.unit-* | |
| coverage report --fail-under=40 | |
| coverage xml | |
| coverage json -o coverage.json | |
| # Per-module branch floors for the auth, write-path, erasure, migration | |
| # and supervisor modules (tests/inventory/coverage_floors.toml). | |
| - name: branch-coverage floors | |
| run: python -m tests.inventory.coverage_floors coverage.json | |
| # The published benchmark harnesses' scoring and dataset readers. | |
| - name: pytest bench harnesses | |
| run: pytest bench -q -p randomly --randomly-seed="${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}" | |
| # The generic ingest script's dry run goes through this checkout's CLI. | |
| - name: generic integration sample | |
| run: PYTHON=python bash integrations/generic/test.sh | |
| - name: Upload coverage xml | |
| if: always() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: coverage-xml | |
| path: coverage.xml | |
| python-patch-coverage: | |
| name: Python changed-line coverage (report only) | |
| needs: [validate-ref, unit] | |
| if: >- | |
| github.event_name == 'pull_request' && !cancelled() && | |
| needs.validate-ref.result == 'success' && | |
| (needs.unit.result == 'success' || needs.unit.result == 'failure') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Download the parts' coverage data | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| pattern: coverage-unit-* | |
| merge-multiple: true | |
| - name: Combine and export the Python coverage data | |
| run: | | |
| parts=(.coverage.unit-{1..6}) | |
| for part in "${parts[@]}"; do | |
| test -s "$part" | |
| done | |
| coverage_package=$(python3 - <<'PY' | |
| import tomllib | |
| with open("uv.lock", "rb") as lock: | |
| packages = tomllib.load(lock)["package"] | |
| version = next(package["version"] for package in packages if package["name"] == "coverage") | |
| print(f"coverage=={version}") | |
| PY | |
| ) | |
| uvx --python "$PYTHON_VERSION" --from "$coverage_package" coverage combine "${parts[@]}" | |
| # Coverage can skip unreadable data without failing the combine. | |
| for part in "${parts[@]}"; do | |
| test ! -e "$part" | |
| done | |
| uvx --python "$PYTHON_VERSION" --from "$coverage_package" coverage lcov -o "$RUNNER_TEMP/python.lcov" | |
| - name: Report Python changed-line coverage | |
| uses: ClickHouse/loom/.github/actions/patch-coverage@df405e9ed5d032b8248f6cfa8cf87e856685e490 | |
| with: | |
| component: Python server and SDK | |
| report: ${{ runner.temp }}/python.lcov | |
| sandbox: | |
| needs: validate-ref | |
| name: repository-job sandbox (real bubblewrap) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| # The hostile suite skips where bwrap cannot create namespaces; | |
| # LOOM_TEST_REQUIRE_SANDBOX=1 turns that skip into a failure here. | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| # prlimit comes with util-linux. Ubuntu 24.04 restricts unprivileged user | |
| # namespaces through AppArmor; the sandbox needs them. | |
| - name: Install bubblewrap and allow user namespaces | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends bubblewrap util-linux | |
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
| bwrap --unshare-user --ro-bind / / true | |
| - name: pytest hostile sandbox suite | |
| env: | |
| LOOM_TEST_REQUIRE_SANDBOX: "1" | |
| run: pytest tests/unit/test_repo_job_sandbox_hostile.py -q -p randomly --randomly-seed="${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}" | |
| schema-check: | |
| name: schema.sql in sync with migrations | |
| needs: [validate-ref, clickhouse] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }} | |
| LOOM_CH_HOST: localhost | |
| LOOM_CH_PORT: "8123" | |
| LOOM_CH_USER: loom | |
| LOOM_CH_PASSWORD: loomdev | |
| LOOM_CH_DATABASE: loom | |
| LOOM_CH_SECURE: "false" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (no extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: Start ClickHouse (loom config + lemmagen dictionary) | |
| run: bash dev/ci_start_clickhouse.sh | |
| - name: Apply every migration to fresh ClickHouse | |
| run: python -m server.core.schema.migrate | |
| # The ledger reader the deploy preflight relies on: | |
| # after applying everything, ledger ⊆ repo files, no checksum drift, | |
| # nothing pending — or the strict dry-run exits 1. | |
| - name: Ledger is a subset of the repo (strict dry-run) | |
| run: python -m server.core.schema.migrate --dry-run --strict | |
| - name: Verify schemas/schema.sql matches what migrations produce | |
| id: schema_current | |
| run: make schema-check | |
| - name: Export the generated schema after a mismatch | |
| if: failure() && steps.schema_current.outcome == 'failure' | |
| run: python -m scripts.ops.dump_schema --out "$RUNNER_TEMP/schema.sql" | |
| - name: Upload the generated schema after a mismatch | |
| if: failure() && steps.schema_current.outcome == 'failure' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: generated-schema | |
| path: ${{ runner.temp }}/schema.sql | |
| if-no-files-found: error | |
| ts-typecheck: | |
| needs: validate-ref | |
| name: tsc (frontend) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: Install + build frontend (build runs tsc -b internally) | |
| working-directory: frontend | |
| run: | | |
| npm ci --no-audit --no-fund | |
| npm run build | |
| # The index chunk stays under budget and carries | |
| # no surface that opens on a click (a flow dialog, the search body, a view). | |
| - name: bundle budget (index chunk) | |
| working-directory: frontend | |
| run: npm run budget | |
| format: | |
| needs: validate-ref | |
| name: format (biome, prettier, taplo, shfmt) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: install shfmt v3.10.0 | |
| run: | | |
| curl -sSfL -o /usr/local/bin/shfmt https://github.com/mvdan/sh/releases/download/v3.10.0/shfmt_v3.10.0_linux_amd64 | |
| echo "1f57a384d59542f8fac5f503da1f3ea44242f46dff969569e80b524d64b71dbc /usr/local/bin/shfmt" | sha256sum -c - | |
| chmod +x /usr/local/bin/shfmt | |
| - name: biome | |
| run: npx --yes @biomejs/biome@2.5.14 format . | |
| # The dashboard's accessibility rules (biome.json overrides): a new violation fails here. | |
| - name: biome lint (dashboard accessibility) | |
| run: npx --yes @biomejs/biome@2.5.14 lint frontend/src | |
| - name: prettier | |
| run: npx --yes prettier@3.9.9 --check --log-level warn "**/*.{md,yml,yaml}" | |
| - name: taplo | |
| run: npx --yes @taplo/cli@0.7.0 format --check | |
| - name: shfmt | |
| run: git ls-files '*.sh' ':!tests/fixtures' | xargs shfmt -d | |
| helm: | |
| needs: validate-ref | |
| name: helm chart (lint, kubeconform) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: install helm v3.16.2 and kubeconform v0.6.7 | |
| run: | | |
| curl -sSfL -o /tmp/helm.tgz https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz | |
| echo "9318379b847e333460d33d291d4c088156299a26cd93d570a7f5d0c36e50b5bb /tmp/helm.tgz" | sha256sum -c - | |
| tar -xzf /tmp/helm.tgz -C /tmp && sudo install /tmp/linux-amd64/helm /usr/local/bin/helm | |
| curl -sSfL -o /tmp/kubeconform.tgz https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz | |
| echo "95f14e87aa28c09d5941f11bd024c1d02fdc0303ccaa23f61cef67bc92619d73 /tmp/kubeconform.tgz" | sha256sum -c - | |
| tar -xzf /tmp/kubeconform.tgz -C /tmp && sudo install /tmp/kubeconform /usr/local/bin/kubeconform | |
| - name: lint and validate every overlay | |
| run: | | |
| set -euo pipefail | |
| chart=deploy/helm/loom | |
| secret=$(openssl rand -hex 32) | |
| # Every optional object on, so each template renders at least once. | |
| on=(--set analyticsExport.enabled=true --set analyticsExport.bucket=ci --set analyticsExport.nameKeySecret.name=ci) | |
| extractor=(--set extractor.enabled=true --set secrets.extractorToken="$(openssl rand -hex 24)") | |
| assistant=(--set assistant.nativeEnabled=true --set env.LOOM_ASSISTANT_PROVIDER=fake) | |
| # TLS on Loom's port; native tools stay in process. | |
| tls=(--set tls.secretName=ci --set 'ingress.annotations.alb\.ingress\.kubernetes\.io/backend-protocol=HTTPS' --set workers.enabled=true --set networkPolicy.enabled=true "${on[@]}" "${extractor[@]}") | |
| all=(--set workers.enabled=true --set workers.replicaCount=2 --set autoscaling.enabled=true --set networkPolicy.enabled=true --set alerts.prometheusRule.enabled=true --set mustMatchChange.publish=ci --set cellProbe.port=8777 --set settingsFile.memory_ask_recency_weight=0.3 "${on[@]}" "${extractor[@]}" "${assistant[@]}") | |
| # The PrometheusRule's schema: the CRD catalog at a pinned commit. | |
| crd='https://raw.githubusercontent.com/datreeio/CRDs-catalog/c86448cbf1a840ca62d119259864863897c8748a/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' | |
| # The Cloud overlay layers on the EKS one. | |
| for overlays in values-eks.yaml values-kind.yaml "values-eks.yaml values-clickhouse-cloud.yaml"; do | |
| args=(--set secrets.jwtSecret="$secret") | |
| for overlay in $overlays; do args+=(-f "$chart/$overlay"); done | |
| helm lint --strict "$chart" "${args[@]}" | |
| helm lint --strict "$chart" "${args[@]}" "${all[@]}" | |
| helm template loom "$chart" "${args[@]}" | kubeconform -strict -summary -kubernetes-version 1.30.0 | |
| helm template loom "$chart" "${args[@]}" "${all[@]}" | kubeconform -strict -summary -kubernetes-version 1.30.0 -schema-location default -schema-location "$crd" | |
| helm lint --strict "$chart" "${args[@]}" "${tls[@]}" | |
| helm template loom "$chart" "${args[@]}" "${tls[@]}" | kubeconform -strict -summary -kubernetes-version 1.30.0 | |
| done | |
| kubeconform -strict -summary -kubernetes-version 1.30.0 deploy/okf-sync/cronjob.yaml | |
| # Values the chart must refuse, each with its own message. A refused render | |
| # exits non-zero, so the output is taken first and read after. | |
| refused() { | |
| local want=$1; shift | |
| if out=$(helm template loom "$chart" -f "$chart/values-kind.yaml" --set secrets.jwtSecret="$secret" "$@" 2>&1); then | |
| echo "the chart accepted $*"; exit 1 | |
| fi | |
| grep -qF "$want" <<<"$out" || { echo "unexpected refusal for $*: $out"; exit 1; } | |
| echo "refused as expected: $*" | |
| } | |
| # The analytics name key reaches the export pod only, never the web pods. | |
| key="set LOOM_ANALYTICS_EXPORT_NAME_KEY through analyticsExport.nameKeySecret" | |
| refused "$key" --set env.LOOM_ANALYTICS_EXPORT_NAME_KEY=x | |
| refused "$key" --set secrets.extra.LOOM_ANALYTICS_EXPORT_NAME_KEY=x | |
| refused "$key" --set "extraEnv[0].name=LOOM_ANALYTICS_EXPORT_NAME_KEY" | |
| refused "$key" --set settingsFile.analytics_export_name_key=x | |
| refused "needs analyticsExport.bucket" "${on[@]}" --set analyticsExport.bucket= | |
| refused "needs analyticsExport.nameKeySecret.name" "${on[@]}" --set analyticsExport.nameKeySecret.name= | |
| refused "expectedBucketOwner must be a quoted string" "${on[@]}" --set analyticsExport.expectedBucketOwner=123456789012 | |
| refused 'set ingress.annotations."alb.ingress.kubernetes.io/backend-protocol" to HTTPS' -f "$chart/values-eks.yaml" --set tls.secretName=ci | |
| # The release Secret (named after the release here) and envFrom Secrets reach every pod. | |
| shared="is a Secret every web and workers pod loads" | |
| refused "$shared" "${on[@]}" --set analyticsExport.nameKeySecret.name=loom | |
| refused "$shared" "${on[@]}" --set "envFrom[0].secretRef.name=ci" | |
| # The extractor's token is the release Secret's, 16 characters or more. | |
| refused "extractor.enabled needs secrets.extractorToken" --set extractor.enabled=true | |
| refused "secrets.extractorToken must be at least 16 characters" --set extractor.enabled=true --set secrets.extractorToken=short | |
| refused "through secrets.extractorToken, not secrets.extra" "${extractor[@]}" --set secrets.extra.LOOM_DOCUMENT_EXTRACTOR_TOKEN=x | |
| refused "extractor.env cannot set LOOM_EXTRACTOR_TOKEN" "${extractor[@]}" --set extractor.env.LOOM_EXTRACTOR_TOKEN=x | |
| token="set it through secrets.extractorToken" | |
| refused "$token" "${extractor[@]}" --set env.LOOM_DOCUMENT_EXTRACTOR_TOKEN=x | |
| refused "$token" "${extractor[@]}" --set "extraEnv[0].name=LOOM_DOCUMENT_EXTRACTOR_TOKEN" | |
| refused "$token" "${extractor[@]}" --set settingsFile.document_extractor_token=x | |
| # guardMetadata is a bool and egressExcept a list; anything else is refused by name. | |
| refused "networkPolicy.guardMetadata must be true or false" --set-string networkPolicy.guardMetadata=false | |
| refused "networkPolicy.guardMetadata must be true or false" --set networkPolicy.guardMetadata=0 | |
| refused "networkPolicy.guardMetadata must be true or false" --set networkPolicy.enabled=true --set-string networkPolicy.guardMetadata=true | |
| refused "networkPolicy.egressExcept must be a list of CIDRs" --set networkPolicy.egressExcept=169.254.169.254/32 | |
| refused "networkPolicy.egressExcept must be a list of CIDRs" --set networkPolicy.egressExcept= | |
| refused "networkPolicy.egressExcept must be a list of CIDRs" --set networkPolicy.egressExcept=0 | |
| - name: install PyYAML for the render gates | |
| run: | | |
| python3 -m pip install --quiet --user --require-hashes --only-binary=:all: -r scripts/gates/requirements.txt | |
| # What the extractor's pods can be reached by and reach, read off the render. | |
| - name: extractor isolation | |
| run: python3 scripts/gates/helm_extractor_isolation.py | |
| # No Loom pod reaches the instance metadata service, with the policy on or off. | |
| - name: metadata egress | |
| run: python3 scripts/gates/helm_metadata_egress.py | |
| # Native assistant enablement adds no workload, store or network access. | |
| - name: assistant isolation | |
| run: python3 scripts/gates/helm_assistant_isolation.py | |
| # The Postgres authority's DSN, password, CA mount and egress, and its refusals. | |
| - name: postgres | |
| run: python3 -m scripts.gates.helm_postgres | |
| # TLS on Loom's port: the Secret's mount, the settings, HTTPS probes, and the refusals. | |
| - name: tls | |
| run: python3 -m scripts.gates.helm_tls | |
| - name: private cell probe | |
| run: python3 -m scripts.gates.helm_cell_probe | |
| agent-plugins: | |
| needs: validate-ref | |
| name: coding-agent plugins (node --test) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| # The hook scripts have no dependencies and run under any Node >= 18; | |
| # their tests are node:test files beside them. | |
| - name: node --test (hook scripts shared by the Claude Code and Codex plugins) | |
| run: node --test integrations/claude-code-plugin/tests/*.test.mjs | |
| - name: node --test (grep shim) | |
| run: node --test integrations/grep-shim/tests/*.test.mjs | |
| - name: Cursor hook sample | |
| run: bash integrations/cursor/test.sh | |
| - name: node --test (Cline hooks) | |
| run: node --test integrations/cline/tests/*.test.mjs | |
| - name: every hook, helper, shim and adapter script parses | |
| run: for f in integrations/{claude-code-plugin,codex-plugin}/{hooks,lib,bin}/*.mjs integrations/cline/*.mjs integrations/grep-shim/bin/* integrations/grep-shim/lib/*.mjs; do node --check "$f"; done | |
| - name: the Node launcher and the Cline hooks parse | |
| run: for f in integrations/{claude-code-plugin,codex-plugin}/bin/loom-node integrations/cline/hooks/*; do sh -n "$f"; done | |
| # The shim is installed by putting grep-shim/bin on PATH, and Cline runs | |
| # the copied hook files directly, so each must be an executable file. | |
| # The plugins' executable bits are compared source-to-copy by the plugin | |
| # sync check in the lint job. | |
| - name: grep shim and Cline hook entry points are executable | |
| run: for f in integrations/grep-shim/bin/* integrations/cline/hooks/*; do test -x "$f" || { echo "::error file=$f::not executable"; exit 1; }; done | |
| # The dashboard's vitest and Playwright suites share nothing but `npm ci`, so | |
| # each runs as its own job, split into parts on separate runners. | |
| frontend-vitest: | |
| needs: validate-ref | |
| name: frontend vitest part ${{ matrix.part }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| part: [1, 2] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: npm ci | |
| working-directory: frontend | |
| run: npm ci --no-audit --no-fund | |
| # Unit tests on the landing rule, formatters, navigation and hooks; | |
| # component tests; axe-core over the components that render in | |
| # isolation. jsdom, no browser. | |
| - name: vitest (unit + component + axe) | |
| working-directory: frontend | |
| env: | |
| SHARD: ${{ matrix.part }}/${{ strategy.job-total }} | |
| run: npm run test -- --shard="$SHARD" | |
| frontend-coverage: | |
| needs: validate-ref | |
| if: github.event_name == 'pull_request' | |
| name: Dashboard changed-line coverage (report only) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| continue-on-error: true | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: npm ci | |
| run: npm ci --no-audit --no-fund | |
| - name: Collect dashboard unit coverage | |
| run: npm run test -- --coverage --testTimeout=10000 | |
| - name: Report dashboard changed-line coverage | |
| uses: ClickHouse/loom/.github/actions/patch-coverage@df405e9ed5d032b8248f6cfa8cf87e856685e490 | |
| with: | |
| component: Dashboard | |
| working-directory: frontend | |
| report: frontend/coverage/lcov.info | |
| # With fullyParallel: false, --shard splits by spec file per project, not by test. | |
| frontend-e2e: | |
| needs: validate-ref | |
| name: frontend playwright part ${{ matrix.part }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| part: [1, 2, 3] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: npm ci | |
| working-directory: frontend | |
| run: npm ci --no-audit --no-fund | |
| - name: Install Chromium for Playwright | |
| working-directory: frontend | |
| run: npx playwright install --with-deps chromium | |
| # The e2e specs in frontend/e2e/ against the production build, every /v1/* | |
| # call answered from fixtures. | |
| - name: playwright (e2e specs) | |
| working-directory: frontend | |
| env: | |
| SHARD: ${{ matrix.part }}/${{ strategy.job-total }} | |
| run: npm run e2e -- --shard="$SHARD" | |
| - name: Upload screenshots and traces | |
| if: always() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: frontend-e2e-${{ matrix.part }} | |
| path: | | |
| frontend/e2e-screenshots | |
| frontend/test-results | |
| if-no-files-found: ignore | |
| # Each part is its own runner and ClickHouse. The numbered parts each run their | |
| # share of tests/integration (LOOM_TEST_SHARD, whole files: tests/_shards.py) | |
| # against an auth-off server; the isolation gates part runs the provider staging | |
| # tests, the tenant-isolation gates against an auth-on server, and the | |
| # analyzer corpus. | |
| integration: | |
| name: pytest integration ${{ matrix.part == 'isolation' && 'isolation gates' || format('part {0} of 4', matrix.part) }} | |
| needs: [validate-ref, clickhouse] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # The part count, 4, is also in this job's name, its LOOM_TEST_SHARD, the docs | |
| # bullet on parts (docs/development/testing.md) and the loom-investigate-ci row. | |
| part: ["1", "2", "3", "4", isolation] | |
| env: | |
| LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }} | |
| LOOM_CH_HOST: localhost | |
| LOOM_CH_PORT: "8123" | |
| LOOM_CH_USER: loom | |
| LOOM_CH_READER_USER: loom_reader | |
| LOOM_CH_PASSWORD: loomdev | |
| LOOM_CH_DATABASE: loom | |
| LOOM_CH_SECURE: "false" | |
| LOOM_AUTH_REQUIRED: "false" | |
| LOOM_JWT_SECRET: ci-only-jwt-secret | |
| # Overrides reach every web process within one refresh; the tests wait it out. | |
| LOOM_RUNTIME_OVERRIDES_REFRESH_SECONDS: "1" | |
| # Extraction policies and the model-call switch likewise; the tests wait it out. | |
| LOOM_MODEL_CALLS_POLICY_REFRESH_SECONDS: "2" | |
| LOOM_BASE_URL: http://localhost:7777 | |
| LOOM_EMBEDDING_MODEL: fake-ngram-1024 | |
| LOOM_LLM_PROVIDER: fake | |
| # GH Actions runners are noisy enough that the default per-op | |
| # budgets (e.g. memory.set p99=30ms) fire violations on most | |
| # runs. Multiply by 10x — same knob docs/operations/deployment.md recommends | |
| # for CH Cloud over WAN. Per-op overrides at runtime go through | |
| # POST /v1/admin/budget.set, not env vars. | |
| LOOM_LATENCY_BUDGET_MULTIPLIER: "10" | |
| # Memory webhook tests POST to a receiver on 127.0.0.1 over http, and wait one | |
| # registry refresh after registering. | |
| LOOM_MEMORY_WEBHOOK_ALLOW_HTTP: "true" | |
| LOOM_MEMORY_WEBHOOK_PRIVATE_HOSTS: "127.0.0.1" | |
| LOOM_MEMORY_WEBHOOK_REFRESH_SECONDS: "1" | |
| # A pure web replica: tests that exercise a worker call its `run_pass` | |
| # in-process against their own namespace. A live supervisor's workers | |
| # have no namespace filter and would drain those tests' rows. | |
| LOOM_BACKGROUND_WORKERS: "off" | |
| # A process outside the compose deployment must say who | |
| # launched it, or it refuses to boot. | |
| LOOM_INSTANCE_LABEL: "ci:integration" | |
| # The deployment's default code namespace, which bare code.* calls resolve to. | |
| LOOM_CODE_ORG: ci | |
| LOOM_CODE_NAMESPACE: code-ci | |
| LOOM_CODE_REPO: example/ci | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: Start ClickHouse (loom config + lemmagen dictionary) | |
| run: bash dev/ci_start_clickhouse.sh | |
| - name: Apply migrations | |
| id: migrate | |
| run: python -m server.core.schema.migrate | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| if: matrix.part == '1' | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: Install native framework clients | |
| if: matrix.part == '1' | |
| run: | | |
| uv pip install --python "$PWD/.venv/bin/python" --target "$RUNNER_TEMP/loom-adk-client" './sdk/python[google-adk]' | |
| npm --prefix sdk/typescript ci --no-audit --no-fund | |
| # Provider staging tests create private, UUID-owned copies and run before | |
| # the web process starts, against this job's disposable migrated database. | |
| - name: Provider rebuild storage and recovery | |
| if: matrix.part == 'isolation' | |
| env: | |
| LOOM_PROVIDER_STAGING_LIVE_TEST: "1" | |
| run: >- | |
| pytest -q | |
| tests/integration/test_provider_cache_live_ch.py | |
| tests/integration/test_provider_coordination_live_ch.py | |
| tests/integration/test_provider_cleanup_live_ch.py | |
| tests/integration/test_provider_inventory_live_ch.py | |
| tests/integration/test_provider_large_page_live_ch.py | |
| tests/integration/test_provider_prefix_live_ch.py | |
| tests/integration/test_provider_prepared_live_ch.py | |
| tests/integration/test_provider_publish_live_ch.py | |
| tests/integration/test_provider_source_policy_live_ch.py | |
| tests/integration/test_provider_staging_live_ch.py | |
| tests/integration/test_provider_views_live_ch.py | |
| # The service in front of Loom that signs a token per end user: the part's | |
| # server trusts its fresh key (LOOM_JWT_END_USER_ISSUERS_JSON) and the | |
| # tests sign with it (LOOM_TEST_END_USER_KEY). | |
| - name: Test end-user issuer | |
| id: issuer | |
| if: steps.migrate.outcome == 'success' && !cancelled() | |
| run: python -m tests.end_user_issuer "$RUNNER_TEMP" >> "$GITHUB_ENV" | |
| # The reference extractor, before the part's server boots so it reads its URL and token: | |
| # the ingestion tests' jobs call it and knowledge.inspect reports it as configured. | |
| - name: Start the reference extractor | |
| id: extractor | |
| if: steps.migrate.outcome == 'success' && !cancelled() | |
| run: | | |
| token="$(openssl rand -hex 24)" | |
| echo "::add-mask::$token" | |
| (cd extractor && LOOM_EXTRACTOR_TOKEN="$token" LOOM_EXTRACTOR_PORT=8790 \ | |
| nohup python -m loom_extractor > "$GITHUB_WORKSPACE/extractor.log" 2>&1 &) | |
| for _ in $(seq 1 30); do | |
| curl -fsS http://127.0.0.1:8790/healthz >/dev/null && break | |
| sleep 1 | |
| done | |
| curl -fsS http://127.0.0.1:8790/healthz >/dev/null || { tail -50 extractor.log; exit 1; } | |
| echo "LOOM_DOCUMENT_EXTRACTOR_URL=http://127.0.0.1:8790" >> "$GITHUB_ENV" | |
| echo "LOOM_DOCUMENT_EXTRACTOR_TOKEN=$token" >> "$GITHUB_ENV" | |
| # The image's launcher with several web processes, so state that must | |
| # bind every process (rate limits, budgets, schema caches) is tested. | |
| - name: Boot control plane | |
| if: matrix.part != 'isolation' | |
| run: | | |
| LOOM_WEB_WORKERS=3 nohup sh scripts/serve.sh > server.log 2>&1 & | |
| for _ in $(seq 1 60); do | |
| curl -fsS http://localhost:7777/v1/health && exit 0 | |
| sleep 1 | |
| done | |
| echo "control plane never became healthy" | |
| tail -100 server.log | |
| exit 1 | |
| - name: Mastra native memory against the control plane | |
| if: matrix.part == '1' | |
| run: | | |
| token="$(python -c 'from server.auth import keyring; keyring.sign_with_root_only(); from server.auth.jwt import mint_token; print(mint_token(subject="ci-mastra-memory", org="mastra-memory-ci", namespaces=["native"], roles=["writer"], ttl_seconds=600, is_service_account=True))')" | |
| echo "::add-mask::$token" | |
| LOOM_API_KEY="$token" LOOM_ORG=mastra-memory-ci LOOM_NAMESPACE=native make test-sdk-mastra-memory-live | |
| # A local S3-compatible store for the document object-store tests | |
| # (tests/integration/test_document_object_store_live.py). | |
| - name: Start a local S3-compatible store | |
| if: matrix.part != 'isolation' | |
| run: | | |
| docker run -d --name loom-ci-s3 -p 127.0.0.1:5000:5000 \ | |
| motoserver/moto@sha256:32d7805d8bd4c81db789c4fff2c36f96a8837cbd8e7a3853116b6516b9490dde | |
| for _ in $(seq 1 30); do | |
| curl -sf http://127.0.0.1:5000/ >/dev/null && break | |
| sleep 1 | |
| done | |
| curl -sf http://127.0.0.1:5000/ >/dev/null | |
| echo "LOOM_TEST_S3_ENDPOINT=http://127.0.0.1:5000" >> "$GITHUB_ENV" | |
| # Split ordinary integration cases over the parts. Signed mirror HTTP cases | |
| # run in the authenticated isolation step below on every pull request. | |
| - name: pytest (this part of tests/integration) | |
| if: matrix.part != 'isolation' | |
| env: | |
| LOOM_TEST_SHARD: ${{ matrix.part }}/4 | |
| run: >- | |
| pytest tests/integration -q --durations=20 | |
| --ignore=tests/integration/test_mirror_checked_search_http.py | |
| --ignore=tests/integration/test_mirror_checked_list_http.py | |
| - name: Native Google ADK live tests (Python and TypeScript) | |
| if: matrix.part == '1' | |
| run: python -m tests.integration._google_adk_ci "$RUNNER_TEMP/loom-adk-client" | |
| # The tenant-isolation gates against a server that enforces auth. The numbered | |
| # parts run them with auth off, where every token is ignored and no refusal is seen. | |
| # The three checks of the isolation gates part are independent: a failure in | |
| # one does not skip the next (`!cancelled()`). | |
| - name: Boot control plane with auth on | |
| id: auth_on | |
| if: >- | |
| matrix.part == 'isolation' && !cancelled() && steps.issuer.outcome == 'success' | |
| && steps.extractor.outcome == 'success' | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_INSTANCE_LABEL: "ci:integration-auth" | |
| # The analysis probe cases wait on it; the test step reads the same value. | |
| LOOM_CH_ANALYSIS_PROBE_INTERVAL_S: "10" | |
| # Several web processes, as the image runs: a session's MCP calls and its | |
| # DELETE land on different ones. | |
| run: | | |
| LOOM_WEB_WORKERS=3 PORT=7778 nohup sh scripts/serve.sh > server-auth.log 2>&1 & | |
| for _ in $(seq 1 60); do | |
| curl -fsS http://localhost:7778/v1/health && exit 0 | |
| sleep 1 | |
| done | |
| echo "auth-on control plane never became healthy" | |
| tail -100 server-auth.log | |
| exit 1 | |
| - name: Install the native Pipecat client in a private target | |
| id: pipecat_client | |
| if: matrix.part == 'isolation' && !cancelled() && steps.auth_on.outcome == 'success' | |
| run: >- | |
| uv pip install --python "$PWD/.venv/bin/python" | |
| --target "$RUNNER_TEMP/loom-pipecat-native" './sdk/python[pipecat]' | |
| - name: Native Pipecat text example (auth on) | |
| id: pipecat_demo | |
| if: >- | |
| matrix.part == 'isolation' && !cancelled() | |
| && steps.pipecat_client.outcome == 'success' | |
| timeout-minutes: 5 | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_BASE_URL: http://localhost:7778 | |
| PYTHONPATH: ${{ runner.temp }}/loom-pipecat-native | |
| LOOM_PIPECAT_EVIDENCE: ${{ runner.temp }}/pipecat-native-demo.json | |
| run: pytest -q tests/integration/_pipecat_demo_ci.py | |
| - name: Upload native Pipecat qualification receipt | |
| if: >- | |
| always() && matrix.part == 'isolation' | |
| && steps.pipecat_demo.outcome != 'skipped' | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: pipecat-native-demo | |
| path: ${{ runner.temp }}/pipecat-native-demo.json | |
| if-no-files-found: error | |
| - name: Install Rust for live SDK contracts | |
| if: matrix.part == 'isolation' && !cancelled() && steps.auth_on.outcome == 'success' | |
| run: rustup toolchain install stable --profile minimal | |
| - name: Rust SDK live contracts (auth on) | |
| if: matrix.part == 'isolation' && !cancelled() && steps.auth_on.outcome == 'success' | |
| timeout-minutes: 6 | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_BASE_URL: http://localhost:7778 | |
| RUSTUP_TOOLCHAIN: stable | |
| run: pytest -q tests/integration/_rust_sdk_ci.py | |
| - name: pytest isolation gates (auth on) | |
| if: matrix.part == 'isolation' && !cancelled() && steps.auth_on.outcome == 'success' | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_BASE_URL: http://localhost:7778 | |
| LOOM_CH_ANALYSIS_PROBE_INTERVAL_S: "10" | |
| run: >- | |
| pytest -q | |
| tests/integration/test_cross_principal_leakage.py | |
| tests/integration/test_analysis_isolation.py | |
| tests/integration/test_read_scope_isolation.py | |
| tests/integration/test_extraction_status_mine.py | |
| tests/integration/test_token_mint.py | |
| tests/integration/_sdk_handoff_ci.py | |
| tests/integration/test_onboard_tenant.py | |
| tests/integration/test_session_briefs.py | |
| tests/integration/test_blacklist.py | |
| tests/integration/test_sensitivity_high_canary.py | |
| tests/integration/test_run_begin_claims.py | |
| tests/integration/test_mcp_session_run_scope.py | |
| tests/integration/test_projection_failures_restricted.py | |
| tests/integration/test_mirror_checked_search_http.py | |
| tests/integration/test_mirror_checked_list_http.py | |
| # The statement corpus: every builder's shapes through | |
| # EXPLAIN QUERY TREE on the migrated service, and shapes.txt in step | |
| # with the builders. ~10 s; a rejection here is a statement that would | |
| # fail on a deployed server. | |
| - name: analyzer statement corpus | |
| if: matrix.part == 'isolation' && steps.migrate.outcome == 'success' && !cancelled() | |
| run: pytest tests/analyzer -q | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: server-log-${{ matrix.part }} | |
| path: | | |
| server.log | |
| server-auth.log | |
| extractor.log | |
| integration-postgres: | |
| name: pytest integration (Postgres ${{ matrix.postgres }}, ${{ matrix.profile }}) | |
| needs: [validate-ref, clickhouse] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| # The oldest supported major and the newest. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| postgres: ["16", "18"] | |
| profile: [storage, isolation] | |
| env: | |
| LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }} | |
| LOOM_CH_HOST: localhost | |
| LOOM_CH_PORT: "8123" | |
| LOOM_CH_USER: loom | |
| LOOM_CH_READER_USER: loom_reader | |
| LOOM_CH_PASSWORD: loomdev | |
| LOOM_CH_DATABASE: loom | |
| LOOM_CH_SECURE: "false" | |
| LOOM_AUTH_REQUIRED: "false" | |
| LOOM_JWT_SECRET: ci-only-jwt-secret | |
| LOOM_RUNTIME_OVERRIDES_REFRESH_SECONDS: "1" | |
| LOOM_BASE_URL: http://localhost:7777 | |
| LOOM_EMBEDDING_MODEL: fake-ngram-1024 | |
| LOOM_LLM_PROVIDER: fake | |
| LOOM_LATENCY_BUDGET_MULTIPLIER: "10" | |
| LOOM_BACKGROUND_WORKERS: "off" | |
| LOOM_INSTANCE_LABEL: "ci:integration-postgres" | |
| # The deployment's default code namespace, which the leakage gates' code-scope | |
| # cases resolve bare code.* calls to. | |
| LOOM_CODE_ORG: ci | |
| LOOM_CODE_NAMESPACE: code-ci | |
| LOOM_CODE_REPO: example/ci | |
| # The end-user policy cases wait out a refresh: 2 s, as the integration parts use. | |
| LOOM_MODEL_CALLS_POLICY_REFRESH_SECONDS: "2" | |
| # Stock Postgres with one synchronous standby (dev/ci_start_postgres.sh). | |
| LOOM_STORAGE_AUTHORITY: postgres | |
| LOOM_PG_DSN: postgres://loom:loomdev@localhost:5432/loom | |
| # The cells router's directory: a database of its own on the same server. | |
| LOOM_ROUTER_PG_DSN: postgres://loom:loomdev@localhost:5432/loom_router | |
| # An org's own Postgres with pg_clickhouse, reading the SQL surface | |
| # (dev/ci_start_pg_clickhouse.sh); the image tag pins the extension release. | |
| LOOM_PGCH_DSN: postgres://app:appdev@127.0.0.1:5433/app | |
| LOOM_PGCH_VERSION: "0.11.0" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (dev, code extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| - name: Start ClickHouse (loom config + lemmagen dictionary) | |
| run: bash dev/ci_start_clickhouse.sh | |
| - name: Start Postgres with a synchronous standby | |
| env: | |
| LOOM_PG_IMAGE: postgres:${{ matrix.postgres }} | |
| run: bash dev/ci_start_postgres.sh | |
| - name: Create the router directory's database | |
| run: docker exec loom-pg psql -U loom -d loom -qc "CREATE DATABASE loom_router" | |
| - name: Start Postgres with pg_clickhouse | |
| env: | |
| LOOM_PGCH_POSTGRES: ${{ matrix.postgres }} | |
| run: bash dev/ci_start_pg_clickhouse.sh | |
| - name: Apply migrations | |
| run: python -m server.core.schema.migrate | |
| # The service in front of Loom that signs a token per end user, so the isolation | |
| # gates' end-user cases run against the Postgres read paths too. | |
| - name: Test end-user issuer | |
| id: issuer | |
| run: python -m tests.end_user_issuer "$RUNNER_TEMP" >> "$GITHUB_ENV" | |
| - name: Boot control plane | |
| run: | | |
| LOOM_WEB_WORKERS=3 nohup sh scripts/serve.sh > server.log 2>&1 & | |
| for _ in $(seq 1 60); do | |
| curl -fsS http://localhost:7777/v1/health && exit 0 | |
| sleep 1 | |
| done | |
| echo "control plane never became healthy" | |
| tail -100 server.log | |
| exit 1 | |
| - name: pytest (Postgres authority, memory, knowledge, isolation and the SQL surface) | |
| if: ${{ matrix.profile == 'storage' }} | |
| run: >- | |
| pytest -q | |
| tests/integration/test_pg_authority.py | |
| tests/integration/test_pg_durable_publish.py | |
| tests/integration/test_pg_pipeline_metrics.py | |
| tests/integration/test_knowledge_pg_heads.py | |
| tests/integration/test_knowledge.py | |
| tests/integration/test_knowledge_upsert.py | |
| tests/integration/test_knowledge_delete.py | |
| tests/integration/test_knowledge_bulk.py | |
| tests/integration/test_knowledge_bulk_delete.py | |
| tests/integration/test_knowledge_get.py | |
| tests/integration/test_knowledge_ingest_queue.py | |
| tests/integration/test_knowledge_sharing.py | |
| tests/integration/test_knowledge_restore.py | |
| tests/integration/test_restored_memory_ids.py | |
| tests/integration/test_memory_import.py | |
| tests/integration/test_cross_principal_leakage.py | |
| tests/integration/test_memory_get.py | |
| tests/integration/test_served_reads.py | |
| tests/integration/test_memory_by_id.py | |
| tests/integration/test_memory_bulk.py | |
| tests/integration/test_memory_pin.py | |
| tests/integration/test_memory_lock.py | |
| tests/integration/test_memory_precondition.py | |
| tests/integration/test_memory_delete_list.py | |
| tests/integration/test_memory_conflicts.py | |
| tests/integration/test_memory_touch.py | |
| tests/integration/test_memory_history_redact.py | |
| tests/integration/test_memory_expiry.py | |
| tests/integration/test_memory_promote.py | |
| tests/integration/test_memory_search.py | |
| tests/integration/test_memory_apply.py | |
| tests/integration/test_memory_valid_at.py | |
| tests/integration/test_memory_verify.py | |
| tests/integration/test_bulk_conflicts.py | |
| tests/integration/test_blacklist.py | |
| tests/integration/test_idempotency.py | |
| tests/integration/test_erasure.py | |
| tests/integration/test_sql_surface_live_ch.py | |
| tests/integration/test_pg_clickhouse_live_ch.py | |
| tests/integration/test_cell_tenancy_pg.py | |
| tests/integration/test_router_directory_pg.py | |
| tests/integration/test_pg_online_index.py | |
| tests/integration/test_pg_owned_cleanup.py | |
| tests/integration/test_cell_unset_gate_pg.py | |
| tests/integration/test_cell_prepare.py | |
| tests/integration/test_cell_attach.py | |
| tests/integration/test_cell_place.py | |
| tests/integration/test_cell_update_directory.py | |
| tests/integration/test_cell_update_addresses.py | |
| tests/integration/test_cell_update_run_pg.py | |
| tests/integration/test_cell_update_participants_ch.py | |
| tests/integration/test_cell_place_cleanup.py | |
| tests/integration/test_cell_attach_two_replicas.py | |
| tests/integration/test_cell_attach_cleanup.py | |
| tests/integration/test_cell_scim_census_live_ch.py | |
| tests/integration/test_cell_update_scim_live_ch.py | |
| tests/integration/test_cell_control_cleanup.py | |
| tests/integration/test_cell_control_fence.py | |
| tests/integration/test_directory_control_cleanup.py | |
| tests/integration/test_cell_org_triggers_pg.py | |
| tests/integration/test_source_access_store.py | |
| tests/integration/test_source_document_store.py | |
| tests/integration/test_mirror_reader_evidence.py | |
| tests/integration/test_mirror_session_latch_native.py | |
| tests/integration/test_mirror_search_chunk_keys.py | |
| tests/integration/test_mirror_title_projection.py | |
| tests/integration/test_mirror_ask_http.py | |
| tests/integration/test_marked_admin_events_native.py | |
| tests/integration/test_marked_analytics_export_native.py | |
| tests/integration/test_marked_cost_summary_native.py | |
| tests/integration/test_marked_derived_activity_native.py | |
| tests/integration/test_marked_event_readers_native.py | |
| tests/integration/test_marked_mentor_agents_native.py | |
| tests/integration/test_marked_rollup_migration_native.py | |
| tests/integration/test_marked_durable_folds_native.py | |
| tests/integration/test_marked_sql_surface_native.py | |
| - name: pytest online-index durability on a private physical standby | |
| if: ${{ matrix.profile == 'storage' }} | |
| timeout-minutes: 8 | |
| env: | |
| LOOM_PG_IMAGE: postgres:${{ matrix.postgres }} | |
| LOOM_PG_CONTAINER: loom-scale-index-drill-pg | |
| LOOM_PG_HOST_PORT: "15432" | |
| LOOM_PG_INDEX_DRILL: "1" | |
| LOOM_PG_INDEX_DRILL_DSN: postgres://loom:loomdev@localhost:15432/loom | |
| run: | | |
| set -euo pipefail | |
| for name in loom-scale-index-drill-pg loom-scale-index-drill-pg-standby; do | |
| if docker container inspect "$name" >/dev/null 2>&1; then | |
| echo "drill container already exists: $name" >&2 | |
| exit 1 | |
| fi | |
| done | |
| if docker network inspect loom-scale-index-drill-pg-net >/dev/null 2>&1; then | |
| echo "drill network already exists" >&2 | |
| exit 1 | |
| fi | |
| cleanup() { | |
| docker rm -f -v loom-scale-index-drill-pg loom-scale-index-drill-pg-standby || true | |
| docker network rm loom-scale-index-drill-pg-net || true | |
| } | |
| trap cleanup EXIT | |
| bash dev/ci_start_postgres.sh | |
| docker update --memory 1g --memory-swap 1g loom-scale-index-drill-pg loom-scale-index-drill-pg-standby | |
| pytest -q tests/integration/test_pg_online_index_durability.py | |
| - name: pytest placement durability on a private physical standby | |
| if: ${{ matrix.profile == 'storage' }} | |
| timeout-minutes: 8 | |
| env: | |
| LOOM_PG_IMAGE: postgres:${{ matrix.postgres }} | |
| LOOM_PG_CONTAINER: loom-scale-place-drill-pg | |
| LOOM_PG_HOST_PORT: "0" | |
| LOOM_CELL_PLACE_DRILL: "1" | |
| run: | | |
| set -euo pipefail | |
| for name in loom-scale-place-drill-pg loom-scale-place-drill-pg-standby; do | |
| if docker container inspect "$name" >/dev/null 2>&1; then | |
| echo "drill container already exists: $name" >&2 | |
| exit 1 | |
| fi | |
| done | |
| if docker network inspect loom-scale-place-drill-pg-net >/dev/null 2>&1; then | |
| echo "drill network already exists" >&2 | |
| exit 1 | |
| fi | |
| cleanup() { | |
| docker rm -f -v loom-scale-place-drill-pg loom-scale-place-drill-pg-standby || true | |
| docker network rm loom-scale-place-drill-pg-net || true | |
| } | |
| trap cleanup EXIT | |
| bash dev/ci_start_postgres.sh | |
| # Docker reserves the host port; use only this primary's loopback mapping. | |
| mapping=$(docker port "$LOOM_PG_CONTAINER" 5432/tcp) | |
| if [[ ! "$mapping" =~ ^127\.0\.0\.1:([1-9][0-9]{0,4})$ ]]; then | |
| echo "invalid placement drill loopback mapping" >&2 | |
| exit 1 | |
| fi | |
| port=${BASH_REMATCH[1]} | |
| if (( port > 65535 )); then | |
| echo "invalid placement drill loopback mapping" >&2 | |
| exit 1 | |
| fi | |
| export LOOM_CELL_PLACE_DRILL_DSN="postgres://loom:loomdev@127.0.0.1:$port/loom" | |
| docker update --memory 1g --memory-swap 1g loom-scale-place-drill-pg loom-scale-place-drill-pg-standby | |
| pytest -q tests/integration/test_cell_place_durability.py | |
| # The tenant-isolation profile uses a second server that enforces auth: | |
| # the Postgres read paths (heads by key and by id, narrowed scopes) see real tokens. | |
| # Its matrix job runs independently of the storage profile's outcome. | |
| - name: Boot control plane with auth on | |
| id: auth_on | |
| if: ${{ !cancelled() && matrix.profile == 'isolation' && steps.issuer.outcome == 'success' }} | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_INSTANCE_LABEL: "ci:integration-postgres-auth" | |
| LOOM_CH_ANALYSIS_PROBE_INTERVAL_S: "10" | |
| run: | | |
| LOOM_WEB_WORKERS=3 PORT=7778 nohup sh scripts/serve.sh > server-auth.log 2>&1 & | |
| for _ in $(seq 1 60); do | |
| curl -fsS http://localhost:7778/v1/health && exit 0 | |
| sleep 1 | |
| done | |
| echo "auth-on control plane never became healthy" | |
| tail -100 server-auth.log | |
| exit 1 | |
| # The isolation files that write or read memory. Two read-scope tests seed | |
| # superseded and duplicate rows by writing ClickHouse directly, rows the Postgres | |
| # authority never held, and the isolation part's other files (run claims, the | |
| # extraction queue, projection failures) hold no Postgres row: they run on the | |
| # ClickHouse job. | |
| - name: pytest isolation gates (Postgres authority, auth on) | |
| if: ${{ !cancelled() && matrix.profile == 'isolation' && steps.auth_on.outcome == 'success' }} | |
| env: | |
| LOOM_AUTH_REQUIRED: "true" | |
| LOOM_BASE_URL: http://localhost:7778 | |
| LOOM_CH_ANALYSIS_PROBE_INTERVAL_S: "10" | |
| run: >- | |
| pytest -q | |
| tests/integration/test_cross_principal_leakage.py | |
| tests/integration/test_read_scope_isolation.py | |
| tests/integration/test_session_briefs.py | |
| tests/integration/test_token_mint.py | |
| tests/integration/_sdk_handoff_ci.py | |
| tests/integration/test_mcp_session_run_scope.py | |
| tests/integration/test_onboard_tenant.py | |
| tests/integration/test_blacklist.py | |
| tests/integration/test_mirror_checked_search_http.py | |
| tests/integration/test_mirror_checked_list_http.py | |
| tests/integration/test_analysis_isolation.py | |
| tests/integration/test_sensitivity_high_canary.py | |
| tests/integration/test_pg_authority.py | |
| -k "not test_a_duplicate_never_resolves_to_a_canonical_outside_the_scope | |
| and not test_a_superseded_hit_never_names_a_successor_outside_the_scope" | |
| # Last in the storage profile: `loom reconcile` acts on the whole database, | |
| # the storage tests' rows included, so it runs after them in its file's order. | |
| - name: pytest (loom reconcile drills) | |
| if: ${{ !cancelled() && matrix.profile == 'storage' }} | |
| run: pytest -q -p no:randomly tests/integration/test_restore_reconcile.py | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: server-log-postgres-${{ matrix.postgres }}-${{ matrix.profile }} | |
| path: | | |
| server.log | |
| server-auth.log | |
| mixed-version: | |
| needs: [validate-ref, clickhouse] | |
| name: builds N-1 and N on one ClickHouse | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| LOOM_CLICKHOUSE_IMAGE: ${{ needs.clickhouse.outputs.image }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| # The gate builds each build's dashboard bundle. | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" --extra dev --extra code | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| # The base is HEAD~1: the previous commit on a push, and on a pull request the | |
| # first parent of its merge commit, the target branch as the merge was made. The | |
| # target branch's tip can carry a newer migration by the time the run starts. | |
| - name: Mixed-version gate | |
| run: python scripts/gates/mixed_version.py --require --base HEAD~1 | |
| # v1.3.0 checks the analyst version before probing retired relations. | |
| - name: Published build event-view compatibility | |
| run: python scripts/gates/mixed_version.py --require --base 47b479dcdae4c089aef2690428fa4c9a8f54554c | |
| sdk-rust: | |
| needs: validate-ref | |
| name: rust sdk (${{ matrix.rust }}, ${{ matrix.mode }}, fmt, tests, clippy, docs, package) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: ["1.84.1", stable] | |
| mode: [async, blocking] | |
| defaults: | |
| run: | |
| working-directory: sdk/rust | |
| env: | |
| CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback | |
| RUST_SDK_FEATURES: ${{ matrix.mode == 'blocking' && '--features blocking' || '' }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - name: Install Rust with format and lint components | |
| env: | |
| RUST_TOOLCHAIN: ${{ matrix.rust }} | |
| run: | | |
| rustup toolchain install "${RUST_TOOLCHAIN}" --profile minimal --component rustfmt --component clippy | |
| rustup override set "${RUST_TOOLCHAIN}" | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Check the independent Rust SDK version | |
| run: python ../../scripts/release/rust_sdk.py check-version | |
| # The library leaves dependency locking to its consumers; each toolchain resolves once. | |
| - name: Resolve dependencies for this toolchain | |
| run: cargo generate-lockfile | |
| - name: Rust formatting | |
| run: cargo fmt --check | |
| - name: Install Rust coverage tools | |
| id: rust-coverage-tools | |
| if: github.event_name == 'pull_request' && matrix.rust == 'stable' | |
| continue-on-error: true | |
| run: | | |
| rustup component add llvm-tools-preview | |
| cargo install --locked cargo-llvm-cov --version 0.9.2 | |
| - name: Unit, HTTP contract and documentation tests | |
| env: | |
| COLLECT_RUST_COVERAGE: ${{ steps.rust-coverage-tools.outcome == 'success' }} | |
| run: | | |
| if [[ "$COLLECT_RUST_COVERAGE" == true ]]; then | |
| cargo llvm-cov --locked --all-targets $RUST_SDK_FEATURES --no-report | |
| else | |
| cargo test --locked --all-targets $RUST_SDK_FEATURES | |
| fi | |
| cargo test --locked --doc $RUST_SDK_FEATURES | |
| - name: Export Rust coverage as LCOV | |
| id: rust-coverage | |
| if: steps.rust-coverage-tools.outcome == 'success' | |
| continue-on-error: true | |
| run: cargo llvm-cov report $RUST_SDK_FEATURES --lcov --output-path "$RUNNER_TEMP/rust.lcov" | |
| - name: Report Rust SDK changed-line coverage | |
| if: steps.rust-coverage.outcome == 'success' | |
| continue-on-error: true | |
| uses: ClickHouse/loom/.github/actions/patch-coverage@df405e9ed5d032b8248f6cfa8cf87e856685e490 | |
| with: | |
| component: Rust SDK | |
| working-directory: sdk/rust | |
| report: ${{ runner.temp }}/rust.lcov | |
| - name: Lint the library, tests and examples | |
| run: cargo clippy --locked --all-targets $RUST_SDK_FEATURES -- -D warnings | |
| - name: API documentation | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: cargo doc --locked --no-deps $RUST_SDK_FEATURES | |
| - name: Verify the distributable crate and its license | |
| run: | | |
| version=$(python ../../scripts/release/rust_sdk.py check-version) | |
| cargo package --locked $RUST_SDK_FEATURES | |
| python ../../scripts/release/rust_sdk.py verify-package \ | |
| "target/package/clickhouse-loom-$version.crate" \ | |
| --expected-commit "$(git rev-parse HEAD)" | |
| sdk-typescript: | |
| needs: validate-ref | |
| name: typescript sdk (generated types in sync, lint, tsc, vitest, dist) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| id: python | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: false | |
| - name: Install Loom from uv.lock (no extras) | |
| env: | |
| PYTHON_PATH: ${{ steps.python.outputs.python-path }} | |
| run: | | |
| uv sync --locked --python "${PYTHON_PATH}" | |
| echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | |
| # The SDK's operation table and wire types are generated from the | |
| # server's registry; a server change that alters a | |
| # request or response shape must regenerate them in the same PR. | |
| - name: generated ops.ts is current | |
| run: python scripts/codegen/sdk_ts_gen.py --check | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| package-manager-cache: false | |
| - name: npm ci | |
| working-directory: sdk/typescript | |
| run: npm ci --no-audit --no-fund | |
| # biome lint + format, tsc --noEmit, version consistency, the README's | |
| # ts examples type-checked against src, vitest. | |
| - name: lint + type-check + version + README examples + unit tests | |
| working-directory: sdk/typescript | |
| env: | |
| LOOM_TEST_COVERAGE: ${{ github.event_name == 'pull_request' && '1' || '' }} | |
| run: npm run check | |
| - name: Report TypeScript SDK changed-line coverage | |
| if: github.event_name == 'pull_request' | |
| continue-on-error: true | |
| uses: ClickHouse/loom/.github/actions/patch-coverage@df405e9ed5d032b8248f6cfa8cf87e856685e490 | |
| with: | |
| component: TypeScript SDK | |
| working-directory: sdk/typescript | |
| report: sdk/typescript/coverage/lcov.info | |
| # ESM + CJS build, the dist tests over the exact export | |
| # list, publint and arethetypeswrong — the package must resolve for | |
| # CommonJS consumers and bundlers before it is ever published. | |
| - name: build + dist tests + publint + attw | |
| working-directory: sdk/typescript | |
| run: npm run check:dist | |
| - name: SDK API documentation with locked tooling | |
| working-directory: sdk/typescript | |
| run: npm run docs | |
| # Keep the locked 1.8 baseline above and qualify the other supported band | |
| # against the same source, native tool runner and package exports. | |
| - name: Claude memory tool with Anthropic 1.11 | |
| working-directory: sdk/typescript | |
| run: | | |
| npm ci --prefix ../../.github/anthropic-sdk-1.11 --ignore-scripts --no-audit --no-fund | |
| rm -r node_modules/@anthropic-ai/sdk | |
| ln -s "$GITHUB_WORKSPACE/.github/anthropic-sdk-1.11/node_modules/@anthropic-ai/sdk" node_modules/@anthropic-ai/sdk | |
| npm run type-check | |
| npx vitest run src/integrations/claude-memory.test.ts src/integrations/claude-memory-runner.test.ts | |
| npx vitest run --config vitest.dist.config.ts test/package/exports.test.ts | |
| sdk-python-adapters: | |
| needs: validate-ref | |
| name: python sdk adapters (py ${{ matrix.python }}${{ matrix.lowest && ', lowest deps' || '' }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| # The framework adapters' tests and types, each with the framework its SDK extra | |
| # names, in a venv of its own: their dependencies are not in uv.lock, and two | |
| # frameworks may pin one package incompatibly. | |
| # The lowest-deps leg installs every direct requirement (the SDK's own, the | |
| # extra's, pytest) at its lower bound. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python: "3.12" | |
| - python: "3.11" | |
| lowest: true | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Adapter tests and mypy --strict | |
| env: | |
| RESOLUTION: ${{ matrix.lowest && 'lowest-direct' || 'highest' }} | |
| run: make test-sdk-adapters SDK_ADAPTERS_PYTHON="$(which python)" SDK_ADAPTERS_RESOLUTION="${RESOLUTION}" | |
| sdk-python-package: | |
| needs: validate-ref | |
| name: python sdk wheel (py ${{ matrix.python }}${{ matrix.lowest && ', lowest deps' || '' }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| # Every other job runs the SDK inside the server's 3.12 environment, whose | |
| # dependencies and interpreter hide what a clean install on the SDK's floor | |
| # lacks. This one installs the built wheel alone, with only its declared | |
| # deps, on the floor and the newest Python; the lowest-deps legs pin each | |
| # declared dep to its lower bound. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python: "3.11" | |
| - python: "3.12" | |
| - python: "3.14" | |
| - python: "3.11" | |
| lowest: true | |
| - python: "3.14" | |
| lowest: true | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Build wheel + sdist | |
| run: uv build sdk/python --out-dir dist | |
| - name: Install the wheel into a clean venv | |
| env: | |
| RESOLUTION: ${{ matrix.lowest && 'lowest-direct' || 'highest' }} | |
| run: | | |
| WHEEL=$(ls dist/*.whl) | |
| uv venv --python "$(which python)" /tmp/sdk-venv | |
| # The wheel's Requires-Dist lines, passed as direct requirements so | |
| # lowest-direct lowers them (a wheel's own deps count as transitive). | |
| unzip -p "$WHEEL" '*.dist-info/METADATA' | sed -n 's/^Requires-Dist: //p' > /tmp/sdk-deps.txt | |
| uv pip install --python /tmp/sdk-venv/bin/python --resolution "$RESOLUTION" \ | |
| "$WHEEL" -r /tmp/sdk-deps.txt | |
| uv pip list --python /tmp/sdk-venv/bin/python | |
| - name: Smoke-test the installed wheel | |
| run: /tmp/sdk-venv/bin/python scripts/gates/sdk_wheel_smoke.py dist/*.whl | |
| langflow-extension: | |
| needs: validate-ref | |
| name: Langflow extension wheel (py ${{ matrix.python }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Build the SDK and extension distributions | |
| run: | | |
| uv build sdk/python --out-dir "$RUNNER_TEMP/langflow-sdk-dist" | |
| uv build integrations/langflow --out-dir "$RUNNER_TEMP/langflow-extension-dist" | |
| mkdir "$RUNNER_TEMP/langflow-sdist" | |
| tar -xzf "$RUNNER_TEMP"/langflow-extension-dist/*.tar.gz -C "$RUNNER_TEMP/langflow-sdist" | |
| uv build "$RUNNER_TEMP"/langflow-sdist/* --wheel --out-dir "$RUNNER_TEMP/langflow-rebuilt-dist" | |
| - name: Install and discover the extension outside the checkout | |
| run: | | |
| uv venv --python "$(command -v python)" "$RUNNER_TEMP/langflow-extension-venv" | |
| uv pip install --python "$RUNNER_TEMP/langflow-extension-venv/bin/python" \ | |
| "$RUNNER_TEMP"/langflow-sdk-dist/*.whl \ | |
| "$RUNNER_TEMP"/langflow-rebuilt-dist/*.whl "lfx==1.13.3" | |
| uv pip check --python "$RUNNER_TEMP/langflow-extension-venv/bin/python" | |
| cd "$RUNNER_TEMP" | |
| env -u PYTHONPATH "$RUNNER_TEMP/langflow-extension-venv/bin/python" -I \ | |
| "$GITHUB_WORKSPACE/scripts/gates/langflow_extension_smoke.py" \ | |
| "$GITHUB_WORKSPACE" "$RUNNER_TEMP/langflow-extension-dist" \ | |
| "$RUNNER_TEMP/langflow-rebuilt-dist" \ | |
| "$RUNNER_TEMP/langflow-sdk-dist" |