microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.81k stars 592 forks source link

[rush] Strange output during rush rebuild #1733

Open wolfd opened 4 years ago

wolfd commented 4 years ago

Please prefix the issue title with the project name i.e. [rush], [api-extractor] etc.

Is this a feature or a bug?

Please describe the actual behavior.

As part of my build output for a rush rebuild, I saw a strange line that I didn't expect. The actual build failure was my fault, but the Found new prop in obj2: "full/file/CMakeLists.txt" value="e0fee1adf795c84eec4735f039503eb18d9c35cc" line wasn't expected.

FAILURE (2)
================================
applicaton_a (2 minutes 59.3 seconds)
>>> applicaton_a
react-scripts build
Creating an optimized production build...
Failed to compile.
/some/full/file/path.js
Cannot find file './file_that_doesnt_exist.css' in '/some/full/file/path.js'.

application_b (2 minutes 59.3 seconds)
>>> application_b
Found new prop in obj2: "full/file/CMakeLists.txt" value="e0fee1adf795c84eec4735f039503eb18d9c35cc"
react-scripts build
Creating an optimized production build...
Failed to compile.
/some/full/file/path.js
Cannot find file './file_that_doesnt_exist.css' in '/some/full/file/path.js'.
================================

[applicaton_a] Returned error code: 1
[application_b] Returned error code: 1

I think the offending line is here: https://github.com/microsoft/rushstack/blob/2405faab2f7583667613dcaabcda8eb6908da1ce/apps/rush-lib/src/logic/taskRunner/ProjectTask.ts#L40

According to @octogonz, this code has been here for awhile: https://gitter.im/rushstack/rushstack?at=5e34a4f273ddad4acd858652

¯\_(ツ)_/¯

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate.

Not sure if it matters that it happened in the failure output, but that's where it was. I haven't seen it before, but it's possible I just didn't process it.

What is the expected behavior?

That line probably shouldn't be printed.

If this is a bug, please provide the tool version, Node.js version, and OS.

octogonz commented 4 years ago

If we delete two these lines, would that fix this issue?

function _areShallowEqual(object1: JsonObject, object2: JsonObject, writer: ITaskWriter): boolean {
  for (const n in object1) {
    if (!(n in object2) || object1[n] !== object2[n]) {
      writer.writeLine(`Found mismatch: "${n}": "${object1[n]}" !== "${object2[n]}"`);
      // ^^^ DELETE THE ABOVE LINE ^^^
      return false;
    }
  }
  for (const n in object2) {
    if (!(n in object1)) {
      writer.writeLine(`Found new prop in obj2: "${n}" value="${object2[n]}"`);
      // ^^^ DELETE THE ABOVE LINE ^^^
      return false;
    }
  }
  return true;
}

If so, let's make a PR.

Claudiazhaoya commented 4 years ago

@wolfd could you try removing that line and see if it's still printed?

octogonz commented 4 years ago

@Claudiazhaoya I'm thinking we should just make a PR to delete those lines. It seems like a safe change. Looking at the code, it will definitely fix the problem.

Claudiazhaoya commented 4 years ago

Agree. Will a PR to fix it. :)

Claudiazhaoya commented 4 years ago

This PR has been made to fix this issue: #1799