Files
Aniworld/docs/instructions.md
Lukas 0ec120e08f fix: reset queue progress flag after queue completes
- Reset _queue_progress_initialized after each queue run so the next
  run re-creates the 'download_queue' progress entry
- Handle 'already exists' ProgressServiceError in _init_queue_progress
  as a no-op success to cover concurrent-start edge cases
- Guard stop_downloads() progress update to avoid crashing when the
  entry was never created
2026-03-11 16:41:12 +01:00

7.7 KiB
Raw Blame History

Aniworld Web Application Development Instructions

This document provides detailed tasks for AI agents to implement a modern web application for the Aniworld anime download manager. All tasks should follow the coding guidelines specified in the project's copilot instructions.

Project Overview

The goal is to create a FastAPI-based web application that provides a modern interface for the existing Aniworld anime download functionality. The core anime logic should remain in SeriesApp.py while the web layer provides REST API endpoints and a responsive UI.

Architecture Principles

  • Single Responsibility: Each file/class has one clear purpose
  • Dependency Injection: Use FastAPI's dependency system
  • Clean Separation: Web layer calls core logic, never the reverse
  • File Size Limit: Maximum 500 lines per file
  • Type Hints: Use comprehensive type annotations
  • Error Handling: Proper exception handling and logging

Additional Implementation Guidelines

Code Style and Standards

  • Type Hints: Use comprehensive type annotations throughout all modules
  • Docstrings: Follow PEP 257 for function and class documentation
  • Error Handling: Implement custom exception classes with meaningful messages
  • Logging: Use structured logging with appropriate log levels
  • Security: Validate all inputs and sanitize outputs
  • Performance: Use async/await patterns for I/O operations

📞 Escalation

If you encounter:

  • Architecture issues requiring design decisions
  • Tests that conflict with documented requirements
  • Breaking changes needed
  • Unclear requirements or expectations

Document the issue and escalate rather than guessing.


<EFBFBD> Credentials

Admin Login:

  • Username: admin
  • Password: Hallo123!

<EFBFBD>📚 Helpful Commands

# Run all tests
conda run -n AniWorld python -m pytest tests/ -v --tb=short

# Run specific test file
conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py -v

# Run specific test class
conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py::TestWebSocketService -v

# Run specific test
conda run -n AniWorld python -m pytest tests/unit/test_websocket_service.py::TestWebSocketService::test_broadcast_download_progress -v

# Run with extra verbosity
conda run -n AniWorld python -m pytest tests/ -vv

# Run with full traceback
conda run -n AniWorld python -m pytest tests/ -v --tb=long

# Run and stop at first failure
conda run -n AniWorld python -m pytest tests/ -v -x

# Run tests matching pattern
conda run -n AniWorld python -m pytest tests/ -v -k "auth"

# Show all print statements
conda run -n AniWorld python -m pytest tests/ -v -s

#Run app
conda run -n AniWorld python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8000 --reload

Implementation Notes

  1. Incremental Development: Implement features incrementally, testing each component thoroughly before moving to the next
  2. Code Review: Review all generated code for adherence to project standards
  3. Documentation: Document all public APIs and complex logic
  4. Testing: Maintain test coverage above 80% for all new code
  5. Performance: Profile and optimize critical paths, especially download and streaming operations
  6. Security: Regular security audits and dependency updates
  7. Monitoring: Implement comprehensive monitoring and alerting
  8. Maintenance: Plan for regular maintenance and updates

Task Completion Checklist

For each task completed:

  • Implementation follows coding standards
  • Unit tests written and passing
  • Integration tests passing
  • Documentation updated
  • Error handling implemented
  • Logging added
  • Security considerations addressed
  • Performance validated
  • Code reviewed
  • Task marked as complete in instructions.md
  • Infrastructure.md updated and other docs
  • Changes committed to git; keep your messages in git short and clear
  • Take the next task

TODO List:


fix: download not working:

elf._progress_service.update_progress(

File "/app/src/server/services/progress_service.py", line 369, in update_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found

2026-03-11 15:15:42 [info ] Processing next item from queue item_id=108 remaining=2 serie=I Was Reincarnated as the 7th Prince So I Can Take My Time Perfecting My Magical Ability

2026-03-11 15:15:42 [error ] Error in queue processing loop error=Progress with id 'download_queue' not found

Traceback (most recent call last):

File "/app/src/server/services/download_service.py", line 716, in _process_queue

await self._progress_service.update_progress(

File "/app/src/server/services/progress_service.py", line 369, in update_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found

2026-03-11 15:15:43 [info ] Processing next item from queue item_id=109 remaining=1 serie=I Was Reincarnated as the 7th Prince So I Can Take My Time Perfecting My Magical Ability

2026-03-11 15:15:43 [error ] Error in queue processing loop error=Progress with id 'download_queue' not found

Traceback (most recent call last):

File "/app/src/server/services/download_service.py", line 716, in _process_queue

await self._progress_service.update_progress(

File "/app/src/server/services/progress_service.py", line 369, in update_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found

2026-03-11 15:15:44 [info ] Processing next item from queue item_id=110 remaining=0 serie=I Was Reincarnated as the 7th Prince So I Can Take My Time Perfecting My Magical Ability

2026-03-11 15:15:44 [error ] Error in queue processing loop error=Progress with id 'download_queue' not found

Traceback (most recent call last):

File "/app/src/server/services/download_service.py", line 716, in _process_queue

await self._progress_service.update_progress(

File "/app/src/server/services/progress_service.py", line 369, in update_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found

2026-03-11 15:15:45 [info ] Queue processing completed - all items processed

ERROR: Task exception was never retrieved

future: <Task finished name='Task-16373' coro=<DownloadService._process_queue() done, defined at /app/src/server/services/download_service.py:688> exception=ProgressServiceError("Progress with id 'download_queue' not found")>

Traceback (most recent call last):

File "/app/src/server/services/download_service.py", line 755, in _process_queue

await self._progress_service.complete_progress(

File "/app/src/server/services/progress_service.py", line 446, in complete_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found

2026-03-11 15:15:46 [info ] Queue processing completed - all items processed

ERROR: Task exception was never retrieved

future: <Task finished name='Task-16313' coro=<DownloadService._process_queue() done, defined at /app/src/server/services/download_service.py:688> exception=ProgressServiceError("Progress with id 'download_queue' not found")>

Traceback (most recent call last):

File "/app/src/server/services/download_service.py", line 755, in _process_queue

await self._progress_service.complete_progress(

File "/app/src/server/services/progress_service.py", line 446, in complete_progress

raise ProgressServiceError(

src.server.services.progress_service.ProgressServiceError: Progress with id 'download_queue' not found