Enhancement Description
Add unit and workflow tests for upgrade logic to reach 80%+ coverage and reduce risk in the highest-impact path.
Background
Upgrade workflow contains critical operations (propose/vote/switch/execute/resume) with 0% test coverage, increasing regression risk and making refactoring unsafe.
Scope
Introduce mocks/fakes for upgrade dependencies
- Files: internal/application/upgrade/** (tests)
- Files: internal/application/ports/** (mock interfaces as needed)
Add test suites
- Happy path workflows (10)
- Error injection tests (15): RPC failures, timeouts, state corruption
- State transition tests (10): valid/invalid transitions
- Resume tests (12): resume from each stage
Target packages
- Files: internal/application/upgrade/**
Non-Goals
- Refactoring upgrade logic solely to improve testability (keep changes minimal)
- Expanding test coverage for unrelated packages in same PR
- End-to-end network integration tests that require real chains (unless already available)
Risks and Open Questions
- Mock fidelity: tests must reflect real sequencing and failure modes
- Resume/state persistence logic must be validated carefully to avoid false confidence
- Tests must remain stable and not rely on timing-sensitive behavior
Validation Plan
Unit and Integration Checks
- go test ./... with focus on internal/application/upgrade
- Coverage check for upgrade package (target 80%+)
- Deterministic unit tests with controlled fakes (no sleeps)
End-to-End Checks
- If CI supports: run a lightweight upgrade smoke in a sandbox environment
- Validate resume from a persisted state artifact (fixture-based)
Evidence Required in Issue Updates
- Coverage report output for internal/application/upgrade
- Logs or assertions demonstrating resume from each stage
- Failure injection evidence (expected errors and preserved state)
Acceptance Criteria
- internal/application/upgrade coverage ≥ 80%
- 50+ test cases across the categories
- All state transitions and resume stages covered
- Tests run deterministically and in parallel where possible
Deliverables
- PR adding upgrade mocks/fakes and test suites
- Documentation notes describing test strategy and fixtures
Enhancement Description
Add unit and workflow tests for upgrade logic to reach 80%+ coverage and reduce risk in the highest-impact path.
Background
Upgrade workflow contains critical operations (propose/vote/switch/execute/resume) with 0% test coverage, increasing regression risk and making refactoring unsafe.
Scope
Introduce mocks/fakes for upgrade dependencies
Add test suites
Target packages
Non-Goals
Risks and Open Questions
Validation Plan
Unit and Integration Checks
End-to-End Checks
Evidence Required in Issue Updates
Acceptance Criteria
Deliverables