Skip to content

[FrameworkBundle][ContainerLint] Keep "removing" compiler passes #34502

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

Merged
merged 1 commit into from
Nov 24, 2019

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #34498
License MIT
Doc PR -

Removing "removing" compiler passes when debug is off (why only in this case btw?) means that the container is never cleaned (the important thing being the "remove unused definitions" pass), leaving it in a "dirty" state. What is the point of testing a container that is different than the one that will be used anyway? 🤔

Making this truely work btw means that 100% of Symfony's declared services must end up valid whether they are used or not and in all combinations possible. I guess that should be the goal but from what I could test in the last hour, that will be a lot of work. However, there are definitely some fixes to do in our services declarations that we can detect thanks to this "bug".

@chalasr
Copy link
Member

chalasr commented Nov 23, 2019

For the record, this logic was borrowed from ContainerDebugCommand which really needs TYPE_REMOVING passes to be excluded (as debug:container and debug:autowiring are also about discovering services that you don't know yet, and knowing which services have been actually removed during compilation).

when debug is off (why only in this case btw?)

Because the container used by the command is dumped by ContainerBuilderDebugDumpPass, which is registered in debug mode only and is of type BEFORE_REMOVING for the reason explained above.
And the difference here is that debug:* commands do not compile this container when it's available (in debug mode), while this one always compile it.

@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Nov 24, 2019
@fabpot
Copy link
Member

fabpot commented Nov 24, 2019

Thank you @fancyweb.

fabpot added a commit that referenced this pull request Nov 24, 2019
…passes (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][ContainerLint] Keep "removing" compiler passes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34498
| License       | MIT
| Doc PR        | -

Removing "removing" compiler passes when debug is off (why only in this case btw?) means that the container is never cleaned (the important thing being the "remove unused definitions" pass), leaving it in a "dirty" state. What is the point of testing a container that is different than the one that will be used anyway? 🤔

Making this truely work btw means that 100% of Symfony's declared services must end up valid whether they are used or not and in all combinations possible. I guess that should be the goal but from what I could test in the last hour, that will be a lot of work. However, there are definitely some fixes to do in our services declarations that we can detect thanks to this "bug".

Commits
-------

59d6771 [FrameworkBundle][ContainerLint] Keep removing compiler passes
@fabpot fabpot merged commit 59d6771 into symfony:4.4 Nov 24, 2019
This was referenced Dec 1, 2019
nicolas-grekas added a commit that referenced this pull request Dec 13, 2019
… the lint container command and its associated pass (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #34858
| License       | MIT
| Doc PR        | -

We remove the "removing" passes again and to avoid what #34502 fixed, we skip validating the "live" container removed ids in the pass (the "live" container is supposed to have the same definitions than the "debug container" one).

Logically, an errored service cannot pass the "live" container compilation without being removed. Consequently, it also skips the errored services that ended up being removed in the "live" container.

Commits
-------

a0f581b [FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Dec 13, 2019
… the lint container command and its associated pass (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony/symfony#34858
| License       | MIT
| Doc PR        | -

We remove the "removing" passes again and to avoid what symfony/symfony#34502 fixed, we skip validating the "live" container removed ids in the pass (the "live" container is supposed to have the same definitions than the "debug container" one).

Logically, an errored service cannot pass the "live" container compilation without being removed. Consequently, it also skips the errored services that ended up being removed in the "live" container.

Commits
-------

a0f581ba9d [FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull request Dec 13, 2019
… the lint container command and its associated pass (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony/symfony#34858
| License       | MIT
| Doc PR        | -

We remove the "removing" passes again and to avoid what symfony/symfony#34502 fixed, we skip validating the "live" container removed ids in the pass (the "live" container is supposed to have the same definitions than the "debug container" one).

Logically, an errored service cannot pass the "live" container compilation without being removed. Consequently, it also skips the errored services that ended up being removed in the "live" container.

Commits
-------

a0f581ba9d [FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants