Skip to content

Commit 5979e64

Browse files
committed
Compile against latest unison
1 parent b23e0b7 commit 5979e64

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

share-api/src/Share/Web/UCM/Sync/Impl.hs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import Share.Web.Errors
5252
import Share.Web.UCM.Sync.HashJWT qualified as HashJWT
5353
import Share.Web.UCM.Sync.Types (EntityBunch (..), RepoInfoKind (..), entityKind)
5454
import U.Codebase.Causal qualified as Causal
55-
import U.Codebase.Sqlite.HashHandle qualified as HH
5655
import U.Codebase.Sqlite.Orphans ()
5756
import Unison.Codebase.Path qualified as Path
5857
import 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))
402401
batchValidateEntities 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)
414413
validateEntity 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

share-task-runner/src/Share/Tasks/AmbiguousComponentCheck.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Share.Postgres.Cursors qualified as PG
88
import Share.Prelude
99
import Share.Utils.Logging (Loggable (..))
1010
import Share.Utils.Logging qualified as Logging
11-
import U.Codebase.Sqlite.HashHandle qualified as HH
1211
import U.Codebase.Sqlite.TempEntity
1312
import Unison.Hash32
1413
import Unison.Sync.EntityValidation qualified as EV
@@ -18,7 +17,7 @@ import Unison.Util.Servant.CBOR qualified as CBOR
1817

1918
data AmbiguousComponentCheckError
2019
= TaskAmbiguousComponentCheckError Hash32
21-
| TaskEntityValidationError Hash32 (Either HH.HashingFailure Sync.EntityValidationError)
20+
| TaskEntityValidationError Hash32 (Sync.EntityValidationError)
2221
| TaskEntityDecodingError Hash32 CBOR.DeserialiseFailure
2322
deriving (Show, Eq)
2423

0 commit comments

Comments
 (0)