@@ -52,7 +52,6 @@ import Share.Web.Errors
5252import Share.Web.UCM.Sync.HashJWT qualified as HashJWT
5353import Share.Web.UCM.Sync.Types (EntityBunch (.. ), RepoInfoKind (.. ), entityKind )
5454import U.Codebase.Causal qualified as Causal
55- import U.Codebase.Sqlite.HashHandle qualified as HH
5655import U.Codebase.Sqlite.Orphans ()
5756import Unison.Codebase.Path qualified as Path
5857import Unison.Hash32 (Hash32 )
@@ -260,11 +259,11 @@ insertEntitiesToCodebase codebase entities = do
260259 mayErrs <- PG. transactionUnsafeIO $ batchValidateEntities maxParallelismPerUploadRequest isComponentHashMismatchAllowedIO isCausalHashMismatchAllowedIO unsavedEntities
261260 case mayErrs of
262261 Nothing -> pure ()
263- Just (err :| _errs) ->
264- case err of
265- Right e -> throwError e
266- Left (HH. IncompleteElementOrderingError ( ComponentHash hash) ) ->
267- throwError $ Sync. InvalidByteEncoding (Hash32. fromHash hash) Sync. TermComponentType " Incomplete element ordering in term components"
262+ Just (err :| _errs) -> throwError err
263+ -- case err of
264+ -- Right e -> throwError e
265+ -- Left () ->
266+ -- throwError $ Sync.InvalidByteEncoding (Hash32.fromHash hash) Sync.TermComponentType "Incomplete element ordering in term components"
268267 SyncQ. saveTempEntities codebase unsavedEntities
269268 let hashesNowInTemp = Set. fromList (fst <$> Foldable. toList unsavedEntities) <> (Set. fromList . Foldable. toList $ hashesAlreadyInTemp)
270269 pure hashesNowInTemp
@@ -398,7 +397,7 @@ batchValidateEntities ::
398397 (ComponentHash -> ComponentHash -> IO Bool ) ->
399398 (CausalHash -> CausalHash -> IO Bool ) ->
400399 f (Hash32 , Sync. Entity Text Hash32 Hash32 ) ->
401- IO (Maybe (NonEmpty ( Either HH. HashingFailure Sync. EntityValidationError) ))
400+ IO (Maybe (NonEmpty Sync. EntityValidationError ))
402401batchValidateEntities maxParallelism checkIfComponentHashMismatchIsAllowed checkIfCausalHashMismatchIsAllowed entities = do
403402 errs <- UnliftIO. pooledForConcurrentlyN maxParallelism entities \ (hash, entity) ->
404403 validateEntity checkIfComponentHashMismatchIsAllowed checkIfCausalHashMismatchIsAllowed hash entity
@@ -410,16 +409,16 @@ validateEntity ::
410409 (CausalHash -> CausalHash -> m Bool ) ->
411410 Hash32 ->
412411 Share. Entity Text Hash32 Hash32 ->
413- m (Maybe ( Either HH. HashingFailure Sync. EntityValidationError) )
412+ m (Maybe Sync. EntityValidationError )
414413validateEntity checkIfComponentHashMismatchIsAllowed checkIfCausalHashMismatchIsAllowed hash entity = do
415414 case (Sync. validateEntity hash entity) of
416- Just (Right ( err@ (Sync. EntityHashMismatch Sync. TermComponentType (Sync. HashMismatchForEntity {supplied = expectedHash, computed = actualHash}) ))) ->
415+ Just (err@ (Sync. EntityHashMismatch Sync. TermComponentType (Sync. HashMismatchForEntity {supplied = expectedHash, computed = actualHash}))) ->
417416 checkIfComponentHashMismatchIsAllowed (ComponentHash . Hash32. toHash $ expectedHash) (ComponentHash . Hash32. toHash $ actualHash) >>= \ case
418- False -> pure (Just $ Right err)
417+ False -> pure (Just err)
419418 True -> pure Nothing
420- Just (Right ( err@ (Sync. EntityHashMismatch Sync. CausalType (Sync. HashMismatchForEntity {supplied = expectedHash, computed = actualHash}) ))) ->
419+ Just (err@ (Sync. EntityHashMismatch Sync. CausalType (Sync. HashMismatchForEntity {supplied = expectedHash, computed = actualHash}))) ->
421420 checkIfCausalHashMismatchIsAllowed (CausalHash . Hash32. toHash $ expectedHash) (CausalHash . Hash32. toHash $ actualHash) >>= \ case
422- False -> pure (Just $ Right err)
421+ False -> pure (Just err)
423422 True -> pure Nothing
424423 Just err ->
425424 -- This shouldn't happen unless the ucm client is buggy or malicious
0 commit comments