Repository navigation
chore(release): v4.8.0 — Multilingual Foundation + Zero-Downtime Reindex - #154
Conversation
📝 WalkthroughWalkthroughThis release updates the public API baseline with security and indexing parameters, adds v4.8.0 migration documentation, records the changelog entry, and synchronizes Python and npm package versions. Changesv4.8.0 release surface
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
| ```python | ||
| reindex_documents(force=True) | ||
| ``` |
There was a problem hiding this comment.
Smart reindex breaks dimension migration
When an existing 384D installation switches to the 1024D multilingual profile, the documented reindex_documents(force=True) selects an in-place smart reindex rather than a fresh collection rebuild, causing Chroma to reject the new vectors with a dimension mismatch.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/migration-v4.8.0.md
Line: 23-25
Comment:
**Smart reindex breaks dimension migration**
When an existing 384D installation switches to the 1024D multilingual profile, the documented `reindex_documents(force=True)` selects an in-place smart reindex rather than a fresh collection rebuild, causing Chroma to reject the new vectors with a dimension mismatch.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| for col in client.list_collections(): | ||
| if "__staging_" in col.name: | ||
| client.delete_collection(name=col.name) |
There was a problem hiding this comment.
Cleanup overmatches collection names
When another legitimate collection contains __staging_ in its name, this broad substring test deletes it even though it is unrelated to the production collection, causing permanent data loss; the application cleanup instead matches the configured ${collection_name}__staging_ prefix.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/migration-v4.8.0.md
Line: 169-171
Comment:
**Cleanup overmatches collection names**
When another legitimate collection contains `__staging_` in its name, this broad substring test deletes it even though it is unrelated to the production collection, causing permanent data loss; the application cleanup instead matches the configured `${collection_name}__staging_` prefix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| sys.stdout = sys.stderr | ||
|
|
||
| __version__ = "4.7.1" | ||
| __version__ = "4.8.0" |
There was a problem hiding this comment.
MCP server version remains stale
The package version is bumped to 4.8.0, but the MCP server constructor still independently advertises version="4.6.0", causing clients to identify the shipped 4.8.0 server as 4.6.0 while the version-sync check continues to pass.
Prompt To Fix With AI
This is a comment left during a code review.
Path: mcp_server/__init__.py
Line: 11
Comment:
**MCP server version remains stale**
The package version is bumped to 4.8.0, but the MCP server constructor still independently advertises `version="4.6.0"`, causing clients to identify the shipped 4.8.0 server as 4.6.0 while the version-sync check continues to pass.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/migration-v4.8.0.md`:
- Line 133: Update the “Canal de report privado” entry in the migration
documentation to use a repository-specific clickable Security Advisory URL or
link directly to SECURITY.md, replacing the host-root `/security/advisories/new`
path while preserving the configured private reporting channel.
- Line 130: Update the migration table row for “Prompt injection via
add_from_url” to remove literal pipe characters from the cell, or move the
sentinel examples such as <|im_start|> below the table. Preserve the fix
description while ensuring the row remains valid Markdown with the intended
columns.
- Around line 5-8: Update the MCP tools compatibility bullet in the migration
document to state that existing calls remain compatible while public signatures
may include new optional parameters, including resume in reindex_documents;
remove the claim that signatures are preserved byte-for-byte.
- Around line 103-105: The migration documentation must describe the cutover as
staged and non-transactional: at docs/migration-v4.8.0.md lines 103-105, replace
“atomic two-step swap,” specify the query source during populate/validation, and
document the failure state after each rename, including production being absent
if the process stops after moving prod to __old_{ts}; at lines 147-151, state
that individual renames are atomic but crash recovery does not guarantee
production availability, and remove “Zero corrupção.”
In `@README.md`:
- Around line 1419-1423: Clarify the v4.8.0 release notes by defining the test
scope associated with each reported result—383 passed/8 xfailed and 557 passed/3
skipped/9 xfailed—or replace them with one authoritative result. Update the
v4.8.0 changelog entry without changing its implementation or migration details.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e8507895-f39e-4697-9c2b-caee7e31dcf3
📒 Files selected for processing (6)
.github/api-surface-baseline.jsonREADME.mddocs/migration-v4.8.0.mdmcp_server/__init__.pynpm/package.jsonpyproject.toml
| - **`pip install -U knowledge-rag`** — comportamento idêntico à v4.7.1 se você não tocar em `config.yaml`. Zero ação necessária. | ||
| - **Opt-in features** requerem edits em `config.yaml` + reindex. | ||
| - **Nenhum breaking change.** Assinaturas das MCP tools preservadas byte-for-byte. | ||
| - **Ganho principal (multilingual)**: +1.88pp Recall@10 medido no benchmark A/B do repo (p<0.001) e ~+4pp em queries PT-BR. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Correct the signature compatibility statement.
Line 7 says that MCP tool signatures are preserved byte-for-byte. The public API baseline adds optional parameters, including reindex_documents(..., resume=...). Existing calls remain compatible, but the signatures changed.
Proposed wording
- **Nenhum breaking change.** Assinaturas das MCP tools preservadas byte-for-byte.
+ **Nenhum breaking change para chamadas existentes.** A v4.8.0 adiciona parâmetros opcionais às APIs públicas.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - **`pip install -U knowledge-rag`** — comportamento idêntico à v4.7.1 se você não tocar em `config.yaml`. Zero ação necessária. | |
| - **Opt-in features** requerem edits em `config.yaml` + reindex. | |
| - **Nenhum breaking change.** Assinaturas das MCP tools preservadas byte-for-byte. | |
| - **Ganho principal (multilingual)**: +1.88pp Recall@10 medido no benchmark A/B do repo (p<0.001) e ~+4pp em queries PT-BR. | |
| - **`pip install -U knowledge-rag`** — comportamento idêntico à v4.7.1 se você não tocar em `config.yaml`. Zero ação necessária. | |
| - **Opt-in features** requerem edits em `config.yaml` + reindex. | |
| - **Nenhum breaking change para chamadas existentes.** A v4.8.0 adiciona parâmetros opcionais às APIs públicas. | |
| - **Ganho principal (multilingual)**: +1.88pp Recall@10 medido no benchmark A/B do repo (p<0.001) e ~+4pp em queries PT-BR. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/migration-v4.8.0.md` around lines 5 - 8, Update the MCP tools
compatibility bullet in the migration document to state that existing calls
remain compatible while public signatures may include new optional parameters,
including resume in reindex_documents; remove the claim that signatures are
preserved byte-for-byte.
| **v4.8.0**: `nuclear_rebuild(swap=True)` (novo default) cria staging collection timestamped → popula → valida três gates (`count >= baseline * 0.9`, 4 de 5 queries canônicas retornam hits, `query()` não raise) → atomic two-step swap via `Collection.modify(name=)` → delete old collection. | ||
|
|
||
| Queries continuam servindo da collection antiga durante toda a populate/validate phase. Janela de risco no swap em si: microssegundos entre `rename staging → prod_new` e `delete prod_old`. Se falhar aí, `_cleanup_stale_staging_collections()` do próximo boot resolve orphans (>24h TTL). |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
printf '%s\n' '--- target document ---'
sed -n '90,160p' docs/migration-v4.8.0.md
printf '%s\n' '--- related identifiers ---'
rg -n "_cleanup_stale_staging_collections|nuclear_rebuild|Collection\.modify|staging_" . --glob '!node_modules' --glob '!dist' --glob '!build'Repository: lyonzin/knowledge-rag
Length of output: 20664
🏁 Script executed:
printf '%s\n' '--- cleanup and swap implementation ---'
sed -n '1935,2195p' mcp_server/server.py
printf '%s\n' '--- rebuild implementation ---'
sed -n '2195,2345p' mcp_server/server.py
printf '%s\n' '--- operational documentation ---'
sed -n '86,125p' docs/reindex-operations.md
printf '%s\n' '--- swap tests around failure handling ---'
sed -n '270,380p' tests/test_swap_zero_downtime.pyRepository: lyonzin/knowledge-rag
Length of output: 24684
🏁 Script executed:
printf '%s\n' '--- query path and rebind behavior ---'
rg -n "def query|self\.collection|_populate_staging|_swap_collections_atomic|_rollback_and_cleanup_staging" mcp_server/server.py | head -80
sed -n '1500,1655p' mcp_server/server.py
printf '%s\n' '--- complete swap-related tests ---'
sed -n '1,80p' tests/test_swap_zero_downtime.py
sed -n '380,500p' tests/test_swap_zero_downtime.py
printf '%s\n' '--- AST call-sequence verifier ---'
python3 - <<'PY'
import ast
from pathlib import Path
path = Path("mcp_server/server.py")
tree = ast.parse(path.read_text())
methods = {}
for node in ast.walk(tree):
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
methods[node.name] = node
for name in (
"_swap_collections_atomic",
"_promote_staging_or_rollback",
"_rebuild_via_swap",
"_rollback_and_cleanup_staging",
):
node = methods[name]
calls = []
for child in ast.walk(node):
if isinstance(child, ast.Call):
fn = child.func
if isinstance(fn, ast.Attribute):
target = ast.unparse(fn)
elif isinstance(fn, ast.Name):
target = fn.id
else:
target = ast.unparse(fn)
calls.append((child.lineno, target))
print(name)
for lineno, target in sorted(calls):
print(f" {lineno}: {target}")
PYRepository: lyonzin/knowledge-rag
Length of output: 16361
🏁 Script executed:
sed -n '2345,2505p' mcp_server/server.py
printf '%s\n' '--- fake client rename/delete semantics used by tests ---'
sed -n '70,155p' tests/test_swap_zero_downtime.py
printf '%s\n' '--- all swap wording in the affected documentation ---'
rg -n -C 2 "atomic|swap|staging|old|rollback|corrup" docs/migration-v4.8.0.md docs/reindex-operations.mdRepository: lyonzin/knowledge-rag
Length of output: 23029
Document the cutover as non-transactional and correct the recovery guarantee.
Collection.modify(name=...) is atomic per call, but _swap_collections_atomic uses separate renames and a non-fatal delete. If the process stops after prod → __old_{ts}, the production name is absent; _cleanup_stale_staging_collections() does not restore __old_{ts}. Also, _populate_staging rebinds self.collection, so orchestrator queries do not use the old collection throughout populate and validation.
docs/migration-v4.8.0.md#L103-L105: Replace “atomic two-step swap” with “staged cutover” and describe the query source and failure state for each step.docs/migration-v4.8.0.md#L147-L151: State that individual renames are atomic, but crash recovery does not guarantee production availability. Remove “Zero corrupção”.
📍 Affects 1 file
docs/migration-v4.8.0.md#L103-L105(this comment)docs/migration-v4.8.0.md#L147-L151
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/migration-v4.8.0.md` around lines 103 - 105, The migration documentation
must describe the cutover as staged and non-transactional: at
docs/migration-v4.8.0.md lines 103-105, replace “atomic two-step swap,” specify
the query source during populate/validation, and document the failure state
after each rename, including production being absent if the process stops after
moving prod to __old_{ts}; at lines 147-151, state that individual renames are
atomic but crash recovery does not guarantee production availability, and remove
“Zero corrupção.”
| | Vetor | Fix | | ||
| |---|---| | ||
| | Path traversal em 5 tools (`get_document`, `add_document_from_content`, `update_document_content`, `remove_document_by_path`, `search_similar`) | `validate_path_within` na entrada; retorno estruturado `{"error": "Filepath rejected: ..."}` | | ||
| | Prompt injection via `add_from_url` (OWASP LLM01:2025) | `sanitize_external_content` no body fetched; provenance envelope + defuse de sentinels (`<|im_start|>`, `[INST]`, etc.) | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the Markdown table delimiter collision.
The literal | characters in <|im_start|> make this row parse as four table cells. The fix description can render incorrectly or be truncated. Move sentinel examples below the table, or remove literal pipe characters from the table cell.
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 130-130: Spaces inside code span elements
(MD038, no-space-in-code)
[warning] 130-130: Table column count
Expected: 2; Actual: 4; Too many cells, extra data will be missing
(MD056, table-column-count)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/migration-v4.8.0.md` at line 130, Update the migration table row for
“Prompt injection via add_from_url” to remove literal pipe characters from the
cell, or move the sentinel examples such as <|im_start|> below the table.
Preserve the fix description while ensuring the row remains valid Markdown with
the intended columns.
Source: Linters/SAST tools
| | Prompt injection via `add_from_url` (OWASP LLM01:2025) | `sanitize_external_content` no body fetched; provenance envelope + defuse de sentinels (`<|im_start|>`, `[INST]`, etc.) | | ||
| | Auth bypass em HTTP transports (`sse`, `streamable-http`) | `BearerAuthMiddleware` na ASGI app do FastMCP quando `config.auth_bearer_token` set; token unset → `[WARN]` + comportamento aberto legacy | | ||
|
|
||
| Canal de report privado: **GitHub Security Advisory form** — `/security/advisories/new` (Private Vulnerability Reporting habilitado no repo). `SECURITY.md` atualizado. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use a repository-specific vulnerability-reporting link.
/security/advisories/new is a host-root path and is not a clickable repository advisory link. Point users to this repository’s Security Advisory form, or to SECURITY.md, so reports reach the configured private reporting channel.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/migration-v4.8.0.md` at line 133, Update the “Canal de report privado”
entry in the migration documentation to use a repository-specific clickable
Security Advisory URL or link directly to SECURITY.md, replacing the host-root
`/security/advisories/new` path while preserving the configured private
reporting channel.
| ### v4.8.0 (2026-08-06) — Multilingual Foundation + Zero-Downtime Reindex | ||
|
|
||
| v4.8.0 é a release de fundação para migração pra embeddings multilingual (`intfloat/multilingual-e5-large`) sem forçar downtime nem breaking change. Sete fases entregaram: security wire (7 vetores fechados que existiam desde v4.5.1), embedding profiles com prefix opt-in, GPU auto-detect com dependency chain documentada, batch/parallel indexing configurável + fix da assimetria BM25/semantic candidate pool, progress granular + resume checkpoint, dual-collection swap zero-downtime, e refactor pra manter complexidade Radon C+ na superfície tocada. | ||
|
|
||
| Zero breaking change: usuários que atualizarem SEM tocar em `config.yaml` continuam com `bge-small-en-v1.5` byte-for-byte. Opt-in para multilingual: `profile: "multilingual"` + `reindex_documents(force=True)` — durante o reindex, RAG continua servindo da collection antiga (zero downtime via staging swap). Detalhes de upgrade em `docs/migration-v4.8.0.md`. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- README v4.8.0 section ---'
sed -n '1408,1430p' README.md
printf '%s\n' '--- Repository files mentioning the reported test totals ---'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' \
'383|8 expected|full sweep|v4\.8\.0|passed|expected failures' .
printf '%s\n' '--- Recent tracked files relevant to release notes and test reports ---'
git ls-files | rg -i '(^|/)(README\.md|.*(migration|release|test|report|objective|summary).*)$' | head -200Repository: lyonzin/knowledge-rag
Length of output: 39060
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- Refactor audit test-result context ---'
sed -n '1,220p' docs/refactor-audit-v4.8.0-fase-6.md
printf '%s\n' '--- Test-count baseline and test-count checker ---'
cat .github/test-count-baseline.txt
sed -n '1,220p' scripts/check_test_count.py
printf '%s\n' '--- Repository and branch metadata ---'
git remote -v
git branch --show-current
git status --short
git log -1 --format='%H%n%s'
printf '%s\n' '--- Current pull-request metadata, when available ---'
if command -v gh >/dev/null 2>&1; then
gh pr view --json number,title,body,headRefName,baseRefName 2>/dev/null || true
fiRepository: lyonzin/knowledge-rag
Length of output: 9719
🏁 Script executed:
#!/bin/bash
set -eu
repo='lyonzin/knowledge-rag'
sha='51aa46f47a347d3262c7876cb3ba87464eecd70d'
if command -v gh >/dev/null 2>&1; then
printf '%s\n' '--- Pull requests associated with the release commit ---'
gh api "repos/$repo/commits/$sha/pulls" \
--header 'Accept: application/vnd.github+json' \
--jq '.[] | {number, title, body, state, head: .head.ref, base: .base.ref}' \
2>/dev/null || true
printf '%s\n' '--- Commit message and check summaries ---'
gh api "repos/$repo/commits/$sha" \
--header 'Accept: application/vnd.github+json' \
--jq '{sha: .sha, message: .commit.message, checks: [.check_runs[]? | {name, conclusion, status}]}' \
2>/dev/null || true
fiRepository: lyonzin/knowledge-rag
Length of output: 5385
Clarify the v4.8.0 test-result scope before merge.
The release PR reports 383 passed / 8 xfailed / 0 failed across six chunks. The changelog reports 557 passed / 3 skipped / 9 xfailed / 0 failed for a broader sweep. State the scope of each result, or use one authoritative result.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 1419 - 1423, Clarify the v4.8.0 release notes by
defining the test scope associated with each reported result—383 passed/8
xfailed and 557 passed/3 skipped/9 xfailed—or replace them with one
authoritative result. Update the v4.8.0 changelog entry without changing its
implementation or migration details.
|
Want your agent to iterate on Greptile's feedback? Start a greploop in Claude Code and it will work through the open comments and keep going until this PR reviews clean. |
Resumo executivo
v4.8.0 é a release de fundação que habilita migração pra embeddings multilingual (
intfloat/multilingual-e5-large) sem downtime e sem breaking change. Sete fases entregaram security wire, embedding profiles, GPU auto-detect, batch/parallel indexing, resume checkpoint, dual-collection swap zero-downtime, e refactor pra manter complexidade Radon C+.Zero breaking change: usuário que fizer
pip install -U knowledge-ragsem tocar emconfig.yamlcontinua combge-small-en-v1.5byte-for-byte.Fases entregues + PRs
profile+query_prefix/passage_prefixopt-inautodefault + 4-check probe + bannerbatch_size+parallel_workersconfig + fixmax_resultsasymmetry (20→100)resume=True+ granular progress fieldsnuclear_rebuild(swap=True)via staging collection swapMétricas mensuráveis
multilingual-e5-large; ~+4pp em queries PT-BR (medido antes do release, ver_research/).nuclear_rebuild(swap=True): 2x temporário → 1x pós-swap.Migration guide
Full guide: `docs/migration-v4.8.0.md` — TL;DR + FAQ + rollback.
Opt-in quick refs:
Test evidence
Suite completa rodada em 6 chunks isolados na branch release:
Zero failed. Xfaileds em security são gaps conhecidos de symlink handling + wrap-external-source semantic — não são regressões (herdados do master pré-release).
Commits nesta release
Test plan
Summary by CodeRabbit
New Features
Documentation
Release
Greptile Summary
The PR prepares the v4.8.0 release metadata and documentation for multilingual embeddings, resumable indexing, GPU auto-detection, and zero-downtime collection swaps.
Confidence Score: 4/5
The PR is not yet safe to merge because the rollback guide can target the wrong database or delete unrelated collections, and the running MCP server still advertises the old release version.
The documented cleanup continues to use a misspelled, non-configurable database path and an ownership-blind substring deletion rule, while the MCP constructor remains hard-coded to 4.6.0 despite the 4.8.0 package bump; these previously reported defects need correction before release.
Files Needing Attention: docs/migration-v4.8.0.md, mcp_server/server.py
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR C[Compact 384D collection] --> P[Select multilingual profile] P --> D[Startup dimension check] D --> S[Build staging collection at 1024D] S --> V[Validate staging] V --> W[Swap staging into production] W --> M[Serve multilingual queries]Reviews (2): Last reviewed commit: "chore(lint): ruff --fix + ruff format on..." | Re-trigger Greptile