Skip to content

Implement FileRAGSource and Standardize Imports#15

Closed
jgoy-labs wants to merge 235 commits into
mainfrom
fix/rag-file-source-2459010982943014577
Closed

Implement FileRAGSource and Standardize Imports#15
jgoy-labs wants to merge 235 commits into
mainfrom
fix/rag-file-source-2459010982943014577

Conversation

@jgoy-labs

Copy link
Copy Markdown
Owner

This PR implements the missing FileRAGSource class in memory/rag_sources/file/source.py as a reference implementation for version 0.8.0. It also standardizes the imports across the RAG module and fixes the module exports. Note that semantic search with Qdrant is currently a placeholder to maintain system stability and workflow compatibility.


PR created automatically by Jules for task 2459010982943014577 started by @jgoy-labs

Documentació corregida i actualitzada:
- API.md: Endpoints correctes amb /v1/, dual-key auth, X-API-Key headers
- SECURITY.md: Configuració real (server.toml), paths correctes, MAX_SCAN_LENGTH
- RAG.md: Sistema híbrid embeddings (nomic-embed-text 768d), 3 col·leccions, chunking en caràcters
- USAGE.md: CLI real (memory recall/store/stats/cleanup, knowledge ingest), autenticació obligatòria
- README.md: Stack correcte (Click+Rich), compatibilitat OpenAI parcial, SECURITY.md afegit

Canvis principals documentació:
- Models embeddings: Ollama nomic-embed-text (768 dims) + fallbacks documentats
- Col·leccions Qdrant: nexe_chat_memory, nexe_documentation, user_knowledge
- Thresholds diferenciats: 0.4 (docs), 0.35 (knowledge), 0.3 (memory)
- Chunking: 1500/200 chars (text general), 800/100 (RAG endpoint)
- Autenticació X-API-Key obligatòria a tots els endpoints /v1/*
- CLI real: store|recall|stats|cleanup (no search/list/delete)
- Paths correctes: storage/qdrant/, /v1/memory/*, /api/info

Codi NEXE 0.8 complet afegit:
- Core: FastAPI server, CLI, endpoints, loaders
- Plugins: MLX, llama.cpp, Ollama, security, web UI
- Memory: RAG system, embeddings, Qdrant integration
- Personality: i18n, module management, configuration

Eliminats:
- PRODUCTION_PLAN.md
- REVIEW_SUPERCONSULTOR_2026-01-31.md
…cepts

- memory/rag/routers/endpoints.py: ALLOWED_UPLOAD_EXTENSIONS whitelist,
  filename sanitization (Path.name) to prevent path traversal,
  generic 500 error messages (no internal details exposed)
- core/endpoints/root.py: /health/ready returns only {status, timestamp}
  to avoid exposing internal module list without auth
- plugins/web_ui_module/session_manager.py: implement cleanup_inactive()
  with timedelta TTL to prevent session memory leak
- memory/memory/engines/persistence.py: QDRANT_API_KEY env var support
  for authenticated Qdrant deployments
- core/endpoints/chat.py: log JSONDecodeError in Ollama stream,
  handle asyncio.CancelledError on client disconnect
- plugins/web_ui_module/memory_helper.py: replace bare except with
  except Exception + debug logging
- .env.example: document all env vars including QDRANT_API_KEY
- .dockerignore: exclude .env, storage/, venv/, .git/ from Docker image
- .github/workflows/ci.yml: pip-audit CVE scan + unit tests
- core/endpoints/tests/test_security.py: 14 security regression tests

Assisted by AI
- fastapi 0.109.0 → 0.128.8 (starlette 0.49.1+, tanca GHSA-2c2j + GHSA-7f5h)
- uvicorn 0.27.0.post1 → 0.34.3
- pydantic 2.6.0 → 2.10.6
- python-multipart 0.0.6 → 0.0.22 (tanca GHSA-wp53-j4wj-2cfg)
- httpx 0.26.0 → 0.27.2
- qdrant-client 1.12.0 → 1.13.3
- structlog 24.1.0 → 25.5.0
- tenacity 8.2.3 → 9.1.2
- python-dotenv 1.0.1 → 1.2.1
- huggingface_hub 0.20.3 → 0.36.2
- sentence-transformers 2.3.1 → 2.7.0
- pypdf 4.0.1 → 6.7.1 (tanca 7 CVEs GHSA-*)
- numpy 1.26.4 mantingut (numpy 2.x breaking changes)
- rich/typer mantinguts (cadena de compatibilitat)

Verificat: pip-audit 0 vulnerabilitats, 14/14 tests passen

Assisted by AI
… endpoints

M-7: personality/i18n/i18n_manager.py i modular_i18n.py usaven 8 línies
  de codi duplicat per cercar server.toml. Ara deleguen a
  core.config.find_config_path (funció centralitzada ja existent).

M-8: personality/i18n/__init__.py: _global_i18n = None s'inicialitzava
  lazy sense lock. Afegit threading.Lock + double-checked locking
  per evitar race condition en entorns async/multi-thread.

T-3: memory/rag/tests/test_endpoints.py: 14 tests unitaris nous pels
  endpoints RAG (upload, search, add_document, whitelist extensions).
  Cobreixen: validació extensions, path traversal, errors 500 genèrics,
  resultats correctes, metadades invàlides, fitxers massa grans.

Total tests: 28/28 passen.

Assisted by AI
…p.state

- factory_state.py: eliminar 4 crides register_service() (codi mort)
- lifespan.py: sincronitzar app.state.config amb server_state.config en reload
- memory/module.py: substituir get_service() per get_i18n() i get_server_state()
- web_ui/manifest.py: substituir get_service("module_manager") per get_server_state()
- container.py: marcar com a DEPRECATED (mantingut per tests, eliminar en v0.9)

Resultat: font única per a cada objecte; desync config eliminat.
N-1: server.toml → production, debug=false, reload=false
N-2: system.py → PID i kill commands eliminats de respostes HTTP
N-3: memory/api/v1.py → str(e) → error genèric + exc_info=True
N-4: manifest.py → path traversal /ui/static/ bloquejat (resolve+startswith)
N-5: session cleanup asyncio periòdic (cada hora, TTL 24h)
N-6: system health → versió llegida de config (no hardcoded "0.7.1")
N-7+N-8: manifest.py → import duplicat + _initialized eliminats

Tests: +35 (test_security_n_series.py), total 49 passed
Docs: SECURITY.md secció N-series afegida
- security_logger/logger.py: hostname nexe-server → server-nexe
- RUNTIME_CONTRACT.md: nexe.core.server_nexe → core.app (mòdul real)
- manifest.toml (×8): server.nexe/ → server-nexe/ (comentaris i paths)
- nexe script: path hardcodat /NatSytem/server-nexe → /NatSytem/Nexe/server-nexe
- cli/output.py: banner title server.nexe → server-nexe
- security/manifest.py: comentari server.nexe root → server-nexe root
- setup.sh: comprovació Python >=3.10 amb missatge clar (brew install python@3.11)
  (python-multipart==0.0.22 i altres deps requereixen Python 3.10+)
- install_nexe.py: logo tagline traduït a català
- 14 strings hardcoded ara passen per t() (ca/es/en)
- Afegides 37 claus noves a les 3 traduccions:
  - Pantalla selecció de models (mida, model, motor)
  - Descàrrega Ollama/GGUF/MLX (progress steps)
  - Metal fallback (opcions, missatges d'error)
  - rec_label ara usa t('size_small/medium/large')
  - "Motors:" ara usa t('engines_label')
Prova python3.11/3.12/3.10, paths Homebrew (/opt/homebrew),
i /usr/local/bin abans de caure a python3 del sistema.
Usa PYTHON_BIN per llançar install_nexe.py.
ZIP de GitHub no preserva permisos d'execució.
- MODEL_CATALOG: lang i description ara dicts {ca/es/en} per a 7 models
- Afegides claus disk_label i fits_tight a les 3 traduccions
- Display: usa model['lang'][LANG], model['description'][LANG]
- "💾 Disc:" → t('disk_label') (Disc/Disco/Disk)
- "Pot anar just" → t('fits_tight')
install_nexe.py:
- Strings embeddings download/validation ara usen t()
- Passa NEXE_LANG com a env var al subprocess d'ingesta
- Afegides claus: embeddings_*, processing_knowledge_*, knowledge_indexed_ok

core/ingest/ingest_knowledge.py:
- Afegit _I18N dict + _t() que llegeix NEXE_LANG
- Tots els missatges ara multilingüe (ca/es/en)
- knowledge/: 9 documents amb capçalera # === METADATA RAG === (id, abstract,
  tags, chunk_size, priority). README.md mogut de l'arrel a knowledge/ i ara
  és ingestable (id: nexe-overview, P1).
- Exclusió README.md eliminada dels 4 punts d'ingestió (lifespan, cli,
  ingest_knowledge, install_nexe).
- header_parser.py: fix _extract_header — blank lines seguides de comentaris
  de secció (# ===) ja no trenquen el parsing.
- OpenAPI: summary= afegit als 33 endpoints; tags= a routers sense etiquetar
  (system, modules); descripció global enriquida a factory_app.py.
- Docs moguts a knowledge/ca/ (estructura multi-idioma).
  El glob **/*.md ja era recursiu, cap canvi de codi a ingestió.
- knowledge/en/ pot afegir-se quan calgui.
- chat.py: cerca user_knowledge filtra per lang=NEXE_LANG (default 'ca')
  via filter_metadata — usa FieldCondition Qdrant existent.
  Cada idioma de servidor retorna només docs en el seu idioma.
- chat.py: llegeix idioma de req.app.state.i18n.current_language en runtime
  (p.ex. "ca-ES" → "ca"). Fallback: NEXE_LANG env → "ca".
  Aix\xed el selector d'idioma del servidor afecta la cerca RAG immediatament.
- Afegides carpetes knowledge/es/ i knowledge/en/ (buides) per docs futurs.
- knowledge/es/: 9 documents traduïts (API, ARCHITECTURE, INSTALLATION,
  LIMITATIONS, PLUGINS, RAG, README, SECURITY, USAGE)
- knowledge/en/: 9 documents traduïts
- Capçaleres RAG actualitzades: lang ca→es/en, abstract i tags traduïts
- Termes tècnics, blocs de codi, paths i URLs preservats intactes
- 27/27 documents passen validació parse_rag_header
- core/ingest/ingest_knowledge.py: usa knowledge/{NEXE_LANG}/ si existeix
- core/lifespan.py: aplica mateix filtre de llengua a auto-ingest startup
- core/cli/cli.py: aplica filtre de llengua a 'nexe knowledge ingest'
- install_nexe.py: detecta subcarpeta de llengua per comptatge de fitxers
- knowledge/*.md: eliminats de l'arrel (moviment completat a knowledge/ca/)
- requirements.txt: qdrant-client==1.13.3 → >=1.17.0
profiles.py:
- CONSUMER: gemma2:2b → phi3.5 (Phi-3.5 Mini 3.8B, millor instruccions)
- PRO: llama3.2:3b → llama3.1:8b (adequat per 16-32GB RAM)
  secondary: gemma2:9b → mistral:7b | embedding: nomic → all-MiniLM-L6-v2
  context_window: 16384 → 32768
- ULTRA: llama3.1:8b → llama3.1:70b (qualitat màxima per >32GB)
  secondary: mistral-nemo:12b → mixtral:8x7b
  embedding: mxbai-embed-large → all-MiniLM-L6-v2
  context_window: 32768 → 65536

registry.py — afegits 4 nous models:
- salamandra2b (BSC/AINA, Ollama, llengües ibèriques)
- salamandra7b (BSC/AINA, Ollama+GGUF, el millor per català)
- mistral7b (MLX+Ollama+GGUF, equilibri qualitat/velocitat)
- llama3.1-70b (MLX+Ollama+GGUF, qualitat professional)
- mixtral (MLX+Ollama+GGUF, MoE 8x7B)

server.toml:
- secondary: "mistral-nemo:12b" → "" (engine-specific, no hardcoded)
- embedding: "mxbai-embed-large" → "all-MiniLM-L6-v2" (model real del sistema)
…EFAULT_MODEL

Problema: _forward_to_ollama usava NEXE_DEFAULT_MODEL que pot contenir
una URL HuggingFace (per llama_cpp/mlx), causant fallback silenciós
al primer model disponible d'Ollama sense cap avís.

Solució:
- Prioritat nova: request.model > NEXE_OLLAMA_MODEL > NEXE_DEFAULT_MODEL
  (si no és URL/path) > config > "llama3.2"
- NEXE_DEFAULT_MODEL amb URLs o paths locals s'ignora per Ollama
- install_nexe.py escriu NEXE_OLLAMA_MODEL quan l'engine és ollama
- _update_env_model_config gestiona NEXE_OLLAMA_MODEL en actualitzacions
- Retrocompatible: instal·lacions existents amb NEXE_DEFAULT_MODEL=nom-ollama
  segueixen funcionant
jgoy-labs and others added 17 commits March 15, 2026 22:04
- Replace placeholder logo with official brand SVG from server-nexe.org
- Update coverage badge from 60% to 93% (actual measured value)
- Point README logo to .github/logo.svg
- Sessió detecta quan supera 10 missatges i compacta els antics
- Resum generat pel mateix model (ja carregat, sense overhead)
- Manté últims 6 missatges + resum per coherència
- Badge 'ctx Nx' a la UI quan context compactat
- Resum persistent a disc (sobreviu reinicis)
MiniLM-L12-v2 (384 dims) era referència obsoleta a embeddings/ i docs.
El runtime sempre ha usat mpnet-base-v2 (768 dims).
Unificat codi, tests i documentació (ca/es/en).
- Python mínim 3.11+ a tota la documentació (ca/es/en)
- Dimensions embeddings 384 → 768 (defaults, tests, manifest)
- Dates caducades actualitzades a 2027
- ./nexe stop: nova comanda per aturar serveis
- FastAPI 0.104+ → 0.128+ a docs
- Placeholder {{NEXE_MODULE_ID}} → ollama_module
- Terminologia interna (NAT/Lliçó) netejada de la web UI
- BOOTSTRAP_TTL → NEXE_BOOTSTRAP_TTL a docs
- console.log debug eliminat de app.js
- Corregida duplicació candidates setup.sh
- Fix test_memory_helper_async (assert 2 collections)
…e imports

Implemented the missing FileRAGSource class in memory/rag_sources/file/source.py.
This version serves as a reference implementation for v0.8.0 using regex-based keyword matching.
Standardized imports across the RAG module to use the new package structure.
Updated memory.rag_sources.file.__init__ to export FileRAGSource.

Co-authored-by: jgoy-labs <228093761+jgoy-labs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits March 16, 2026 01:09
- Implemented missing FileRAGSource class in memory/rag_sources/file/source.py.
- Fixed security vulnerability CVE-2026-31826 by updating pypdf to 6.8.0.
- Standardized FileRAGSource imports across the RAG module.
- Improved search algorithm with regex word boundaries for better accuracy.
- Documented FileRAGSource as a reference implementation for v0.8.0.

Co-authored-by: jgoy-labs <228093761+jgoy-labs@users.noreply.github.com>
…ze async tests

- Implemented missing FileRAGSource class in memory/rag_sources/file/source.py.
- Fixed security vulnerability CVE-2026-31826 by updating pypdf to 6.8.0.
- Standardized FileRAGSource imports across the RAG module.
- Refactored EmbeddingsModule tests to use standard pytest-asyncio patterns, fixing CI event loop errors.
- Documented FileRAGSource as a reference implementation for v0.8.0.

Co-authored-by: jgoy-labs <228093761+jgoy-labs@users.noreply.github.com>
- Added missing FileRAGSource implementation in memory/rag_sources/file/source.py.
- Updated pypdf to 6.8.0 to resolve security vulnerability CVE-2026-31826.
- Refactored EmbeddingsModule unit tests to use standard pytest-asyncio patterns.
- Standardized RAG module imports and exports.

Co-authored-by: jgoy-labs <228093761+jgoy-labs@users.noreply.github.com>
@jgoy-labs jgoy-labs closed this Mar 18, 2026
@jgoy-labs jgoy-labs deleted the fix/rag-file-source-2459010982943014577 branch March 18, 2026 20:33
jgoy-labs added a commit that referenced this pull request Apr 12, 2026
… nous

Release consolidada v0.9.0 resultant de dues fases de treball:

## Fase 1 — Sprints 0-4 vacances 2-5 abril (42 bugs)
Coordinat per Uatu amb Claude Opus 4.6 en sessions independents:

- **Sprint 0-1**: memoria v1 (Qdrant embedded singleton, SessionManager v1)
- **Sprint 2**: fix critic tray.py bloqueja teclat (_RamMonitor background)
- **Sprint 3**: 13 bugs test instal·lacio neta + 5 fixes installer
  - #12 guard thinking+MEM_SAVE, #13 labels col·leccions, #14 pantalla
    benvinguda clickable, #15 i18n general, #16 tray nom+versio, #17 tray
    link web, #20 SEC-004 MIME validation
  - Installer: select_model() prompt_tier+chat_format, validacio Metal MLX
- **Sprint 4**: refactoring — helpers extrets (ollama_helpers.py,
  tray_monitor.py, lifespan_modules.py), DEFAULT_VECTOR_SIZE constant, i18n
  get_message() complet
- **Director 01/04**: 5 UX features (copy, sidebar, rename, donate, X doc) +
  3 memory fixes (MEM_SAVE post-render strip, XSS fix, race condition Lock,
  [MEM:N] token mismatch)

Auditoria global final APTE (Claude Opus 4.6 independent, 2026-04-02).

## Fase 2 — HOMAD 2026-04-06 (27 bugs + Ollama GUI)
3 blocs de bugs del fitxer bugs-server-nexe.md (pre-release test):

**Bloc 1 — Critics (5)**
- #7 Reinstal·lacio 3 modes (wipe/overwrite/backup) + stop server + Keychain
- #8 TOCTOU master key (os.open atomic)
- #10 DreamingCycle connection leak (6/6 funcions)
- #29 Phi-3.5 fora del cataleg
- Ollama GUI: ollama serve headless (no open -a Ollama al Dock)

**Bloc 2 — Mitjana (12)**
- #21 validate_string_input API v1
- #22 auth 21 endpoints + docs gated
- #17 MEM_SAVE injection strict (whitelist Unicode, blacklist)
- #32 history_floor context budget
- #15 Ollama breaker semantic (4xx no infra)
- #16 SessionManager RLock reentrant
- #19 MLX cache singleton double-checked locking
- #11 Bootstrap token renewal + retry backoff (1,5,30)
- #13 Qdrant pool flush + logger.warning
- #20 Module cycles consumer + startup summary
- #9 SQL MIN portable (Python min())
- #28 Installer --skip-model-download

**Bloc 3 — Baixa (11)**
- #3 HF_TOKEN warning silenciat
- #4 ANSI constants buides sense TTY
- #5 Qdrant didactic isatty guards
- #6 warnings position_ids + Some weights filtered
- #12 discover_modules early return
- #14 TQDM_DISABLE runtime servidor
- #18 encoding fallback utf-8 → cp1252 → latin-1
- #23 Ollama no silent fallback → HTTPException 404
- #26 _backend_model_exists best-effort + logger mitigant
- #27 _BACKEND_ALIASES backwards-compat
- #30 Info.plist LSUIElement=false verificats

Workflow HOMAD: Dev paral·lels (Opus) + 9 passades Consultor independents
amb Dev D intermedi per findings. Tot verificat al codi real.

## Pytest consolidat
**4389 passed**, 7 fails pre-existents (test_chat_unit::test_long_text_truncated,
test_root::test_enabled_modules, test_security::test_long_context_truncated,
4× test_memory_helper_async::TestGetMemoryApi), 0 regressions.

## Fitxers nous
- core/endpoints/chat_engines/ollama_helpers.py (Sprint 4)
- core/lifespan_modules.py (Sprint 4)
- installer/tray_monitor.py (Sprint 4)
- installer/installer_reinstall.py (Bloc 1 Bug 7)

## Stats
- 61 fitxers modificats (57 codi/knowledge/tests/installer/personality +
  README.md + 3 nous)
- +1870 / -674 linies

## Version bump
v0.8.5 → v0.9.0 (cataleg, pyproject, README, CHANGELOG, index.html, footer)

## Post-release pendent
- Build DMG v0.9.0 (/dmg-nexe) amb tots els fixes
- Notaritzacio Apple (re-firma si cal)
- Test manual DMG per Bug 30 (icona Dock) + smoke tests release
- Webs .org i .com ja desplegades per Uatu durant vacances

NO PUSH en aquest commit — pendent OK explicit Jordi per al tag v0.9.0 final
i push a GitHub release.
jgoy-labs added a commit that referenced this pull request Apr 12, 2026
… nous

Release consolidada v0.9.0 resultant de dues fases de treball:

## Fase 1 — Sprints 0-4 vacances 2-5 abril (42 bugs)
Coordinat en sessions independents:

- **Sprint 0-1**: memoria v1 (Qdrant embedded singleton, SessionManager v1)
- **Sprint 2**: fix critic tray.py bloqueja teclat (_RamMonitor background)
- **Sprint 3**: 13 bugs test instal·lacio neta + 5 fixes installer
  - #12 guard thinking+MEM_SAVE, #13 labels col·leccions, #14 pantalla
    benvinguda clickable, #15 i18n general, #16 tray nom+versio, #17 tray
    link web, #20 SEC-004 MIME validation
  - Installer: select_model() prompt_tier+chat_format, validacio Metal MLX
- **Sprint 4**: refactoring — helpers extrets (ollama_helpers.py,
  tray_monitor.py, lifespan_modules.py), DEFAULT_VECTOR_SIZE constant, i18n
  get_message() complet
- **Director 01/04**: 5 UX features (copy, sidebar, rename, donate, X doc) +
  3 memory fixes (MEM_SAVE post-render strip, XSS fix, race condition Lock,
  [MEM:N] token mismatch)

Auditoria global final APTE (2026-04-02).

## Fase 2 — HOMAD 2026-04-06 (27 bugs + Ollama GUI)
3 blocs de bugs del fitxer bugs-server-nexe.md (pre-release test):

**Bloc 1 — Critics (5)**
- #7 Reinstal·lacio 3 modes (wipe/overwrite/backup) + stop server + Keychain
- #8 TOCTOU master key (os.open atomic)
- #10 DreamingCycle connection leak (6/6 funcions)
- #29 Phi-3.5 fora del cataleg
- Ollama GUI: ollama serve headless (no open -a Ollama al Dock)

**Bloc 2 — Mitjana (12)**
- #21 validate_string_input API v1
- #22 auth 21 endpoints + docs gated
- #17 MEM_SAVE injection strict (whitelist Unicode, blacklist)
- #32 history_floor context budget
- #15 Ollama breaker semantic (4xx no infra)
- #16 SessionManager RLock reentrant
- #19 MLX cache singleton double-checked locking
- #11 Bootstrap token renewal + retry backoff (1,5,30)
- #13 Qdrant pool flush + logger.warning
- #20 Module cycles consumer + startup summary
- #9 SQL MIN portable (Python min())
- #28 Installer --skip-model-download

**Bloc 3 — Baixa (11)**
- #3 HF_TOKEN warning silenciat
- #4 ANSI constants buides sense TTY
- #5 Qdrant didactic isatty guards
- #6 warnings position_ids + Some weights filtered
- #12 discover_modules early return
- #14 TQDM_DISABLE runtime servidor
- #18 encoding fallback utf-8 → cp1252 → latin-1
- #23 Ollama no silent fallback → HTTPException 404
- #26 _backend_model_exists best-effort + logger mitigant
- #27 _BACKEND_ALIASES backwards-compat
- #30 Info.plist LSUIElement=false verificats

Workflow HOMAD: Dev paral·lels (Opus) + 9 passades Consultor independents
amb Dev D intermedi per findings. Tot verificat al codi real.

## Pytest consolidat
**4389 passed**, 7 fails pre-existents (test_chat_unit::test_long_text_truncated,
test_root::test_enabled_modules, test_security::test_long_context_truncated,
4× test_memory_helper_async::TestGetMemoryApi), 0 regressions.

## Fitxers nous
- core/endpoints/chat_engines/ollama_helpers.py (Sprint 4)
- core/lifespan_modules.py (Sprint 4)
- installer/tray_monitor.py (Sprint 4)
- installer/installer_reinstall.py (Bloc 1 Bug 7)

## Stats
- 61 fitxers modificats (57 codi/knowledge/tests/installer/personality +
  README.md + 3 nous)
- +1870 / -674 linies

## Version bump
v0.8.5 → v0.9.0 (cataleg, pyproject, README, CHANGELOG, index.html, footer)

## Post-release pendent
- Build DMG v0.9.0 (/dmg-nexe) amb tots els fixes
- Notaritzacio Apple (re-firma si cal)
- Test manual DMG per Bug 30 (icona Dock) + smoke tests release
- Webs .org i .com ja desplegades durant vacances

NO PUSH en aquest commit — pendent OK explicit Jordi per al tag v0.9.0 final
i push a GitHub release.
jgoy-labs added a commit that referenced this pull request May 14, 2026
…nada 4.1 Cluster 12)

13 cosmetic mypy findings closed via documented type-ignores or minimal
annotations, no behavioural change:

import-untyped (toml, yaml — D3 director category)
- core/config.py:17 — toml lacks stubs; kept for write path (#3)
- core/cli/config.py:21 — yaml stubs deferred to v1.1 (#8)
- installer/install_headless.py:447 — toml lacks stubs (#15)
- installer/install.py:378 — toml lacks stubs (#16)
- core/cli/cli.py:325 — toml lacks stubs (#63)

no-redef (tomli fallback for Python <3.11)
- core/version.py:9 — # type: ignore[no-redef] (#11)
- core/cli/router.py:25 — # type: ignore[no-redef] (#12)

annotation/var-annotated/has-type
- core/cli/i18n.py:43 — FP or-narrowing of Optional[str] or str
  (Director Onada 4.1 D2: # type: ignore[return-value]) (#2)
- core/bootstrap_tokens.py:35 — declare _db_path / _initialized at
  class body and add -> 'BootstrapTokenManager' to __new__ (#6, #7)
- core/paths/detection.py:44 — _detection_history: list[dict[str, Any]]
  (#10)
- core/ingest/ingest_knowledge.py:243 — files: list[Path] = [] (#32)

method-assign
- scripts/bench_ingest_bug16.py:102 — benchmark monkey-patch documented
  with # type: ignore[method-assign] (#39)
jgoy-labs added a commit that referenced this pull request May 16, 2026
… nous

Release consolidada v0.9.0 resultant de dues fases de treball:

## Fase 1 — Sprints 0-4 vacances 2-5 abril (42 bugs)
Coordinat en sessions independents:

- **Sprint 0-1**: memoria v1 (Qdrant embedded singleton, SessionManager v1)
- **Sprint 2**: fix critic tray.py bloqueja teclat (_RamMonitor background)
- **Sprint 3**: 13 bugs test instal·lacio neta + 5 fixes installer
  - #12 guard thinking+MEM_SAVE, #13 labels col·leccions, #14 pantalla
    benvinguda clickable, #15 i18n general, #16 tray nom+versio, #17 tray
    link web, #20 SEC-004 MIME validation
  - Installer: select_model() prompt_tier+chat_format, validacio Metal MLX
- **Sprint 4**: refactoring — helpers extrets (ollama_helpers.py,
  tray_monitor.py, lifespan_modules.py), DEFAULT_VECTOR_SIZE constant, i18n
  get_message() complet
- **Director 01/04**: 5 UX features (copy, sidebar, rename, donate, X doc) +
  3 memory fixes (MEM_SAVE post-render strip, XSS fix, race condition Lock,
  [MEM:N] token mismatch)

Auditoria global final APTE (2026-04-02).

## Fase 2 — HOMAD 2026-04-06 (27 bugs + Ollama GUI)
3 blocs de bugs del fitxer bugs-server-nexe.md (pre-release test):

**Bloc 1 — Critics (5)**
- #7 Reinstal·lacio 3 modes (wipe/overwrite/backup) + stop server + Keychain
- #8 TOCTOU master key (os.open atomic)
- #10 DreamingCycle connection leak (6/6 funcions)
- #29 Phi-3.5 fora del cataleg
- Ollama GUI: ollama serve headless (no open -a Ollama al Dock)

**Bloc 2 — Mitjana (12)**
- #21 validate_string_input API v1
- #22 auth 21 endpoints + docs gated
- #17 MEM_SAVE injection strict (whitelist Unicode, blacklist)
- #32 history_floor context budget
- #15 Ollama breaker semantic (4xx no infra)
- #16 SessionManager RLock reentrant
- #19 MLX cache singleton double-checked locking
- #11 Bootstrap token renewal + retry backoff (1,5,30)
- #13 Qdrant pool flush + logger.warning
- #20 Module cycles consumer + startup summary
- #9 SQL MIN portable (Python min())
- #28 Installer --skip-model-download

**Bloc 3 — Baixa (11)**
- #3 HF_TOKEN warning silenciat
- #4 ANSI constants buides sense TTY
- #5 Qdrant didactic isatty guards
- #6 warnings position_ids + Some weights filtered
- #12 discover_modules early return
- #14 TQDM_DISABLE runtime servidor
- #18 encoding fallback utf-8 → cp1252 → latin-1
- #23 Ollama no silent fallback → HTTPException 404
- #26 _backend_model_exists best-effort + logger mitigant
- #27 _BACKEND_ALIASES backwards-compat
- #30 Info.plist LSUIElement=false verificats

Workflow HOMAD: Dev paral·lels (Opus) + 9 passades Consultor independents
amb Dev D intermedi per findings. Tot verificat al codi real.

## Pytest consolidat
**4389 passed**, 7 fails pre-existents (test_chat_unit::test_long_text_truncated,
test_root::test_enabled_modules, test_security::test_long_context_truncated,
4× test_memory_helper_async::TestGetMemoryApi), 0 regressions.

## Fitxers nous
- core/endpoints/chat_engines/ollama_helpers.py (Sprint 4)
- core/lifespan_modules.py (Sprint 4)
- installer/tray_monitor.py (Sprint 4)
- installer/installer_reinstall.py (Bloc 1 Bug 7)

## Stats
- 61 fitxers modificats (57 codi/knowledge/tests/installer/personality +
  README.md + 3 nous)
- +1870 / -674 linies

## Version bump
v0.8.5 → v0.9.0 (cataleg, pyproject, README, CHANGELOG, index.html, footer)

## Post-release pendent
- Build DMG v0.9.0 (/dmg-nexe) amb tots els fixes
- Notaritzacio Apple (re-firma si cal)
- Test manual DMG per Bug 30 (icona Dock) + smoke tests release
- Webs .org i .com ja desplegades durant vacances

NO PUSH en aquest commit — pendent OK explicit Jordi per al tag v0.9.0 final
i push a GitHub release.
jgoy-labs added a commit that referenced this pull request May 16, 2026
…nada 4.1 Cluster 12)

13 cosmetic mypy findings closed via documented type-ignores or minimal
annotations, no behavioural change:

import-untyped (toml, yaml — D3 director category)
- core/config.py:17 — toml lacks stubs; kept for write path (#3)
- core/cli/config.py:21 — yaml stubs deferred to v1.1 (#8)
- installer/install_headless.py:447 — toml lacks stubs (#15)
- installer/install.py:378 — toml lacks stubs (#16)
- core/cli/cli.py:325 — toml lacks stubs (#63)

no-redef (tomli fallback for Python <3.11)
- core/version.py:9 — # type: ignore[no-redef] (#11)
- core/cli/router.py:25 — # type: ignore[no-redef] (#12)

annotation/var-annotated/has-type
- core/cli/i18n.py:43 — FP or-narrowing of Optional[str] or str
  (Director Onada 4.1 D2: # type: ignore[return-value]) (#2)
- core/bootstrap_tokens.py:35 — declare _db_path / _initialized at
  class body and add -> 'BootstrapTokenManager' to __new__ (#6, #7)
- core/paths/detection.py:44 — _detection_history: list[dict[str, Any]]
  (#10)
- core/ingest/ingest_knowledge.py:243 — files: list[Path] = [] (#32)

method-assign
- scripts/bench_ingest_bug16.py:102 — benchmark monkey-patch documented
  with # type: ignore[method-assign] (#39)
jgoy-labs added a commit that referenced this pull request May 16, 2026
…nada 4.1 Cluster 12)

13 cosmetic mypy findings closed via documented type-ignores or minimal
annotations, no behavioural change:

import-untyped (toml, yaml — D3 director category)
- core/config.py:17 — toml lacks stubs; kept for write path (#3)
- core/cli/config.py:21 — yaml stubs deferred to v1.1 (#8)
- installer/install_headless.py:447 — toml lacks stubs (#15)
- installer/install.py:378 — toml lacks stubs (#16)
- core/cli/cli.py:325 — toml lacks stubs (#63)

no-redef (tomli fallback for Python <3.11)
- core/version.py:9 — # type: ignore[no-redef] (#11)
- core/cli/router.py:25 — # type: ignore[no-redef] (#12)

annotation/var-annotated/has-type
- core/cli/i18n.py:43 — FP or-narrowing of Optional[str] or str
  (Director Onada 4.1 D2: # type: ignore[return-value]) (#2)
- core/bootstrap_tokens.py:35 — declare _db_path / _initialized at
  class body and add -> 'BootstrapTokenManager' to __new__ (#6, #7)
- core/paths/detection.py:44 — _detection_history: list[dict[str, Any]]
  (#10)
- core/ingest/ingest_knowledge.py:243 — files: list[Path] = [] (#32)

method-assign
- scripts/bench_ingest_bug16.py:102 — benchmark monkey-patch documented
  with # type: ignore[method-assign] (#39)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant