Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
3.2 KiB
Implementation Plan: backend-test-coverage
Branch: [test-coverage-t3-t4] | Date: 2026-02-04 | Spec: N/A
Input: Continuation of test coverage tasks (T3/T4) from prior session; no feature spec.
Summary
Complete backend service test coverage for content access policies (T3) and superadmin write operations (T4), ensuring existing behavior is validated without altering production logic.
Technical Context
Language/Version: Go 1.x (project standard)
Primary Dependencies: Fiber, GORM-Gen, Testify
Storage: PostgreSQL (via GORM)
Testing: go test (service tests under backend/app/services/*_test.go)
Target Platform: Linux server
Project Type: Web application (frontend + backend)
Performance Goals: N/A (test-only changes)
Constraints: No changes to generated files; keep tests aligned with existing service patterns
Scale/Scope: Backend service tests only (no frontend scope)
Constitution Check
- Follow
backend/llm.txtfor backend conventions. - Keep controllers thin; service tests only (no controller edits).
- Avoid editing generated files (
routes.gen.go,docs.go). - Run
go testfor impacted service packages.
Project Structure
Documentation (this feature)
specs/[###-feature]/
└── (not used for this task)
Source Code (repository root)
backend/
├── app/
│ ├── services/
│ │ ├── content_test.go
│ │ └── super_test.go
└── app/http/v1/dto/
└── content.go
Structure Decision: Web application structure; scope is backend service tests in backend/app/services.
Plan Phases
- Inspect DTO definitions used by content tests to fix T3 assertions.
- Implement remaining content access policy tests (T3) and verify via
go test. - Implement superadmin write operation tests (T4) and verify via
go test.
Tasks
- Read
backend/app/http/v1/dto/content.goand update T3 test assertions to match actual DTO fields. - Extend
backend/app/services/content_test.gowith missing content access policy cases and run targeted tests. - Extend
backend/app/services/super_test.gofor superadmin write operations; run service test suite. - Verify all added tests pass without modifying production logic.
Dependencies
- Task 1 must complete before Task 2 (DTO fields drive assertions).
- Task 2 should complete before Task 3 to isolate failures.
Acceptance Criteria
backend/app/services/content_test.gohas passing T3 coverage for unauthenticated access constraints.backend/app/services/super_test.goincludes T4 coverage for create-tenant side effects and superadmin write operations.go test ./backend/app/services/...passes.- No generated files modified.
Risks
- DTO field changes may require adjusting test assertions; mitigate by verifying struct definitions.
- Service behavior may differ from assumptions in prior session; mitigate by aligning with existing tests.
Complexity Tracking
Fill ONLY if Constitution Check has violations that must be justified
| Violation | Why Needed | Simpler Alternative Rejected Because |
|---|---|---|
| N/A | N/A | N/A |