-
Notifications
You must be signed in to change notification settings - Fork 697
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
Fix #9151 (cabal init logs at loglevel "Log") #9346
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in with this change. I left a couple of comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not repeating the points that have already been raised.
Validation test is broken. Todo:
|
@aleeusgr Re: validation tests - i'll take a look in a bit to remind myself. |
OK. Meanwhile I'll try to run the failing test locally in 9.2.8 |
All checks pass. Maybe guard expression caused validate test to fail. @emilypi please check QA note I added at the top of this PR. I need to
|
@aleeusgr: don't hesitate to mark the PR with help_needed and ping the Matrix channel if you feel blocked. |
I was looking at your checklist in the comment above. Any ideas for an automated test? |
Maybe we could parse the log output line by line and fail if [Log] shows up? |
Sounds good to me. Perhaps also check the test output is not empty (and make sure the cabal-install commands issued in the test really should log something). Alternatively, there are golden tests somewhere (see the READMEs in the test folders and also CONTRIBUTING) so, if they apply to this situation, you can ensure the log output is always exactly the same as you record and accept initially. I suppose |
|
what is a golden test ? Golden tests define 6 test groups which correspond(?) to this comment:
five lines vs 6 test groups. The first group is one ring to rule them all:
|
https://github.com/haskell/cabal/tree/master/cabal-install/tests#integration-tests each test is a shell script. Looking at the file, it contains only test trees but no test code. The list of unit tests can be found in cabal-install.cabal The functionality I added relates to Init command, so I should look at cabal/cabal-install/tests/UnitTests.hs Line 13 in 6314590
There are five test trees(?) imported in init: FileCreators, Interactive, Non-interactive, Golden, Simple. |
to run tests: Parsing log outputs: |
What you could do is probably add a parameter to add a log queue accumulator in the prompt state. I.e. newtype PurePrompt a = PurePrompt
{ _runPrompt
:: NonEmpty String
-> Either BreakException (a, NonEmpty String)
}
deriving (Functor) Should turn into the following: type LogQueue = [Text]
newtype PurePrompt a = PurePrompt
{ _runPrompt
:: NonEmpty String
-> Either BreakException (a, NonEmpty (LogQueue, String))
}
deriving (Functor) Then the instances will need to be adjusted so that dedicated log functions are used which pipe to the correct behaviors in the IO case and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @aleeusgr :)
Congrats on contributing to Cabal!
Thank you @emilypi |
dear @geekosaur or @emilypi I regret to inform you that there is a problem with merging this PR: I wonder what I could do to make it go through but it looks I am powerless in this situation. Thank you for your attention |
Strange. Let me rebase. |
@mergify rebase |
✅ Branch has been successfully rebased |
Success! It must have been a mergify hiccup (and then a GHA random hangup, which I restarted). @aleeusgr: congrats again! :) |
* rm Log from Severity loglevels * replace Log with Info * add changelog * fix typo * fix changelog entry * add displaySeverity * fix changelog * run fourmolu * implement case expression in displaySeverity
The actual ADT for severity should change because "Log" is useless as a datatype, arguably it shouldn't even be an entry in the ADT and the severity should be at
Info
for everything that's not aWarn
.QA notes:
when calling
cabal init
the user sees log entries categorized as Info, while entries categorized as Log should not appear.