fix: refuse a temporal read or write the data layer cannot serve. - #2922
fix: refuse a temporal read or write the data layer cannot serve.#2922matt-beanland wants to merge 1 commit into
Conversation
08dd33c to
90180fc
Compare
|
amended to generalise some comments and error messages |
| end | ||
|
|
||
| # The runtime counterpart of `Ash.Resource.Verifiers.ValidateTemporal`. | ||
| defp refuse_unserved_temporal(changeset) do |
There was a problem hiding this comment.
why do we need a runtime component of this?
There was a problem hiding this comment.
How could you get here if the app won't compile otherwise?
There was a problem hiding this comment.
Distributed/embedded systems where code compiled on one system and running on another.
Also where db version / temporal capability is runtime configuration or license gated.
There was a problem hiding this comment.
Where does that happen in practice? It would mean that all things that we validate at compile time have to also be validated at runtime, which is not a position we hold.
There was a problem hiding this comment.
Yes with PG needs PG19 and also btree_gist configuration, allows gate to check. Depends on people's deployment scenarios I guess.
I understand wider implications for other capability checks and that you may prefer to just let the data layer overclaim in this scenario rather than establish a precedent.
There was a problem hiding this comment.
Yes but the user configures those things in their repo with min_pg_version and extensions. So we know this information at compile time.
Contributor checklist
Summary
The verifier
ValidateTemporalrequirescan?(:temporal, ..)for a given resource to compile, however the checks at runtime are bugged or missing.This is a PR without an issue as currently temporal data layers must claim
can?(:temporal, ..)trueotherwiseas_of(instant)is silently dropped.The fix checks the datalayer's capability ahead of all reads and writes, granting the datalayer the ability to safely refuse temporal for instance when the underlying database lacks temporal capability or configuration.