From 8fe6dd7362de8e0aab1b6eb1a394fa54135115dc Mon Sep 17 00:00:00 2001 From: Ben Price Date: Wed, 8 Nov 2023 18:51:46 +0000 Subject: [PATCH 1/2] chore!: bump primer backend, adapt to new selection info api When selecting a non-empty hole, the API now emits information about both the expected and actual types. We adapt to this change by ignoring the actual type and just displaying the expected one (this matches the behaviour with the old backend version). In a subsequent commit we will show both. BREAKING CHANGE: the API is different from the previous backend pin. Thus this version of the frontend cannot talk to the previous version of the backend and vice versa. Signed-off-by: Ben Price --- argocd/base/statefulset.yaml | 2 +- flake.lock | 134 ++++++++++-------- flake.nix | 2 +- src/components/SelectionInfo/index.tsx | 3 +- src/primer-api/model/index.ts | 5 + src/primer-api/model/okOrMismatch.ts | 11 ++ src/primer-api/model/okOrMismatchOneOf.ts | 14 ++ src/primer-api/model/okOrMismatchOneOfTag.ts | 15 ++ .../model/okOrMismatchOneOfThree.ts | 15 ++ .../model/okOrMismatchOneOfThreeTag.ts | 15 ++ src/primer-api/model/typeOrKindOneOf.ts | 4 +- src/primer-api/model/typeOrKindOneOfThree.ts | 4 +- 12 files changed, 159 insertions(+), 65 deletions(-) create mode 100644 src/primer-api/model/okOrMismatch.ts create mode 100644 src/primer-api/model/okOrMismatchOneOf.ts create mode 100644 src/primer-api/model/okOrMismatchOneOfTag.ts create mode 100644 src/primer-api/model/okOrMismatchOneOfThree.ts create mode 100644 src/primer-api/model/okOrMismatchOneOfThreeTag.ts diff --git a/argocd/base/statefulset.yaml b/argocd/base/statefulset.yaml index 7bbb1bb4..6b0d3415 100644 --- a/argocd/base/statefulset.yaml +++ b/argocd/base/statefulset.yaml @@ -26,7 +26,7 @@ spec: # Note: use the *dev* version of the package here, so that # PRs can deploy `primer-service` container images that have # not yet been merged to `primer` `main`. - image: ghcr.io/hackworthltd/primer-service-dev:git-2bf2349473b60fc6a99e9a553dcd1b0fd9d54b5f + image: ghcr.io/hackworthltd/primer-service-dev:git-96236936906694bacf62c52cb718ba73e77c50ee ports: - containerPort: 8081 env: diff --git a/flake.lock b/flake.lock index daa9db77..d601fd1b 100644 --- a/flake.lock +++ b/flake.lock @@ -150,11 +150,11 @@ "flake-compat_5": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -166,11 +166,11 @@ "flake-compat_6": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -269,11 +269,11 @@ "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { - "lastModified": 1693611461, - "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", "type": "github" }, "original": { @@ -287,11 +287,11 @@ "nixpkgs-lib": "nixpkgs-lib_4" }, "locked": { - "lastModified": 1693611461, - "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", "type": "github" }, "original": { @@ -411,14 +411,14 @@ "ghc99": { "flake": false, "locked": { - "lastModified": 1693974777, - "narHash": "sha256-r+uFw44X9XVPdDtxylfBuFL+l+5q5cX+vDVT7SCTHB8=", - "ref": "hkm/bump-Cabal", - "rev": "b2bddd0b8214ac1db6239cc25f7c0aabeb2ebb70", - "revCount": 61879, + "lastModified": 1695427505, + "narHash": "sha256-j0hXl6uEI+Uwf37z3WLuQZN4S0XqGtiepELv2Gl2aHU=", + "ref": "refs/heads/master", + "rev": "b8e4fe2318798185228fb5f8214ba2384ac95b4f", + "revCount": 61951, "submodules": true, "type": "git", - "url": "https://gitlab.haskell.org/hamishmack/ghc" + "url": "https://gitlab.haskell.org/ghc/ghc" }, "original": { "submodules": true, @@ -569,11 +569,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1694823894, - "narHash": "sha256-B6gVQFZpUe+TntqifuhBOmmEAzjiRWGraVQIR1T9YGI=", + "lastModified": 1696638186, + "narHash": "sha256-h5wT7jZ3bM07ZvdTSm2j2CdX5EP0LXsk3+9x3QHEE8I=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "643f1c0424e5604b7676b5b48000ca1bc0c2d7b8", + "rev": "aa653b3c276f617aa0f61095ecbc16860c98480a", "type": "github" }, "original": { @@ -620,11 +620,11 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix_3" }, "locked": { - "lastModified": 1694821803, - "narHash": "sha256-jl3TcxkYEst8sXz1Rfp/SvRjEbcMkSAOIjPU2/AuJEw=", + "lastModified": 1696633938, + "narHash": "sha256-1eQH0S3G/eI3PTqxCw3hmLh6eOS0wQfBcsYp410Bvjc=", "owner": "hackworthltd", "repo": "hacknix", - "rev": "5c6afdb546b4f362d4e749d6d85b8dfc7389265a", + "rev": "d4ac93da22f1d83e2a264b63c6f5d615e21e46b7", "type": "github" }, "original": { @@ -648,6 +648,7 @@ "hls-1.10": "hls-1.10", "hls-2.0": "hls-2.0", "hls-2.2": "hls-2.2", + "hls-2.3": "hls-2.3", "hpc-coveralls": "hpc-coveralls", "hydra": "hydra", "iserv-proxy": "iserv-proxy", @@ -667,11 +668,11 @@ "stackage": "stackage" }, "locked": { - "lastModified": 1694825384, - "narHash": "sha256-sswi86nY4y7atyZATPIMG/pqC2kod8zfgGbUzpYA/rU=", + "lastModified": 1696639789, + "narHash": "sha256-BAmIp51KVXDwvjugNp1QbBEGqHX/Ad6n0oS/9qWvWHY=", "owner": "input-output-hk", "repo": "haskell.nix", - "rev": "a2d08de6034a838e1a276707669237933255c3bd", + "rev": "140825afb68fddce0df5873ffcc214a3f40e2524", "type": "github" }, "original": { @@ -731,6 +732,23 @@ "type": "github" } }, + "hls-2.3": { + "flake": false, + "locked": { + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.3.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, "hpc-coveralls": { "flake": false, "locked": { @@ -848,11 +866,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1694810318, - "narHash": "sha256-LuvrVj2oj9TzdnnwtQUClqcXjpgwCP01FFVBM7azGV8=", + "lastModified": 1696360011, + "narHash": "sha256-HpPv27qMuPou4acXcZ8Klm7Zt0Elv9dgDvSJaomWb9Y=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "80bb201f4925cdda5a7a3c7b1900fb26bb2af2e8", + "rev": "8b6ea26d5d2e8359d06278364f41fbc4b903b28a", "type": "github" }, "original": { @@ -923,11 +941,11 @@ ] }, "locked": { - "lastModified": 1693791338, - "narHash": "sha256-wHmtB5H8AJTUaeGHw+0hsQ6nU4VyvVrP2P4NeCocRzY=", + "lastModified": 1696058303, + "narHash": "sha256-eNqKWpF5zG0SrgbbtljFOrRgFgRzCc4++TMFADBMLnc=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "8ee78470029e641cddbd8721496da1316b47d3b4", + "rev": "150f38bd1e09e20987feacb1b0d5991357532fb5", "type": "github" }, "original": { @@ -1031,11 +1049,11 @@ }, "nixpkgs-2305": { "locked": { - "lastModified": 1690680713, - "narHash": "sha256-NXCWA8N+GfSQyoN7ZNiOgq/nDJKOp5/BHEpiZP8sUZw=", + "lastModified": 1695416179, + "narHash": "sha256-610o1+pwbSu+QuF3GE0NU5xQdTHM3t9wyYhB9l94Cd8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b81af66deb21f73a70c67e5ea189568af53b1e8c", + "rev": "715d72e967ec1dd5ecc71290ee072bcaf5181ed6", "type": "github" }, "original": { @@ -1084,11 +1102,11 @@ "nixpkgs-lib_3": { "locked": { "dir": "lib", - "lastModified": 1693471703, - "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", "type": "github" }, "original": { @@ -1102,11 +1120,11 @@ "nixpkgs-lib_4": { "locked": { "dir": "lib", - "lastModified": 1693471703, - "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", "type": "github" }, "original": { @@ -1199,11 +1217,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1690720142, - "narHash": "sha256-GywuiZjBKfFkntQwpNQfL+Ksa2iGjPprBGL0/psgRZM=", + "lastModified": 1695318763, + "narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3acb5c4264c490e7714d503c7166a3fde0c51324", + "rev": "e12483116b3b51a185a33a272bf351e357ba9a99", "type": "github" }, "original": { @@ -1337,11 +1355,11 @@ "nixpkgs-stable": "nixpkgs-stable_3" }, "locked": { - "lastModified": 1694364351, - "narHash": "sha256-oadhSCqopYXxURwIA6/Anpe5IAG11q2LhvTJNP5zE6o=", + "lastModified": 1696516544, + "narHash": "sha256-8rKE8Je6twTNFRTGF63P9mE3lZIq917RAicdc4XJO80=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "4f883a76282bc28eb952570afc3d8a1bf6f481d7", + "rev": "66c352d33e0907239e4a69416334f64af2c685cc", "type": "github" }, "original": { @@ -1362,11 +1380,11 @@ "nixpkgs-stable": "nixpkgs-stable_4" }, "locked": { - "lastModified": 1694364351, - "narHash": "sha256-oadhSCqopYXxURwIA6/Anpe5IAG11q2LhvTJNP5zE6o=", + "lastModified": 1696516544, + "narHash": "sha256-8rKE8Je6twTNFRTGF63P9mE3lZIq917RAicdc4XJO80=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "4f883a76282bc28eb952570afc3d8a1bf6f481d7", + "rev": "66c352d33e0907239e4a69416334f64af2c685cc", "type": "github" }, "original": { @@ -1389,17 +1407,17 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix_4" }, "locked": { - "lastModified": 1695132280, - "narHash": "sha256-GdBceddjUaxsv/Bvu5uSK0X2aTjSoPBOnSW1KTgxTeo=", + "lastModified": 1700488236, + "narHash": "sha256-Y7bFygT7pKVCY/7r4KA75/XZil3F4a19AxN5UwqARfI=", "owner": "hackworthltd", "repo": "primer", - "rev": "2bf2349473b60fc6a99e9a553dcd1b0fd9d54b5f", + "rev": "96236936906694bacf62c52cb718ba73e77c50ee", "type": "github" }, "original": { "owner": "hackworthltd", "repo": "primer", - "rev": "2bf2349473b60fc6a99e9a553dcd1b0fd9d54b5f", + "rev": "96236936906694bacf62c52cb718ba73e77c50ee", "type": "github" } }, @@ -1421,11 +1439,11 @@ "stackage": { "flake": false, "locked": { - "lastModified": 1694822954, - "narHash": "sha256-9RLqpS5AoyNYMLrViEuZpuxPEpWAC2J2JWZ6yANEx3w=", + "lastModified": 1696464547, + "narHash": "sha256-NABJBlKDwsQox6yrKZ8saWdhjLwQEGIwpmJlClaeO1A=", "owner": "input-output-hk", "repo": "stackage.nix", - "rev": "2d5f46010ec834c3c652ef0a1b1c17b1c9e56da4", + "rev": "844c3b4c520cb4ead6113f6ba25dc2ad33e21273", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b0a6db98..57c33cf7 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ # Note: don't override any of primer's Nix flake inputs, or else # we won't hit its binary cache. - primer.url = github:hackworthltd/primer/2bf2349473b60fc6a99e9a553dcd1b0fd9d54b5f; + primer.url = github:hackworthltd/primer/96236936906694bacf62c52cb718ba73e77c50ee; flake-parts.url = "github:hercules-ci/flake-parts"; }; diff --git a/src/components/SelectionInfo/index.tsx b/src/components/SelectionInfo/index.tsx index c63fd953..af21f1c9 100644 --- a/src/components/SelectionInfo/index.tsx +++ b/src/components/SelectionInfo/index.tsx @@ -23,10 +23,11 @@ const TypeOrKindTree = (p: { fitView({ padding }); }; + const tk = p.typeOrKind.contents; return ( Date: Thu, 9 Nov 2023 10:54:44 +0000 Subject: [PATCH 2/2] feat: show expected and actual type for mismatches Mismatches, aka non-empty holes, now show both relevant types. Previously one would see the expected type in the "Selection info" of the hole, and the actual type in the info of the body of the hole. Now one sees both in the info of the hole. Signed-off-by: Ben Price --- src/components/SelectionInfo/index.tsx | 76 +++++++++++++++++++------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/src/components/SelectionInfo/index.tsx b/src/components/SelectionInfo/index.tsx index af21f1c9..d88f3527 100644 --- a/src/components/SelectionInfo/index.tsx +++ b/src/components/SelectionInfo/index.tsx @@ -1,5 +1,5 @@ import { NodeChange, ReactFlowProvider, useReactFlow } from "reactflow"; -import { Level, TypeOrKind } from "@/primer-api"; +import { Tree, Level, TypeOrKind } from "@/primer-api"; import { TreeReactFlowOne } from "@/components"; import { TreeReactFlowOneProps, @@ -13,7 +13,7 @@ export type SelectionInfoProps = { }; const TypeOrKindTree = (p: { - typeOrKind: TypeOrKind; + typeOrKind: Tree; level: Level; extraTreeProps: Partial; }) => { @@ -23,11 +23,10 @@ const TypeOrKindTree = (p: { fitView({ padding }); }; - const tk = p.typeOrKind.contents; return ( ; +}) => { + return ( +
+
+ {title} +
+
+ + + +
+
+ ); +}; + export const SelectionInfo = ({ typeOrKind, level, @@ -44,22 +72,30 @@ export const SelectionInfo = ({ }: SelectionInfoProps): JSX.Element => { return (
- {typeOrKind && ( - <> -
- Type -
-
- - - -
- - )} + {typeOrKind && + (typeOrKind.contents.tag === "Ok" ? ( + + ) : ( + <> + + + + ))}
); };