Skip to content
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

sprockets should raise a warning if it finds multiple manifest files #559

Open
michaelglass opened this issue Jun 27, 2018 · 2 comments
Open

Comments

@michaelglass
Copy link
Contributor

We recently ran into an issue where some caching gone wrong left us with multiple .sprockets-manifest-1234567.json files.

It'd be lovely to have a warning in this situation.

Relevant method to change is here:

def find_directory_manifest(dirname)
entries = File.directory?(dirname) ? Dir.entries(dirname) : []
entry = entries.find { |e| e =~ MANIFEST_RE } ||
generate_manifest_path
File.join(dirname, entry)
end

If this seems like a reasonable direction, I'd be happy to bring a PR.

Expected behavior

  • Sprockets loads the most recently modified manifest file
  • Sprockets logs a warning that it expected only one manifest file

Actual behavior

  • Sprockets loads (I believe) the alphabetically earliest manifest file, and silently ignores the second file

System configuration

  • Sprockets version
    3.7.2 (but 4* is also affected)
  • Ruby version
    2.3.4
@schneems
Copy link
Member

I’ve seen this in the wild before. I have no idea what would cause it though.

I would be interested in a PR to start. Likely an error would be a good idea. But let’s start with the basics of the implementation of how we can detect it.

@michaelglass
Copy link
Contributor Author

michaelglass commented Jun 27, 2018

For us, we produced multiple manifest by doing some funny business with caching between environments.

We had three different workspaces from which we deployed
We would occasionally clear out those workspaces and have no cache. In this case, sprockets would generate a new manifest which would end up in the cache.
Occasionally, that cache would be unpacked on top of a workspace that had another manifest. Now we have two manifest files.

We were at fault. Our caching was broken. But it was hard to diagnose because of the silence of sprockets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants