commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.98k stars 842 forks source link

Stack no longer detects newest snapshot with default configuration #6516

Closed konn closed 6 months ago

konn commented 6 months ago

General summary/comments (optional)

stack new no longer keeps track with the latest Stackage snapshots unless we specify urls.latest-snapshot in ~/.stack/config.yaml.

Steps to reproduce

For example:

  1. Run stack new --resolver nightly myproj

Expected

When run at 2024-03-11 15:35 JST, it must pick nightly-2024-03-11 as the full snapshot name.

Actual

It picks older one:

Selected resolver: nightly-2024-02-12.
Selected the snapshot nightly-2024-02-12.
Initialising Stack's project-level YAML configuration file using snapshot nightly-2024-02-12.

If you suspect that a Stack command misbehaved, please include the output of that command in --verbose mode. If the output is larger than a page please paste the output in a Gist.

$ stack new --resolver nightly myproj --verbose
Version 2.15.1, Git revision 2828cc5326e27f16db480b1a7826a91004dcc2bc x86_64 hpack-0.36.0
2024-03-11 15:37:04.421476: [debug] No project config file found, using defaults.
2024-03-11 15:37:04.423694: [debug] Use of Casa server enabled: (CasaRepoPrefix "https://casa.stackage.org", 1280).
2024-03-11 15:37:04.427287: [debug] (SQL) SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2024-03-10 06:37:04.427214965 UTC]
2024-03-11 15:37:04.428258: [debug] Opening local template: "new-template.hsfiles"
2024-03-11 15:37:04.428469: [info] Downloading template new-template to create project myproj in directory myproj/...
2024-03-11 15:37:04.428602: [debug] Downloading /repos/commercialhaskell/stack-templates/contents/new-template.hsfiles
2024-03-11 15:37:04.783371: [info] /home/konn/.stack/templates/new-template.hsfiles: download has begun
2024-03-11 15:37:04.783739: [info] /home/konn/.stack/templates/new-template.hsfiles:    6.71 KiB downloaded...
2024-03-11 15:37:04.784110: [info] Downloaded /home/konn/.stack/templates/new-template.hsfiles.
2024-03-11 15:37:04.784167: [debug] Opening local template: "/home/konn/.stack/templates/new-template.hsfiles"
2024-03-11 15:37:04.786834: [info] 
Note: The following parameters were needed by the template but not provided: author-email,
      author-name, category, copyright and github-username.

      You can provide them in Stack's global YAML configuration file (/home/konn/.stack/config.yaml)
      like this:

      templates:
        params:
          author-email: value
          author-name: value
          category: value
          copyright: value
          github-username: value

      Or you can pass each one on the command line as parameters like this:

      stack new myproj new-template -p "author-email:value" -p "author-name:value" -p
      "category:value" -p "copyright:value" -p "github-username:value"

2024-03-11 15:37:04.788333: [info] Looking for Cabal or package.yaml files to use to initialise Stack's project-level YAML
configuration file.

2024-03-11 15:37:04.788697: [info] Using the Cabal packages:
* myproj/

2024-03-11 15:37:04.790122: [debug] Running Hpack on /home/konn/myproj/package.yaml
2024-03-11 15:37:04.793482: [debug] Hpack generated a modified version of /home/konn/myproj/myproj.cabal
2024-03-11 15:37:04.796270: [debug] Downloading snapshot versions file from https://s3.amazonaws.com/haddock.stackage.org/snapshots.json
2024-03-11 15:37:05.698587: [debug] Done downloading and parsing snapshot versions file
2024-03-11 15:37:05.698724: [info] Selected resolver: nightly-2024-02-12.
2024-03-11 15:37:05.976457: [info] Selected the snapshot nightly-2024-02-12.
2024-03-11 15:37:05.977138: [info] Initialising Stack's project-level YAML configuration file using snapshot nightly-2024-02-12.
2024-03-11 15:37:05.977224: [info] Considered 1 user package.
2024-03-11 15:37:05.977253: [info] Writing configuration to myproj/stack.yaml.
2024-03-11 15:37:05.977889: [info] Stack's project-level YAML configuration file has been initialised.

On the other hand, if we add the following to ~/.stack/config.yaml, it picks the right one:

urls:
  latest-snapshot: https://www.stackage.org/download/snapshots.json

It seems that the default storage on S3 (http://s3.amazonaws.com/haddock.stackage.org/snapshots.json) is no longer up to date with the stackage. If this is not as intended (by Stackage maintainers), this might be a bug of Stackage, not Stack.

Stack version

$ stack --version
Version 2.15.1, Git revision 2828cc5326e27f16db480b1a7826a91004dcc2bc x86_64 hpack-0.36.0

Method of installation

Platform

Ubuntu 20.04.6 and macOS

mpilgrem commented 6 months ago

@konn, thanks for reporting. I think Stack's default is: https://s3.amazonaws.com/haddock.stackage.org/snapshots.json and that does not seem to be up to date. Perhaps the handover of Stackage from FP Complete to the Haskell Foundation means that default needs to change. I'll make some enquiries.

mpilgrem commented 6 months ago

The current default was introduced in 2016:

mpilgrem commented 6 months ago

@chreekat, may I ask you to look at my comments above and the Reddit post.

mpilgrem commented 6 months ago

@chreekat gave me some input on Matrix: the default URL does need to change, and https://stackage-haddock.haskell.org/snapshots.json will likely be the most reliable one.

mpilgrem commented 6 months ago

@konn, this should be fixed in Stack's master branch. If you are not using GHCup to manage versions of Stack: stack upgrade --source-only --git.

konn commented 6 months ago

Thanks! I installed stack via ghcup as noted above and not in a hurry, so I will wait for new release.