X Tutup
Skip to content

build(TreeDiffer): don't assume that rootPaths to dirty check are imm…#2053

Closed
IgorMinar wants to merge 1 commit intoangular:masterfrom
IgorMinar:fix-tree-differ-inputpath
Closed

build(TreeDiffer): don't assume that rootPaths to dirty check are imm…#2053
IgorMinar wants to merge 1 commit intoangular:masterfrom
IgorMinar:fix-tree-differ-inputpath

Conversation

@IgorMinar
Copy link
Copy Markdown
Contributor

…utable

Closes #2051

@IgorMinar IgorMinar added this to the M9: TypeScript and Build Stability milestone May 21, 2015
@IgorMinar
Copy link
Copy Markdown
Contributor Author

this PR is still throwing exceptions in some cases, it needs more work...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if I understand this, broccoli sometimes changes the inputPath for us, and we need to be able to propagate that change to the TreeDiffer, and we do that here by passing it in here, right?

But, (some) plugins still think they need to use the old inputPath, they don't have any idea that it changed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it to me. my patch is failing in some cases so I need to investigate it further. initial explorations showed that the output path for certain plugins like replace and mergeTrees was not immutable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you thought about something like this?

class DiffingPluginWrapper {
  get inputPath() { return this._inputPath; }
  set inputPath(path) {
    this._inputPath = path;
    // propagate the change to wrapped plugin
    if (this.initialized) this.wrappedPlugin.inputPath = path;
  }
  // etc
}

https://github.com/IgorMinar/angular/pull/1/files working example (tested with test.unit.tools and test.unit.cjs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think about that, but it is simply wrong that the input path changes. The plugin should be the owner of the inputPath state and nobody else should change it, otherwise the whole system is unstable and it's easy to make assumptions that the input path doesn't change and cache absolute paths somewhere.

I have a different PR in works that stabilizes the input path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contracts for these properties are pseudo-documented in the broccolijs codebase, but it's not clear how strong those contracts are.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a problem here: fingerprints still contain old absolute paths, so fingerprints basically need a reset (or alternatively, the fingerprints object keys need to be the relative path rather than absolute)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be a relative path

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posteriority: I must have had a subtle error when trying the relativePath stuff before, it seems to work correctly now (so virtualPath is not needed) --- updating the pr

@IgorMinar
Copy link
Copy Markdown
Contributor Author

@caitp take a look at #2143, I think it's a better solution.

@mhevery mhevery added area: build & ci Related the build and CI infrastructure of the project and removed area: build & ci Related the build and CI infrastructure of the project #development_infrastructure labels May 29, 2015
@naomiblack
Copy link
Copy Markdown
Contributor

Merged in #2143. This PR seems to be obsolete. @caitp please reopen if not.

@naomiblack naomiblack closed this May 29, 2015
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: build & ci Related the build and CI infrastructure of the project cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DiffingPluginWrapper should handle input trees with mutable input paths

6 participants

X Tutup