-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
This is a list of required implementations to mitigate risks introduced by the changes in pr #581.
1. Analytics Package Refactor
- Replace global state with an interface-based design. Define
AnalyticsStore
interface and inject it where needed. - Replace single global mutex with fine-grained locks or
sync.RWMutex
where appropriate. - Add
context.Context
parameters to all public analytics methods and enforce timeout/cancellation. - Add concurrent access unit tests with
-race
flag to verify thread safety.
2. Duration Type Validation
- Implement validation for
TimeDuration
(e.g., must be >= 0 and within max int64 range). - Add explicit error returns on invalid JSON unmarshaling instead of silent failure.
- Write unit tests for negative values, overflow scenarios, and JSON round-trips.
3. Backward Compatibility
- Add migration code that can read both old
time.Duration
values and newint64
TimeDuration
. - Write tests that serialize old data and ensure it still deserializes correctly with the new types.
- Document these changes in
CHANGELOG.md
.
4. Client & Swagger Updates
- Add backward compatibility layer for previous import paths by creating deprecated aliases.
- Verify all transport settings and explicitly set connection pooling and timeout defaults.
- Write integration tests against the new client to ensure no regressions.
5. CI & Infrastructure Hardening
- Add retry logic for MongoDB startup and test phases.
- Write tests for cache cleanup to ensure parallel workflows are unaffected.
- Benchmark caching strategy and document improvements in
.github/workflows/README.md
.
6. Code Quality & Documentation
- Add GoDoc comments for all new public methods and types, especially around duration units.
- Add benchmarks for mutex contention in analytics and type conversion for duration.
- Add
Makefile
targets for load tests and concurrency tests.
7. Final Validation
- Run all tests with
-race
and benchmark suite. - Add any missing tests identified by coverage report.
- Ensure CI pipelines pass with new caching and MongoDB setup.
Metadata
Metadata
Assignees
Labels
No labels