-
Notifications
You must be signed in to change notification settings - Fork 27
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
Consensus: expose private sublibraries #445
Consensus: expose private sublibraries #445
Conversation
CHaP CI builds *all* components of a given project, but eg ouroboros-consensus-cardano has private-by-default sublibraries (used for tests), which themselves depend on other private-by-default sublibraries in eg ouroboros-consensus-diffusion, which causes failures at build time. In this commit, we make the sublibraries public by enabling the respective flags. Alternatives include: - Patch Consensus to always make the sublibraries public. - Don't build all (in particular private) sublibraries in CHaP CI (not sure if that is easily possible to do automatically).
259fbf4
to
db0dde8
Compare
What's wrong with just exposing the libraries unconditionally? It looks like they are classic "testlibs", why not just expose them? It's unclear to me what you're gaining here. I'm unsure if this would work, but I think possibly you could fix this by also toggling the buildability status of the downstream libraries based on the flag, so:
This seems true to me: |
I note that all of these schemes are going to cause trouble for anyone downstream who wants to use these libraries. I don't know if that's a goal. |
The original idea was to avoid downstream users accidentally/erroneously depending on the test sublibs (such that there is zero risk in us changing them as we wish). Your suggestion sounds nice, and I would have expected that it works, but it doesn't seem like it 😢 : https://github.com/input-output-hk/cardano-haskell-packages/actions/runs/5924086096/job/16061002938?pr=446 |
What trouble are you referring to? I think eg node won't notice this problem at all, as there are no Consensus sublibs in the transitive dependencies of it. |
Also, I'm a little confused by the original problem. I don't think we should build anything except public sublibraries... Maybe I can fix that directly...
I'm not sure quite what's going on there, it looks like maybe a cabal bug 🤔
So your intention is really for absolutely nobody outside consensus to use them? Are they not useful for downstream? As soon as someone downstream wants to depend on them this is going to be quite unpleasant. FWIW my preferred advice would still be "don't try to be so clever and just expose them" :) |
Yeah, I couldn't find a way to get the visibility status of a sublib in haskell.nix, but maybe I missed something (or it is just a small haskell.nix PR away from being available).
Yes, at least for now, but the idea was that people could just toggle the respective flags if they really really want to use them.
Yeah, that is definitely on the table, it is just too difficult to predict which constructions slightly off the well-trodden path won't cause Cabal to complain very loudly 😄 |
My feelings are:
So the combination of all of them is playing with fire a bit 😂
Summon @andreabedini, do you know if we can get this? |
We will resolve this by removing the flag, such that the sublibs are always public, @nfrisby is preparing the respective PRs. |
Here is the aforementioned PR. Those clicking this link probably only care about the diff in the |
This state of affairs is depressing :-/ where's the original error? We need to push to fix haskell.nix |
I'm not sure it's I also think the changes discussed here are reasonable: it is true that e.g. the downstream private libs were not buildable if the upstream ones were not public. So the previous state of things was not quite representing reality properly. But still: we shouldn't have even tried to build them. |
Here's the failing run btw: https://github.com/input-output-hk/cardano-haskell-packages/actions/runs/5913615616/job/16038187781 |
This conversation dropped off my radar :-/ I understand these sublibraries were made unbuildable by a flag? (The error from the logs above was |
No, we made the sublibraries unconditionally public, but gave them a "scary" name (
At the time this PR was created, we made our sublibraries only conditionally public (based on a flag that was off by default). The idea was that you would enable this flag in a dev environment, but not enable it when you depend on our libraries. In particular, it was not enabled on CHaP, but CHaP still tried to build these private sublibraries, which did now depend on private sublibraries on other packages, hence the errors. Quite a tricky situation, hope that makes it clear! |
Thank you @amesgen, I still have some doubts:
Why do you need to make them public during development? Are you going to use them from other packages? like e.g. you have tests in another package that have to use something in another package internal library? wouldn't it be easier to put those tests into the same package as the internal library? Sorry if I am being naïve but I am also curious to know :) |
This is a subgraph of our current component graph (in reality, there are various test suites that depend on these graph
subgraph diffusion
oc-diffusion
oc-diffusion:lib:unstable-diffusion-testlib
oc-diffusion:test:infra-test
end
subgraph cardano
oc-cardano
oc-cardano:lib:unstable-shelley-testlib
oc-cardano:test:shelley-test
end
oc-diffusion:lib:unstable-diffusion-testlib --> oc-diffusion
oc-diffusion:test:infra-test --> oc-diffusion:lib:unstable-diffusion-testlib
oc-cardano:lib:unstable-shelley-testlib --> oc-cardano
oc-cardano:test:shelley-test --> oc-cardano:lib:unstable-shelley-testlib
oc-cardano:test:shelley-test --> oc-cardano
oc-cardano:lib:unstable-shelley-testlib --> oc-diffusion:lib:unstable-diffusion-testlib
Note that we can't move |
CHaP CI builds all components of a given project, but eg ouroboros-consensus-cardano has private-by-default sublibraries (used for tests), which themselves depend on other private-by-default sublibraries in eg ouroboros-consensus-diffusion, which causes failures at build time.
In this commit, we make the sublibraries public by enabling the respective flags.
Alternatives include:
Patch Consensus to always make the sublibraries public.
Don't build all (in particular private) sublibraries in CHaP CI (not sure if that is easily possible to do automatically).