-
Notifications
You must be signed in to change notification settings - Fork 884
Description
Is your feature request related to a problem? Please describe.
Currently, the timeSrc field is being handled at the DB layer, but this implementation has raised some concerns about its correctness and responsibility allocation. Specifically, the timestamp should ideally be determined at the PersistenceManager level rather than the DB layer, which should solely focus on translating entity records into database queries without adding additional logic.
Problem Statement
The timeSrc field is currently being used within the DB layer to determine timestamps, including during query generation.
While this approach enables unit test validation by replacing time.Now() with a mockable db.timeSrc.Now(), it introduces a mixing of responsibilities.
The proper handling of timestamps should occur at the PersistenceManager level, ensuring better separation of concerns and adherence to the single responsibility principle.
Proposed Solution
Refactor the system so that the PersistenceManager level handles the timeSrc field.
The DB layer should only translate entity records into database queries without modifying or adding any additional information like timestamps.
This would involve removing the timestamp logic from the DB layer and ensuring it is fully managed by the upper layers.
Additional context
See discussion in this PR: #6593