Skip to content

chore: merge protolude into postgrest#4861

Draft
taimoorzaeem wants to merge 306 commits intomainfrom
prelude/protolude/master
Draft

chore: merge protolude into postgrest#4861
taimoorzaeem wants to merge 306 commits intomainfrom
prelude/protolude/master

Conversation

@taimoorzaeem
Copy link
Copy Markdown
Member

Towards #4775.

luc-tielen and others added 11 commits February 21, 2022 14:38
Co-authored-by: Adam Wespiser <adamwespiser@gmail.com>
* Updates README to correctly list all supported stack LTS versions

* Updates README to include LTS 19.14 and higher
* Release 0.3.3, with support for GHC 9.4

- allow base-4.18 (GHC 9.4)
- allow ghc-prim 0.10
- allow bytestring 0.11.4
- test against GHC 9.4.4

Further CI tweaks:

- cabal: update GHC versions to the latest releases of the respective major version
- cabal: remove non-latest minor versions
- stack: add lts-20 (GHC 9.2.5)
- stack: bring the list of GHC versions up to date

* Update Cabal CI

---------

Co-authored-by: Robert Vollmert <rob@vllmrt.net>
* Test 9.6 and 9.8 in CI

* Support GHC 9.10

* Support GHC 9.12

---------

Co-authored-by: Tom Ellis <tom-git@jaguarpaw.co.uk>
@taimoorzaeem taimoorzaeem marked this pull request as draft April 29, 2026 10:42
@wolfgangwalther
Copy link
Copy Markdown
Member

Unfortunately this approach doesn't quite work, yet. When I browse your branch on GitHub, the history/blame for the protolude files only goes back 1 commit - the one where you added the files.

Here's what I'd do:

  • Add the protolude repo as a remote to my postgrest repo.
  • Create a new branch off of their latest default branch.
  • Create a commit to move all files on that branch into src/protolude or so.
  • Create a new branch off of postgrest's main branch.
  • Merge the protolude branch into this new branch with a merge commit.
  • Create a .git-blame-ignore-revs file at the top-level and add the commit hash of the commit that moved files into src/protolude to it to keep the git blame clean.
  • Then add a commit to integrate the new protolude lib into our build etc.

Later we merge the src/protolude directory with src/PostgREST.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
@taimoorzaeem taimoorzaeem force-pushed the prelude/protolude/master branch from 7a4adb2 to 827121b Compare April 30, 2026 09:21
Ignore blame for commit that moved protolude files under src/protolude.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
@taimoorzaeem
Copy link
Copy Markdown
Member Author

taimoorzaeem commented Apr 30, 2026

Here's what I'd do:

  • Add the protolude repo as a remote to my postgrest repo.

....

  • Then add a commit to integrate the new protolude lib into our build etc.

Right, your approach looks good. Thank you for sharing this. 👍

Roadmap

  • Pull protolude source
  • Merge with postgrest
  • Create .git-blame-ignore-revs
  • Remove unneeded files and integrate protolude with PostgREST build

@wolfgangwalther
Copy link
Copy Markdown
Member

Did a quick check: Browsing your branch on GitHub now correctly tracks commit information, I can easily blame my way through. Nice.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
Currently, our vendored protolude has many failing checks for
style, lint and hsie. Temporarily excluding it. We should
reinstate these checks later.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
@taimoorzaeem taimoorzaeem force-pushed the prelude/protolude/master branch from 718c1e0 to a46ac79 Compare April 30, 2026 15:33
@taimoorzaeem taimoorzaeem marked this pull request as ready for review April 30, 2026 15:40
@taimoorzaeem
Copy link
Copy Markdown
Member Author

taimoorzaeem commented Apr 30, 2026

Looks like there is a GHC 9.12.3 bug that only shows up when we build PostgREST with --enable-profiling also enabled for protolude.

Compiling PostgREST.Config.Proxy ( src/PostgREST/Config/Proxy.hs, dist-prof/build/x86_64-linux/ghc-9.12.3/postgrest-15/build/PostgREST/Config/Proxy.o, dist-prof/build/x86_64-linux/ghc-9.12.3/postgrest-15/build/PostgREST/Config/Proxy.dyn_o )
<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.12.3:
	lookupGREInfo
  lookup failed: toS
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:190:37 in ghc-9.12.3-2625:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Rename/Env.hs:2026:15 in ghc-9.12.3-2625:GHC.Rename.Env

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

@wolfgangwalther
Copy link
Copy Markdown
Member

I'm not sure whether it'd be helpful to go on with the coverage-based removal of protolude code first to simplify that code-base. Maybe we then have a better chance of diagnosing this problem?

Other ideas to go on from here:

  • ofc, actually report the bug upstream! Would probably need to confirm this with 9.12.4 first?
  • try building protolude in its own repo upstream with enable-profiling, see whether the problem persists

@taimoorzaeem taimoorzaeem marked this pull request as draft May 1, 2026 12:20
@taimoorzaeem
Copy link
Copy Markdown
Member Author

I'm not sure whether it'd be helpful to go on with the coverage-based removal of protolude code first to simplify that code-base. Maybe we then have a better chance of diagnosing this problem?

Not sure about that either, but I will try to look into it.

  • ofc, actually report the bug upstream! Would probably need to confirm this with 9.12.4 first?

I confirmed the error with 9.12.4 in my fork. Bug reported: https://gitlab.haskell.org/ghc/ghc/-/issues/27227

  • try building protolude in its own repo upstream with enable-profiling, see whether the problem persists

On my system it builds just fine. I think the profiled build is probably not the problem because it also fails in the regular build in NixOS - MacOS build in CI.

@taimoorzaeem
Copy link
Copy Markdown
Member Author

GHC team traced this issue to haskell/cabal#7684. Looks like PR: haskell/cabal#11791 has been opened to fix the issue 🎉 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.