Skip to content

Commit f3df8d7

Browse files
authored
Merge pull request #6 from ossirytk/quality-work
Quality work
2 parents d0d537a + 6f8824c commit f3df8d7

6 files changed

Lines changed: 520 additions & 67 deletions

File tree

.github/copilot-setup-steps.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
steps:
2+
- name: Install uv
3+
uses: astral-sh/setup-uv@v4
4+
- name: Install Rust toolchain
5+
uses: dtolnay/rust-toolchain@stable
6+
- name: Install cargo-audit
7+
run: cargo install --locked cargo-audit
8+
- name: Install Python
9+
run: uv python install
10+
- name: Build extension and install project
11+
run: uv sync --dev && uv run maturin develop --release
12+
- name: Install ruff and pip-audit globally
13+
run: uv tool install ruff && uv tool install pip-audit
14+
- name: Pre-download embedding model
15+
run: uv run python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5'); print('Model cached successfully')"

.github/workflows/quality.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Quality Gate
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
env:
10+
TRANSFORMERS_OFFLINE: "1"
11+
HF_DATASETS_OFFLINE: "1"
12+
13+
jobs:
14+
quality-gate:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: clippy, rustfmt
23+
24+
- uses: astral-sh/setup-uv@v4
25+
26+
- name: Install cargo-audit
27+
run: cargo install --locked cargo-audit
28+
29+
- name: Set up Python
30+
run: uv python install
31+
32+
- name: Install dependencies
33+
run: uv sync --dev
34+
35+
- name: Build extension
36+
run: uv run maturin develop --release
37+
38+
- name: Rust format check
39+
run: cargo fmt --check
40+
41+
- name: Rust lint (clippy)
42+
run: cargo clippy -- -D warnings
43+
44+
- name: Python lint
45+
run: uv run ruff check .
46+
47+
- name: Python format check
48+
run: uv run ruff format --check .
49+
50+
- name: Tests + coverage
51+
run: uv run pytest --cov --cov-report=xml --cov-fail-under=60
52+
53+
- name: Python security audit
54+
run: uv run pip-audit
55+
56+
- name: Rust security audit
57+
run: cargo audit

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
88
"fastmcp>=3.2.0",
9+
"authlib>=1.6.11",
10+
"cryptography>=46.0.7",
911
"lancedb==0.30.0",
1012
"sentence-transformers>=5.3.0",
13+
"python-multipart>=0.0.27",
14+
"urllib3>=2.7.0",
1115
]
1216

1317
[project.optional-dependencies]
@@ -19,6 +23,7 @@ contextwell = "contextwell.server:run"
1923
[dependency-groups]
2024
dev = [
2125
"maturin>=1.12.6",
26+
"pip-audit>=2.0.0",
2227
"pytest>=9.0.2",
2328
"pytest-cov>=7.1.0",
2429
"rank-bm25>=0.2.2",
@@ -110,4 +115,3 @@ omit = ["tests/*", "*/__pycache__/*"]
110115
[tool.coverage.report]
111116
skip_empty = true
112117
show_missing = true
113-

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ impl MemoryRecord {
2929
}
3030

3131
fn __repr__(&self) -> String {
32-
format!("MemoryRecord(id={:?}, score={:.4})", &self.id[..8.min(self.id.len())], self.score)
32+
format!(
33+
"MemoryRecord(id={:?}, score={:.4})",
34+
&self.id[..8.min(self.id.len())],
35+
self.score
36+
)
3337
}
3438
}
3539

tests/test_integration.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,11 +1496,7 @@ def test_file_import_source_single_definition_keeps_definition_boundary(tmp_path
14961496

14971497
source_file = tmp_path / "single_def.py"
14981498
source_file.write_text(
1499-
"import os\n\n\n"
1500-
"def only_one() -> int:\n"
1501-
" a = 1\n"
1502-
" b = 2\n"
1503-
" return a + b\n",
1499+
"import os\n\n\ndef only_one() -> int:\n a = 1\n b = 2\n return a + b\n",
15041500
encoding="utf-8",
15051501
)
15061502

0 commit comments

Comments
 (0)