mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 01:41:34 +00:00
This commit consolidates all outstanding tasks from `TODO.md`, `BUILD_ISSUES.md`, and inline `TODO` comments into a single `TASKS.md` file. This new file serves as the single source of truth for all pending development work, categorized by priority. The task list has been enhanced with additional context, linking tasks to the architectural vision in `refactor.md` and making them more actionable for developers. The following legacy files have been removed to avoid confusion: - `TODO.md` - `BUILD_ISSUES.md` The `AGENTS.md` file has also been updated to remove a temporary debug log and now directs agents to the new `TASKS.md` file for guidance.
5.1 KiB
5.1 KiB
Consolidated Tasks for Tercul
This document is the single source of truth for all outstanding development tasks, aligned with the architectural vision in refactor.md.
Urgent: Build Failures
These issues are currently breaking the build and must be resolved before any other work can proceed. They are all related to the ongoing refactor, where repositories are being replaced by application services. The r.App object in the resolver does not have direct repository access anymore.
- Fix Resolver Build Errors in
internal/adapters/graphql/schema.resolvers.go:line 10: Remove the unused "log" import.lines 1071, 1073: Replacer.App.AuthorRepocalls with the appropriate application service method (e.g.,r.App.Authors.FindByID).line 1089: Correct the call tor.App.Localization.GetAuthorBiographyas the method does not exist. The correct service and method must be identified.lines 1141, 1143: Replacer.App.UserRepocalls with the correct user application service method.lines 1212, 1225: Replacer.App.TagRepocalls with the correct tag application service method.lines 1249, 1262: Replacer.App.CategoryRepocalls with the correct category application service method.
High Priority
Architecture & Refactoring (see refactor.md)
- Implement Full Observability:
- Centralized Logging: Ensure all services use the structured
zerologlogger frominternal/platform/log. Add request/user/span IDs to the logging context in the HTTP middleware. - Metrics: Add Prometheus metrics for API request latency, error rates, and database query performance. Expose them on the
/metricsendpoint. - Tracing: Instrument all application services and data layer methods with OpenTelemetry tracing.
- Centralized Logging: Ensure all services use the structured
- Establish CI/CD Pipeline:
- CI: Create a
Makefiletargetlint-testthat runsgolangci-lintandgo test ./.... Configure the CI pipeline to run this on every push. - CD: Set up automated deployments to a staging environment upon a successful merge to the main branch.
- CI: Create a
- Refactor Testing Utilities:
- Decouple from DB: Remove all database connection logic from
internal/testutil/testutil.go. Tests should use mock repositories and services, not a live database. This is a key step towards faster, more reliable unit tests.
- Decouple from DB: Remove all database connection logic from
Features
-
Implement Analytics Features:
- Context: This is required for user engagement insights. The following counts need to be implemented and stored, likely on the
WorkandTranslationmodels. - Implement view counting.
- Implement like counting.
- Implement comment counting.
- Implement bookmark counting.
- Implement translation counting.
- Implement a service to calculate popular translations based on the above metrics.
- Note: This is referenced in the old
TODO.mdand a TODO comment ininternal/jobs/linguistics/work_analysis_service.go.
- Context: This is required for user engagement insights. The following counts need to be implemented and stored, likely on the
-
Complete Unfinished Implementations:
internal/app/work/commands.go: Implement theMergeWorkcommand. This should handle merging duplicate work entries.internal/app/search/service.go: The search service needs to fetch content from the translation service to enrich its search index.cmd/tools/enrich/main.go: This command-line tool is broken. It needs to be investigated, fixed, and documented.
Medium Priority
Performance
- Batch Weaviate Operations: Refactor the Weaviate client in
internal/platform/searchto support batching of create/update operations to improve indexing performance. - Add Performance Benchmarks: Using Go's built-in benchmarking tools, add benchmarks for critical API queries and commands to detect performance regressions.
Code Quality & Architecture
- Expand Weaviate Client: The client in
internal/platform/searchshould be extended to support indexing all relevant domain models (e.g., Authors, Tags). - Add Documentation: Add GoDoc comments to all public functions and types in the
internal/appandinternal/domainpackages. - Refactor Caching: As per
refactor.md, replace the current bespoke cached repositories with a decorator pattern ininternal/data/cache. This will simplify cache invalidation logic. - Improve Configuration Handling: Replace the global config object with struct-based configuration loaded from environment variables (e.g., using
koanforenvconfig), as outlined inrefactor.md.
Monitoring & Logging
- Add Job Monitoring: Add specific monitoring and alerting for background jobs in
internal/jobsto track success, failure, and duration. - Add Linguistics Metrics: Add Prometheus metrics for the linguistics pipeline, including analysis duration, cache hit/miss rates, and third-party API usage.
Low Priority
- Refactor Transactional Runner: Refactor the
RunTransactionalhelper ininternal/testutil/testutil.goto be more friendly to mock-based testing, likely by allowing a mock DB transaction to be passed in.