Skip to content

Module include/exclude unexpectedly impacts other local dependencies #6902

Closed

Description

@sipsma

Noticed this while working on #6857

Right now if you have two modules in a local repo checkout and there is a dependency between them, if

  • Module A does an include of *.foo
  • Module B does an exclude of *.foo

Then the exclude of Module B will override the include from Module A. The direction of the dependency between A and B doesn't matter, the end effect will be the same.

The problem is that module loading currently combines all the includes+excludes of local modules to one big list of includes+excludes, which results in unexpected interactions like this.

A related issue is that we currently dedupe these include/exclude paths using a map, which results in the end list of each being in a random order, which isn't correct as the order of a given include/exclude list actually matters.


Instead, while include+exclude should have interactions within the context of a single module, they should not impact others.

Unfortunately, I'm not seeing any super quick fixes here. If we load all the modules separately and then merge them together, we will end up reloading a lot of duplicate data potentially.

The only viable option I can think of so far that wouldn't annihilate performance would be to re-use the same underlying cache ref for the local module loading, but load each one one-at-a-time. After each load, we can look at the files that were loaded, compare against the include/exclude of the next module that we're going to load and update those includes/excludes to ensure that we don't delete any files that were loaded for the previous modules 😵‍💫 Hopefully there's some elegant/clever way to model this, but it seems like it may be a fountain of corner cases, so lots of tests will be needed.

  • In the very long term, a new implementation of local dir loading that dedupes files across distinct cache refs (hardlink farm idea) would make this all much simpler

Activity

  1. added this to the v0.10.x milestone on Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions