Created comprehensive documentation for migration 1076 including:
- Overview and migration details
- Complete field descriptions
- How to apply and rollback
- Testing instructions
- Performance and security considerations
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
Created migration 1076_add_deletion_request.py to add the DeletionRequest model
to the database schema. This model tracks AI-initiated deletion requests that
require explicit user approval before any documents are deleted.
Migration includes:
- All model fields (created_at, updated_at, requested_by_ai, ai_reason, status, etc.)
- ManyToMany relationship with Document model
- Foreign keys to User model (user and reviewed_by)
- Custom indexes for common query patterns (status+user, created_at)
- Proper ordering and metadata
Fixes#10
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Move all imports to module level (removed from inside methods)
- Add missing `status` import from rest_framework
- Fix docstring formatting to comply with PEP 257
- Add explanatory comments to empty except clauses
- Improve error message for document not found
- Add warning comment about thread-safety in config update
- Add TODO comments for storing approval/rejection reasons
- Remove unused StoragePath import from tests
- Remove duplicate permission imports at end of file
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Add PAPERLESS_ENABLE_AI_SCANNER check in consumer._run_ai_scanner() method
- Move AIScanResult import to top of test file to follow DRY principle
- Create helper methods: create_empty_scan_result_mock() and get_test_file_with_name()
- Reduce code duplication by using helper methods across all tests
- Improve performance test threshold from 10s to 1s for mocked operations
- Add TODO comment for proper performance testing with real ML models
- Remove duplicate 'from documents.ai_scanner import AIScanResult' imports from 7 test methods
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Add composite index (user, status, created_at) for listing queries
- Add index for reviewed_at field for filtering reviewed requests
- Add index for completed_at field for filtering completed requests
- Create migration 1076_add_deletionrequest_performance_indexes
- Expected improvement: list queries <100ms, filter queries <50ms
Addresses: [AI Scanner] Índices de Performance para DeletionRequest
Epic: Migraciones de Base de Datos
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Añadir TSK-AI-SCANNER-LINTING al historial completado
- Documentar sesión detallada con timestamps y acciones
- Registrar decisiones de diseño sobre correcciones aplicadas
- Actualizar WIP a estado de espera
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Add TestConsumerAIScannerIntegration test class with 10 integration tests
- Test 1: End-to-end integration (upload → consumption → AI scan → metadata)
- Test 2: ML components disabled (graceful degradation)
- Test 3: AI scanner failures (error handling)
- Test 4a-4c: Different document types (PDF, image, text)
- Test 5: Performance verification (<2s additional time)
- Test 6: Transactions and rollbacks
- Test 7: Multiple concurrent documents
- Test 8: AI scanner disabled via settings
- All tests use mocks to verify integration without requiring actual ML models
- Tests follow existing patterns in test_consumer.py
- Update BITACORA_MAESTRA.md with session details per agents.md requirements
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Revised the next planned micro-step to include coordination for security review after resetting credentials.
- Added a new session log entry detailing the action of resetting the `dawnsystem` user password and its persistence in the Docker database.
- Enhanced clarity on the current state of the Docker environment and ongoing tasks for IntelliDocs validation.
This update improves documentation accuracy and provides a clearer path forward for the project.