Skip to content

Comments

refactor(core): guards stringify calls with ngDevMode#66958

Merged
thePunderWoman merged 3 commits intoangular:mainfrom
SkyZeroZx:core/core-strinfy-remove-dev
Feb 20, 2026
Merged

refactor(core): guards stringify calls with ngDevMode#66958
thePunderWoman merged 3 commits intoangular:mainfrom
SkyZeroZx:core/core-strinfy-remove-dev

Conversation

@SkyZeroZx
Copy link
Contributor

The stringify function is only needed for debugging purposes and should not be called in production mode.

@pullapprove pullapprove bot requested a review from JeanMeche February 7, 2026 22:30
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Feb 7, 2026
@ngbot ngbot bot added this to the Backlog milestone Feb 7, 2026
}

return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);
return new R3Injector(providers, parent || getNullInjector(), source || null, scopes);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value, as I understand it, is only used in dev

if (ngDevMode) {
prependTokenToDependencyPath(error, token);
if (previousInjector) {
// We still have a parent injector, keep throwing
throw error;
} else {
// Format & throw the final error message when we don't have any previous injector
throw augmentRuntimeError(error, this.source);
}

try {
if (record.value === CIRCULAR) {
throw cyclicDependencyError(stringify(token));
throw cyclicDependencyError(ngDevMode ? stringify(token) : '');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a similar case here; the value is only used for dev mode.

export function cyclicDependencyError(token: string, path?: string[]): Error {
const message = ngDevMode ? `Circular dependency detected for \`${token}\`.` : '';
return createRuntimeError(message, RuntimeErrorCode.CYCLIC_DI_DEPENDENCY, path);
}

Copy link
Member

@JeanMeche JeanMeche left a comment

Choose a reason for hiding this comment

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

That change looks mostly good to me.

@JeanMeche
Copy link
Member

A rebase on main should "fix" the linting issue.

@SkyZeroZx SkyZeroZx force-pushed the core/core-strinfy-remove-dev branch from e06f4c2 to 81add45 Compare February 19, 2026 23:50
@JeanMeche
Copy link
Member

TGP is green

@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Feb 20, 2026
@ngbot
Copy link

ngbot bot commented Feb 20, 2026

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@JeanMeche JeanMeche added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Feb 20, 2026
@JeanMeche
Copy link
Member

caretaker note: The failed test is a known flake.

@thePunderWoman thePunderWoman added target: rc This PR is targeted for the next release-candidate and removed target: patch This PR is targeted for the next patch release labels Feb 20, 2026
@thePunderWoman thePunderWoman merged commit c89d94b into angular:main Feb 20, 2026
30 of 33 checks passed
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants