fix: type DatabaseError on pure-save and SQL/Pg store adapters - #854
Merged
Conversation
queryAndSavePure / saveManyWithPure / byIdAndSaveWithPure and extended save/remove helpers declare DatabaseError from saveAndPublish and query instead of erasing it. SQL and Pg runtime exec/bulkSet map SqlError to typed DatabaseError (preserve OCC by _tag). Repository request resolver includes DatabaseError. Vue withDataFallback accepts useAtomValue's Readonly Ref without an illegal ComputedRef cast. Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Callers that need ComputedRef wrap useAtomValue first; restoring identity preserves the documented no-options contract and tests. Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@effect-app/cli
effect-app
@effect-app/eslint-codegen-model
@effect-app/eslint-shared-config
@effect-app/infra
@effect-app/vue
@effect-app/vue-components
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Scanner production saw SchemaError
"Expected InvalidStateError, got DatabaseError"because durable activities only allowedInvalidStateErrorwhile store adapters raise typedDatabaseError. App code can map/retry, but pure-save helpers omittedDatabaseErrorfrom their type channel (and SQL/Pg bulk paths stillorDie'd), so the failure was erased at compile time and only appeared at runtime.What
Repository/ext.ts:queryAndSavePure,saveManyWithPure,byIdAndSaveWithPure, extendedsave()/ remove helpers, and repositoryrequestdeclareDatabaseErrorexecandbulkSetInternalmap SqlError →DatabaseErrorwith cause; preserve OCC/DatabaseErrorby_tag(notinstanceof); seed/DDL remainorDieuseAtomValueisReadonly<Ref>— wrap at call site;withDataFallbackkeeps no-options identity (tests)How
Store adapters that fail with
DatabaseErrorexpose it on runtime paths; pure-save is query + pure +saveAndPublishand must not erase the channel. Callers with narrow activity error schemas fail compile until they map ororDieresidualDatabaseError.Remarks
Companion scanner PR: https://github.com/macs-holding/scanner/pull/2178 (durability + residual mapping; ships unlinked against registry until this publishes).
Co-authored-by: Patrick Roza 42661+patroza@users.noreply.github.com
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.