Skip to content

feat: implement hybrid history-aware retriever strategy #6964

feat: implement hybrid history-aware retriever strategy

feat: implement hybrid history-aware retriever strategy #6964

Workflow file for this run

name: Pre-commit
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: # Allow manual triggering
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
if: github.repository == 'vllm-project/semantic-router'
runs-on: ubuntu-latest
name: Run pre-commit hooks check file lint
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for pre-commit
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: 20
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.90
components: rustfmt, clippy
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
make \
build-essential \
pkg-config \
shellcheck
- name: Set up golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.5.0
install-mode: binary
args: --help
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
candle-binding/target/
key: ${{ runner.os }}-cargo-precommit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-precommit-
- name: Cache Go dependencies
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-precommit-
- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-precommit-
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-precommit-
- name: Install tree-sitter for security scan
run: |
pip install \
tree-sitter \
tree-sitter-python \
tree-sitter-javascript \
tree-sitter-typescript \
tree-sitter-go \
tree-sitter-rust
- name: Run AST supply chain security scan
run: |
python3 tools/security/ast_security_scanner.py \
scan . --fail-on HIGH
- name: Run AST PR diff security scan
if: github.event_name == 'pull_request'
run: |
python3 tools/security/ast_security_scanner.py \
diff "origin/${{ github.base_ref }}" --fail-on HIGH
- name: Run agent CI lint on changed files
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
export AGENT_BASE_REF="origin/${{ github.base_ref }}"
else
export AGENT_BASE_REF="HEAD^"
fi
make agent-ci-lint
- name: Diagnose gofmt state before pre-commit
run: |
echo "=== Go version ==="
go version
echo "=== gofmt version ==="
gofmt -h 2>&1 | head -3 || true
echo "=== Files needing gofmt (gofmt -l) ==="
NEEDS_FMT=$(gofmt -l $(find . -name "*.go" -not -path "./.git/*" -not -path "./.venv/*") 2>/dev/null)
if [ -n "$NEEDS_FMT" ]; then
echo "Files that need formatting:"
echo "$NEEDS_FMT"
echo ""
echo "=== Diffs ==="
for f in $NEEDS_FMT; do
echo "--- $f ---"
gofmt -d "$f" || true
done
else
echo "All Go files are properly formatted"
fi
echo "=== git status (any working tree changes) ==="
git status --short || true
- name: Run pre-commit check
run: make precommit-check
env:
CI: true
- name: Show pre-commit results
if: failure()
run: |
echo "::error::Pre-commit hooks failed. Please fix the issues and commit again."
echo ""
echo "=== Files with gofmt issues (gofmt -l) ==="
gofmt -l $(find . -name "*.go" -not -path "./.git/*") || true
echo ""
echo "=== gofmt diff for all modified Go files ==="
gofmt -d $(find . -name "*.go" -not -path "./.git/*") || true
echo ""
echo "=== Working tree changes after pre-commit run ==="
git diff --name-only || true
echo ""
echo "=== Full git diff ==="
git diff || true
echo ""
echo "To reproduce the full PR pre-commit baseline locally:"
echo " make agent-pr-gate"
echo ""
echo "To run the local branch prelint bundle manually:"
echo " make precommit-branch-gate AGENT_BASE_REF=origin/${{ github.base_ref }}"
echo ""
echo "To run only the pre-commit workflow locally:"
echo " make precommit-local"