Skip to content

Commit 124f148

Browse files
committed
Fix Tantivy 0.26 build break and add cargo-audit CI
- Fix TopDocs::with_limit() call in verisim-document to use .order_by_score() as required by Tantivy 0.26 Collector trait - Add cargo-audit CI workflow for dependency vulnerability scanning (runs on PR, push to main, and weekly schedule) All 23 verisim-document tests pass (17 unit + 6 property). https://claude.ai/code/session_01FxxUVqL8xdA34j7n3Ep52S
1 parent 55ec903 commit 124f148

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

.github/workflows/cargo-audit.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# cargo-audit.yml — Dependency vulnerability scanning for Rust projects.
5+
# Runs cargo-audit against the RustSec advisory database.
6+
name: Cargo Audit
7+
8+
on:
9+
pull_request:
10+
branches: ['**']
11+
push:
12+
branches: [main, master]
13+
schedule:
14+
# Run weekly on Monday at 06:00 UTC to catch new advisories.
15+
- cron: '0 6 * * 1'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
audit:
22+
name: Dependency audit
23+
runs-on: ubuntu-latest
24+
if: hashFiles('Cargo.lock') != ''
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
29+
30+
- name: Install Rust toolchain
31+
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
32+
33+
- name: Install cargo-audit
34+
run: cargo install cargo-audit --locked
35+
36+
- name: Run cargo audit
37+
run: cargo audit
38+
39+
- name: Write summary
40+
if: always()
41+
run: |
42+
echo "## Cargo Audit Results" >> "$GITHUB_STEP_SUMMARY"
43+
echo "" >> "$GITHUB_STEP_SUMMARY"
44+
cargo audit 2>&1 | tail -20 >> "$GITHUB_STEP_SUMMARY" || true

rust-core/verisim-document/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ impl DocumentStore for TantivyDocumentStore {
275275
QueryParser::for_index(&self.index, vec![self.schema.title, self.schema.body]);
276276

277277
let parsed_query = query_parser.parse_query(query)?;
278-
let top_docs = searcher.search(&parsed_query, &TopDocs::with_limit(limit))?;
278+
let top_docs =
279+
searcher.search(&parsed_query, &TopDocs::with_limit(limit).order_by_score())?;
279280

280281
// Create snippet generator for body field
281282
let snippet_generator =

0 commit comments

Comments
 (0)