Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPB-5175] upgrade to ghc 9.4 #3679

Merged
merged 35 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c108bbd
[feat] upgrade nixpkgs to upgrade hls and the hs pkg-set
MangoIV Oct 13, 2023
fbeca69
[chore] add changelog entry
MangoIV Oct 13, 2023
7990874
[fix] fix compile errors
MangoIV Oct 13, 2023
6b6497d
[fix] pin ormolu
MangoIV Oct 14, 2023
447b4cc
[chore] appease hlint
MangoIV Oct 14, 2023
52be7bb
[fix] set numStripes to 1
MangoIV Oct 16, 2023
f6c0d75
[fix] don't use Hashable for hashes that are supposed to be stable
MangoIV Oct 16, 2023
0c0ea75
[feat] replicate the behaviour of the old test in the new testsuite
MangoIV Oct 17, 2023
86cd4af
[feat] finish porting over the test from the old to the new testsuite
MangoIV Oct 18, 2023
6bd5be1
[fix] apply suggestions by Paolo
MangoIV Oct 18, 2023
d6e69d9
[fix] fix behaviour of the cleanup function within `withResource`
MangoIV Oct 23, 2023
06ae50e
[fix] don't check the trailing dot test in nix tests
MangoIV Oct 24, 2023
a809b68
[fix] restore consumeMessage1
MangoIV Oct 30, 2023
52ead1f
[fix] revert the nom change
MangoIV Nov 2, 2023
9709c6d
[feat] upgrade nixpkgs to upgrade hls and the hs pkg-set
MangoIV Oct 13, 2023
071dcca
[fix] don't use Hashable for hashes that are supposed to be stable
MangoIV Oct 16, 2023
b3e3a4d
[fix] apply suggestions by Paolo
MangoIV Oct 18, 2023
c8ccac6
[fix] revert the nom change
MangoIV Nov 2, 2023
dd387cd
[fix] don't check the trailing dot test in nix tests
MangoIV Oct 24, 2023
275f0eb
[wip] update to ghc 9.4.7
MangoIV Oct 23, 2023
639870b
[fix] fix the test-suite such that we don't react on proposals
MangoIV Oct 31, 2023
418856c
[feat] fix issue with swagger typechecking
MangoIV Oct 31, 2023
b83fba4
[chore] add changelog.d entry
MangoIV Nov 1, 2023
b03792a
[chore] switch to wire upstream text-icu-translit
MangoIV Nov 1, 2023
42ae7f9
[feat] update nixpkgs again
MangoIV Nov 1, 2023
aeb53bd
[fix] fix docs (python was mad), remove ormolu hack
MangoIV Nov 2, 2023
8c9a3a2
[chore] apply formatting (because ormolu changes are somehow always
MangoIV Nov 2, 2023
fc5d08c
[fix] import `fromMaybe` (I guess it got removed when rebasing)
MangoIV Nov 2, 2023
237fc8e
[chore] appease hlint
MangoIV Nov 5, 2023
01470fe
[fix] fix typo
MangoIV Nov 6, 2023
2957fac
[fix] remove left ober traceIO
MangoIV Nov 6, 2023
a4289f1
Merge remote-tracking branch 'origin/develop' into mangoiv/upgrade-to-94
MangoIV Nov 7, 2023
1a742d6
[fix] s/consumeMessage1/mlsCliConsume
MangoIV Nov 9, 2023
70b2add
[fix] hi ci
MangoIV Nov 12, 2023
a6100d3
[fix] apply changes asked for by Paolo and Akshay
MangoIV Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,14 @@ package zauth
ghc-options: -Werror
package fedcalls
ghc-options: -Werror

-- NOTE:
-- - these packages are not provided by nix, reason being, that
-- there is a bug in the nixpkgs haskell compatibility which
-- makes it such that they cannot be installed by the nixpkgs code
-- - these packages have bounds that are justified with their current
-- dependency set, however, we have updated their dependencies, such
-- that they work with newer base and ghc (api) versions
allow-newer:
, proto-lens-protoc:base
, proto-lens-protoc:ghc
1 change: 1 addition & 0 deletions changelog.d/5-internal/WPB-5175
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
upgrade the GHC version to GHC 9.4
2 changes: 1 addition & 1 deletion hack/bin/generate-local-nix-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ROOT_DIR=$(cd -- "$SCRIPT_DIR/../../" &> /dev/null && pwd)
cabalFiles=$(find -L "$ROOT_DIR" -name '*.cabal' \
cabalFiles=$(find "$ROOT_DIR" -name '*.cabal' \
| grep -v dist-newstyle | sort)

warningFile=$(mktemp)
Expand Down
8 changes: 3 additions & 5 deletions integration/test/Testlib/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Testlib.App where
import Control.Monad.Reader
import Control.Retry qualified as Retry
import Data.Aeson hiding ((.=))
import Data.Functor ((<&>))
import Data.IORef
import Data.Text qualified as T
import Data.Yaml qualified as Yaml
Expand Down Expand Up @@ -43,10 +42,9 @@ readServiceConfig = readServiceConfig' . configName

readServiceConfig' :: String -> App Value
readServiceConfig' srvName = do
cfgFile <-
asks (.servicesCwdBase) <&> \case
Nothing -> "/etc/wire" </> srvName </> "conf" </> (srvName <> ".yaml")
Just p -> p </> srvName </> (srvName <> ".integration.yaml")
cfgFile <- asks \env -> case env.servicesCwdBase of
Nothing -> "/etc/wire" </> srvName </> "conf" </> (srvName <> ".yaml")
Just p -> p </> srvName </> (srvName <> ".integration.yaml")

eith <- liftIO (Yaml.decodeFileEither cfgFile)
case eith of
Expand Down
3 changes: 1 addition & 2 deletions integration/test/Testlib/HTTP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Data.ByteString.Char8 qualified as C8
import Data.ByteString.Lazy qualified as L
import Data.CaseInsensitive qualified as CI
import Data.Function
import Data.Functor ((<&>))
import Data.List
import Data.List.Split (splitOn)
import Data.Maybe
Expand Down Expand Up @@ -173,7 +172,7 @@ locationHeaderHost :: Response -> String
locationHeaderHost resp =
let location = C8.unpack . snd . fromJust $ locationHeader resp
locationURI = fromJust $ parseURI location
locationHost = fromJust $ locationURI & uriAuthority <&> uriRegName
locationHost = uriRegName (fromJust (locationURI & uriAuthority))
in locationHost

locationHeader :: Response -> Maybe (HTTP.HeaderName, ByteString)
Expand Down
4 changes: 2 additions & 2 deletions integration/test/Testlib/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Data.Foldable
import Data.Function
import Data.Functor
import Data.List.Split (splitOn)
import Data.Maybe
import Data.Maybe (fromMaybe)
import Data.Scientific qualified as Sci
import Data.String
import Data.Text qualified as T
Expand Down Expand Up @@ -287,7 +287,7 @@ printJSON = prettyJSON >=> liftIO . putStrLn

prettyJSON :: MakesValue a => a -> App String
prettyJSON x =
make x <&> Aeson.encodePretty <&> LC8.unpack
make x <&> LC8.unpack . Aeson.encodePretty

jsonType :: Value -> String
jsonType (Object _) = "Object"
Expand Down
17 changes: 8 additions & 9 deletions integration/test/Testlib/ModService.hs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ startProcess' domain execName config = do
tempFile <- liftIO $ writeTempFile "/tmp" (execName <> "-" <> domain <> "-" <> ".yaml") (cs $ Yaml.encode config)

(cwd, exe) <-
asks (.servicesCwdBase) <&> \case
asks \env -> case env.servicesCwdBase of
Nothing -> (Nothing, execName)
Just dir ->
(Just (dir </> execName), "../../dist" </> execName)
Expand Down Expand Up @@ -545,14 +545,13 @@ server 127.0.0.1:{port} max_fails=3 weight=1;
(serviceName Spar, sm.spar.port),
("proxy", sm.proxy.port)
]
( \case
(srv, p) -> do
let upstream =
upstreamTemplate
& Text.replace "{name}" (cs $ srv)
& Text.replace "{port}" (cs $ show p)
liftIO $ appendFile upstreamsCfg (cs upstream)
)
\case
(srv, p) -> do
let upstream =
upstreamTemplate
& Text.replace "{name}" (cs $ srv)
& Text.replace "{port}" (cs $ show p)
liftIO $ appendFile upstreamsCfg (cs upstream)

startNginz :: String -> FilePath -> FilePath -> App ProcessHandle
startNginz domain conf workingDir = do
Expand Down
7 changes: 3 additions & 4 deletions integration/test/Testlib/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ createGlobalEnv cfg = do
liftIO . runAppWithEnv env $ do
config <- readServiceConfig Galley
relPath <- config %. "settings.mlsPrivateKeyPaths.removal.ed25519" & asString
path <-
asks (.servicesCwdBase) <&> \case
Nothing -> relPath
Just dir -> dir </> "galley" </> relPath
path <- asks \env' -> case env'.servicesCwdBase of
Nothing -> relPath
Just dir -> dir </> "galley" </> relPath
bs <- liftIO $ B.readFile path
pems <- case pemParseBS bs of
Left err -> assertFailure $ "Could not parse removal key PEM: " <> err
Expand Down
2 changes: 1 addition & 1 deletion libs/http2-manager/http2-manager.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ library
default-language: Haskell2010

flag test-trailing-dot
description: "Whether or not include the trainling dot test"
description: "Whether or not include the trailing dot test"
default: True

test-suite http2-manager-tests
Expand Down
12 changes: 9 additions & 3 deletions libs/schema-profunctor/src/Data/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ instance HasOpt doc => FieldFunctor doc Maybe where

-- | A schema for a one-field JSON object.
field ::
forall doc' doc a b.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are explicit foralls necessary now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to scope the type variables to be able to use type applications. I'm not sure what change in GHC caused this. Perhaps it had something to do with the Deepsubsumption change

HasField doc' doc =>
Text ->
SchemaP doc' A.Value A.Value a b ->
Expand All @@ -304,6 +305,7 @@ field = fieldOver id

-- | A schema for a JSON object with a single optional field.
optField ::
forall doc doc' a b.
(HasOpt doc, HasField doc' doc) =>
Text ->
SchemaP doc' A.Value A.Value a b ->
Expand All @@ -312,6 +314,7 @@ optField = fieldF

-- | Generalization of 'optField' with 'FieldFunctor'.
fieldF ::
forall doc' doc f a b.
(HasField doc' doc, FieldFunctor doc f) =>
Text ->
SchemaP doc' A.Value A.Value a b ->
Expand Down Expand Up @@ -362,32 +365,35 @@ fieldOver l name = fmap runIdentity . fieldOverF l name
-- | Like 'field', but apply an arbitrary function to the
-- documentation of the field.
fieldWithDocModifier ::
forall doc' doc a b.
HasField doc' doc =>
Text ->
(doc' -> doc') ->
SchemaP doc' A.Value A.Value a b ->
SchemaP doc A.Object [A.Pair] a b
fieldWithDocModifier name modify sch = field name (over doc modify sch)
fieldWithDocModifier name modify sch = field @doc' @doc name (over doc modify sch)
MangoIV marked this conversation as resolved.
Show resolved Hide resolved

-- | Like 'optField', but apply an arbitrary function to the
-- documentation of the field.
optFieldWithDocModifier ::
forall doc doc' a b.
(HasOpt doc, HasField doc' doc) =>
Text ->
(doc' -> doc') ->
SchemaP doc' A.Value A.Value a b ->
SchemaP doc A.Object [A.Pair] a (Maybe b)
optFieldWithDocModifier name modify sch = optField name (over doc modify sch)
optFieldWithDocModifier name modify sch = optField @doc @doc' name (over doc modify sch)

-- | Like 'fieldF', but apply an arbitrary function to the
-- documentation of the field.
fieldWithDocModifierF ::
forall doc' doc f a b.
(HasField doc' doc, FieldFunctor doc f) =>
Text ->
(doc' -> doc') ->
SchemaP doc' A.Value A.Value a b ->
SchemaP doc A.Object [A.Pair] a (f b)
fieldWithDocModifierF name modify sch = fieldF name (over doc modify sch)
fieldWithDocModifierF name modify sch = fieldF @doc' @doc name (over doc modify sch)

-- | Change the input type of a schema.
(.=) :: Profunctor p => (a -> a') -> p a' b -> p a b
Expand Down
5 changes: 3 additions & 2 deletions libs/types-common/src/Data/ETag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ import Control.Lens
-- TODO: These package imports are only needed due to the
-- use of GHCI. They should be removed by moving everything
-- from cryptohash (which is deprecated) to cryptonite
import "cryptohash-md5" Crypto.Hash.MD5 qualified as MD5
import "cryptohash-sha1" Crypto.Hash.SHA1 qualified as SHA1

import Data.Attoparsec.ByteString.Char8
import Data.ByteString.Base16 qualified as Hex
import Data.ByteString.Builder (byteString)
import Data.ByteString.Conversion
import Imports hiding (takeWhile)
import "cryptohash-md5" Crypto.Hash.MD5 qualified as MD5
import "cryptohash-sha1" Crypto.Hash.SHA1 qualified as SHA1

data Digest = MD5 | SHA1

Expand Down
2 changes: 1 addition & 1 deletion libs/types-common/src/Data/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ instance ToSchema (Fingerprint Rsa) where
p :: Chars.Parser (Fingerprint Rsa)
p = do
bs <- parser
either fail pure (Fingerprint <$> B64.decode bs)
either fail (pure . Fingerprint) (B64.decode bs)

instance Cql (Fingerprint a) where
ctype = Tagged BlobColumn
Expand Down
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/MakesFederatedCall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module Wire.API.MakesFederatedCall
Location (..),
ShowComponent,
Annotation,
exposeAnnotations,
HasFeds (..),
FedCallFrom' (..),
Calls (..),
Wire.API.MakesFederatedCall.exposeAnnotations,
)
where

Expand Down
36 changes: 18 additions & 18 deletions libs/wire-api/src/Wire/API/SwaggerHelper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ cleanupSwagger =
if "Invalid "
`T.isPrefixOf` desc
&& resp
^? _Inline
. links
== pure mempty
^? _Inline
. links
== pure mempty
&& resp
^? _Inline
. content
== pure mempty
^? _Inline
. content
== pure mempty
&& resp
^? _Inline
. headers
== pure mempty
^? _Inline
. headers
== pure mempty
then resps
else insert code resp resps
Nothing -> insert code resp resps
Expand All @@ -86,17 +86,17 @@ cleanupSwagger =
if " not found"
`T.isSuffixOf` desc
&& resp
^? _Inline
. links
== pure mempty
^? _Inline
. links
== pure mempty
&& resp
^? _Inline
. content
== pure mempty
^? _Inline
. content
== pure mempty
&& resp
^? _Inline
. headers
== pure mempty
^? _Inline
. headers
== pure mempty
then resps
else insert code resp resps
Nothing -> insert code resp resps
Expand Down
6 changes: 3 additions & 3 deletions libs/wire-api/src/Wire/API/Team/LegalHold.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ instance ToSchema LHServiceStatus where

instance ToSchema ViewLegalHoldService where
schema =
object "ViewLegalHoldService"
$ toOutput .= recordSchema
`withParser` validateViewLegalHoldService
object "ViewLegalHoldService" $
toOutput .= recordSchema
`withParser` validateViewLegalHoldService
where
toOutput :: ViewLegalHoldService -> (LHServiceStatus, Maybe ViewLegalHoldServiceInfo)
toOutput = \case
Expand Down
30 changes: 21 additions & 9 deletions nix/haskell-pins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
# 1. Update version number.
# 2. Make the 'sha256' blank string.
# 3. Run step 3. from how to add a git pin.
{ lib, fetchgit }: hself: hsuper:
{ lib, fetchgit, pkgs }: hself: hsuper:
let
gitPins = {
transitive-anns = {
src = fetchgit {
url = "https://github.com/wireapp/transitive-anns";
rev = "c3bdc423f84bf15fe8b3618b5dddd5764fc8a470";
sha256 = "sha256-mWBZ2uY0shlxNRceyC2Zu1f3Kr4IDtT/rOL7CKWgilA=";
rev = "7caf82f8d1be0f994a557e0cdc87fde8e32d5420";
sha256 = "sha256-rDIAbYpNGMBDOOE1hqLneRSVkCnj3cCQVYGKkhw8t7w=";
};
};
amazonka = {
Expand Down Expand Up @@ -214,12 +214,24 @@ let
sha256 = "sha256-+rHcS+BwEFsXqPAHX/KZDIgv9zfk1dZl0LlZJ57Com4=";
};
};
# PR: https://github.com/freckle/hspec-junit-formatter/pull/24
hspec-junit-formatter = {
src = fetchgit {
url = "https://github.com/akshaymankar/hspec-junit-formatter";
rev = "acec31822cc4f90489d9940bad23b3fd6d1d7c75";
sha256 = "sha256-4xGW3KHQKbTL+6+Q/gzfaMBP+J0npUe7tP5ZCQCB5+s=";

text-icu-translit = {
src = pkgs.fetchFromGitHub {
owner = "wireapp";
repo = "text-icu-translit";
rev = "317bbd27ea5ae4e7f93836ee9ca664f9bde7c583";
hash = "sha256-9uVqUTkLkE7U19FDjn5xt8JEHyJmosLPSnmW7kYbe5w=";
};
};

# PR at https://github.com/google/ghc-source-gen/pull/102
ghc-source-gen = {
version = "0.4.4.0";
src = pkgs.fetchFromGitHub {
owner = "circuithub";
repo = "ghc-source-gen";
rev = "7a6aac047b706508e85ba2054b5bedbecfd7eb7a";
hash = "sha256-DZu3XAOYLKcSpOYhjpb6IuXMvRHtGohTkL0nsCb/dT0=";
};
};
};
Expand Down
12 changes: 9 additions & 3 deletions nix/manual-overrides.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ libsodium, protobuf, hlib, mls-test-cli, fetchpatch }:
{ libsodium, protobuf, hlib, mls-test-cli, fetchpatch, ... }:
# FUTUREWORK: Figure out a way to detect if some of these packages are not
# actually marked broken, so we can cleanup this file on every nixpkgs bump.
hself: hsuper: {
Expand All @@ -10,7 +10,12 @@ hself: hsuper: {
url = "https://gitlab.com/twittner/cql/-/merge_requests/11.patch";
sha256 = "sha256-qfcCRkKjSS1TEqPRVBU9Ox2DjsdGsYG/F3DrZ5JGoEI=";
});
ghc-source-gen = hlib.markUnbroken (hlib.doJailbreak hsuper.ghc-source-gen);
proto-lens-protoc = hlib.doJailbreak hsuper.proto-lens-protoc;
proto-lens-setup = hlib.doJailbreak hsuper.proto-lens-setup;
hashtables = hsuper.hashtables_1_3;
# in case everything breaks with the hashable update, use this
# hashable = hsuper.callHackage "hashable" "1.4.2.0" {};
invertible = hlib.markUnbroken hsuper.invertible;
MangoIV marked this conversation as resolved.
Show resolved Hide resolved
lens-datetime = hlib.markUnbroken (hlib.doJailbreak hsuper.lens-datetime);
monoidal-containers = hlib.doJailbreak hsuper.monoidal-containers;
Expand All @@ -33,13 +38,14 @@ hself: hsuper: {
sodium-crypto-sign = hlib.addPkgconfigDepend hsuper.sodium-crypto-sign libsodium.dev;
text-icu-translit = hlib.markUnbroken (hlib.dontCheck hsuper.text-icu-translit);
text-short = hlib.dontCheck hsuper.text-short;
template = hlib.markUnbroken hsuper.template;
template = hlib.markUnbroken (hlib.doJailbreak hsuper.template);
type-errors = hlib.dontCheck hsuper.type-errors;
th-abstraction = hsuper.th-abstraction_0_5_0_0;
th-desugar = hlib.doJailbreak hsuper.th-desugar;
wai-middleware-prometheus = hlib.doJailbreak hsuper.wai-middleware-prometheus;
wai-predicates = hlib.markUnbroken hsuper.wai-predicates;

# transitive-anns has flaky tests
transitive-anns = hlib.dontCheck hsuper.transitive-anns;
http2-manager = hlib.enableCabalFlag hsuper.http2-manager "-f-test-trailing-dot";

# PR with fix: https://github.com/freckle/hspec-junit-formatter/pull/23
Expand Down
Loading
Loading