moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.88k stars 157 forks source link

[bug] Task resolution cannot merge and extends correctly #1146

Closed maastrich closed 11 months ago

maastrich commented 11 months ago

Describe the bug

✅ When a task B extends another task A, it inherits all its field ✅ When a task A is override by a workspace, it inherits all its field ❌ When a task B extends a taks A and this task A is override in a workspace, the override inheritance doesn't work (the extends works)

Steps to reproduce

  1. Clone 'https://github.com/maastrich/repro/tree/moonrepo/moon-1146' (go to branch moonrepo/moon-1146)
  2. pnpm i --frozen-lockfile
  3. moon run app:child

You will see that the child task run as noop (no command is defined in apps/app/moon.yml in the parent task)

Expected behavior

I would expect the command to be defined and inherited from the original parent task

expected output of moon run app:child -> VAR1: parent-overridden, VAR2: child

Screenshots

image

Environment

  System:
    OS: macOS 13.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 86.95 MB / 32.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.6.0 - ~/.proto/bin/node
    Yarn: 3.6.4 - ~/.proto/bin/yarn
    npm: 10.2.0 - ~/.proto/bin/npm
    pnpm: 8.7.3 - ~/.proto/bin/pnpm
  Managers:
    Homebrew: 4.1.17 - /opt/homebrew/bin/brew
    pip3: 21.3.1 - /opt/homebrew/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    CMake: 3.27.5 - /opt/homebrew/bin/cmake
    Make: 3.81 - /usr/bin/make
    GCC: 15.0.0 - /usr/bin/gcc
    Git: 2.42.0 - /opt/homebrew/bin/git
    Clang: 15.0.0 - /usr/bin/clang
    FFmpeg: 6.0 - /opt/homebrew/bin/ffmpeg
    Curl: 8.1.2 - /usr/bin/curl
  Servers:
    Apache: 2.4.56 - /usr/sbin/apachectl
  Virtualization:
    Docker: 20.10.23 - /usr/local/bin/docker
  IDEs:
    Emacs: 29.1 - /opt/homebrew/bin/emacs
    VSCode: 1.83.1 - /usr/local/bin/code
    Vim: 9.0 - /usr/bin/vim
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Go: 1.21.1 - /opt/homebrew/bin/go
    Perl: 5.36.1 - /opt/homebrew/bin/perl
    PHP: 8.2.10 - /opt/homebrew/bin/php
    Protoc: 24.3 - /opt/homebrew/bin/protoc
    Python: 3.11.6 - /Users/maastrich/.proto/bin/python
    Python3: 3.11.5 - /opt/homebrew/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
  Databases:
    SQLite: 3.39.5 - /usr/bin/sqlite3
  Browsers:
    Chrome: 118.0.5993.88
    Safari: 16.6
milesj commented 11 months ago

@maastrich The way it currently works, is that global tasks are processed first, followed by local tasks. It basically works like this, if B extends A, the chain is:

build global A
build global B
build local A
build local B

What you're trying to do is more like:

build global A
build local A
build global B
build local B

I'm not sure how feasible it would be, but I'll look into it.

maastrich commented 11 months ago

Thanks for your reply @milesj ,

build global B
build local A
build local B

This seems good to me as a process I'm wondering if, when you build local B, local A has already been built and is passed as an already merged task 🤔 Isn't it possible that the build of both local tasks is run concurrently ? causing a not merged local A, being extended by local B ?

milesj commented 11 months ago

I think I figured this out in 1.16 if you want to try it.

maastrich commented 11 months ago

@milesj It seems to be working fine again 💪 Thanks for your time, I'll leave you the liberty of closing the issue