cabal icon indicating copy to clipboard operation
cabal copied to clipboard

ux: add warning when cabal reads from no index cache

Open taimoorzaeem opened this issue 1 year ago • 7 comments

Fixes #9136.

Since, I am a new contributor, I didn't follow the provided PR template and wrote what I thought would be best in this PR. Let me know if following the provided PR template is necessary.

  • [x] Add warning in code
  • [ ] Add tests
  • [ ] Add QA Notes
  • [ ] Conform to coding conventions

@andreabedini Please check if that is the right place for the warning and let me know about changes. I'll work on adding the tests next.

taimoorzaeem avatar Aug 15 '24 09:08 taimoorzaeem

@taimoorzaeem great work, thanks!

Could you, please, add manual-QA notes in the PR description? This would be a step-by-step guide showing what it takes to see the effect of your patch locally. This will start with build cabal from your branch (obvious). But then, what do I do to see the warning? Step by step. You could attach any sample files that could help to set up a no-index repository etc. Example of MQA notes is in the description of https://github.com/haskell/cabal/pull/9200

ulysses4ever avatar Aug 15 '24 15:08 ulysses4ever

You'll also have to make fourmolu and whitespace checkers happy (see the github action failures linked from this page).

ulysses4ever avatar Aug 15 '24 15:08 ulysses4ever

Would be great to add a test. See for guidance: https://github.com/haskell/cabal/blob/master/cabal-testsuite/README.md#how-to-write

ulysses4ever avatar Aug 15 '24 15:08 ulysses4ever

@ulysses4ever @andreabedini When exactly does cabal create a local .cache file? Are there any example of such test cases that I can follow?

taimoorzaeem avatar Aug 16 '24 15:08 taimoorzaeem

@taimoorzaeem I don't know the answer to your last question from the top of my head, sadly. I could try to dig over the weekend maybe. But in the meantime: can you locally observe the effect of your patch? In other words, the message you added --- can you make cabal built with this patch print this message? If so, please, post the instructions for how to do that.

ulysses4ever avatar Aug 22 '24 12:08 ulysses4ever

37 tests affected by the current change (they fail now), but most (all?) of them are seemingly unrelated:

562 tests, 14 skipped, 0 unexpected passes, 37 unexpected fails. UNEXPECTED FAIL: PackageTests/ShowBuildInfo/Complex/single.test.hs PackageTests/HaddockArgs/quickjump.test.hs PackageTests/HaddockArgs/hoogle.test.hs PackageTests/ConditionalAndImport/cabal.test.hs PackageTests/HaddockProject/haddock-project.test.hs PackageTests/NewFreeze/Flags/new_freeze.test.hs PackageTests/NewFreeze/FreezeFile/new_freeze.test.hs PackageTests/NewFreeze/BuildTools/new_freeze.test.hs PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.test.hs PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.test.hs PackageTests/Backpack/Includes3/cabal-repo.test.hs PackageTests/Backpack/T6385/cabal.test.hs PackageTests/Regression/T9756/cabal.test.hs PackageTests/Regression/T9640/cabal.test.hs PackageTests/NewHaddock/DisableDoc/cabal.test.hs PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.test.hs PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.test.hs PackageTests/NewHaddock/ImplyDependencies/cabal.test.hs PackageTests/OfflineFlag/offlineFlag.test.hs PackageTests/Outdated/outdated.test.hs PackageTests/Outdated/outdated-project-file.test.hs PackageTests/Outdated/outdated_freeze.test.hs PackageTests/VersionPriority/3-web.test.hs PackageTests/VersionPriority/2-local.test.hs PackageTests/VersionPriority/1-web.test.hs PackageTests/VersionPriority/1-local.test.hs PackageTests/VersionPriority/0-local.test.hs PackageTests/VersionPriority/2-web.test.hs PackageTests/Get/OnlyDescription/cabal.test.hs PackageTests/ExtraPackages/cabal.test.hs PackageTests/CopyHie/cabal.test.hs PackageTests/HaddockBuildDepends/cabal.test.hs PackageTests/Freeze/enable-benchmarks.test.hs PackageTests/Freeze/disable-tests.test.hs PackageTests/Freeze/disable-benchmarks.test.hs PackageTests/Freeze/freeze.test.hs PackageTests/Freeze/enable-tests.test.hs

ulysses4ever avatar Aug 22 '24 13:08 ulysses4ever

can you locally observe the effect of your patch? In other words, the message you added --- can you make cabal built with this patch print this message? If so, please, post the instructions for how to do that.

No, I am not able to observe the effect locally. That's because I am not sure when exactly cabal create a local no index cache. The warning message is only supposed to be printed when this cache file is created by cabal. Since I am not a much advanced user of cabal, I would like some you folks' help. @andreabedini Could you help out on how I should go about testing/qa it locally?

taimoorzaeem avatar Aug 29 '24 15:08 taimoorzaeem