diff --git a/.gitignore b/.gitignore index 47a8e36..0de430d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ bin/ # Temporary files .tmp* .tmp/* - +.tmp # Environment files .env *.env diff --git a/sale.tmp b/sale.tmp new file mode 100644 index 0000000..9244f2a --- /dev/null +++ b/sale.tmp @@ -0,0 +1,122 @@ +# Drive Monitor Refactor - Task Status + +## Summary +Unify DriveMonitor file state tracking from JSON to PostgreSQL database table `drive_files`. + +## Status: COMPLETED + +--- + +## Completed ✅ + +### 1. Migration +- Created `migrations/6.3.1-01-drive-files/up.sql` with table schema +- Indexes: bot_id, file_type, indexed, fail_count +- Migration data from kb_documents for backwards compatibility + +### 2. Schema +- Created `src/core/shared/schema/drive.rs` with: + - `DriveFile` (Queryable) + - `NewDriveFile` (Insertable) + - `DriveFileUpdate` (AsChangeset) + - diesel table! macro + +### 3. Repository +- Created `src/drive/drive_files.rs` with `DriveFileRepository` +- Methods: get_file_state, upsert_file, mark_indexed, mark_failed, get_max_fail_count, get_files_to_index, delete_file, get_all_files_for_bot, get_files_by_type + +--- + +## Working Environment + +```bash +# Access production logs +ssh administrator@63.141.255.9 +sudo incus exec system -- tail -f /opt/gbo/logs/err.log | grep -i "drive\|error" + +# Check CI logs +ssh administrator@63.141.255.9 +sudo incus exec alm-ci -- tail -f /opt/gbo/logs/*.log + +# Health endpoint +https://system.pragmatismo.com.br/api/health +``` + +--- + +## Testing Playbook + +1. **Rendering** + - Navigate: https://chat.pragmatismo.com.br/salesianos + - Send "oi", verify HTML response + +2. **Direct Tool Execution** + - Click "cartas" button + - Ask about cartas + +3. **KB Injection** + - Ask about cartas without clicking button + - Verify KB influences response + +4. **Parallel LLM** + - Start conversation in one window + - Verify start.bas doesn't lock other windows + +5. **Config Settings** + - Verify history-limit=3 in config.csv respected + - Toggle Table switch button + - Verify prompt injection + +--- + +## Critical Rules + +- Never stop - YOLO loop +- Push to ALM after each fix +- Check health endpoint after deploy +- Monitor err.log continuously +- Work only in ~/src/gb +- Push all submodules to ALM + +--- + +## Database Access + +```bash +# Get credentials from Vault +ssh administrator@63.141.255.9 "sudo incus exec system -- curl -s --cacert /opt/gbo/conf/system/certificates/ca/ca.crt -H 'X-Vault-Token: ' https://10.157.134.250:8200/v1/secret/data/gbo/tables 2>/dev/null" +``` + +--- + +## Container Layout +- `system` - BotServer (port 8080) +- `tables` - PostgreSQL (port 5432) +- `vault` - Vault (port 8200) +- `directory` - Zitadel (port 8080/9000) +- `drive` - MinIO (port 9100) +- `cache` - Valkey (port 6379) +- `llm` - llama.cpp (port 8081) +- `vector_db` - Qdrant (port 6333) +- `alm-ci` - CI runner + +--- + +## Current Status + +- DriveMonitor refatorado para usar database (JSON removido) +- FileState struct removido +- Métodos load/save_file_states removidos +- Repository pattern implementado +- Compilação verificada: OK + +--- + +## Next Steps + +1. Push para ALM todos os submódulos +2. Aguardar CI build +3. Testar com Playwright +4. Verificar health endpoint +5. Monitorar err.log +6. Reportar status e continuar YOLO