◐ Shell
clean mode source ↗

[release/v7.7.0-preview.1] Update `MaxVisitCount` and `MaxHashtableKeyCount` if `VisitorSafeValueContext` indicates `SkipLimitCheck` is true by jshigetomi · Pull Request #27308 · PowerShell/PowerShell

Backport of #27306 to release/v7.7.0-preview.1

Triggered by @jshigetomi on behalf of @SeeminglyScience

Original CL Label: CL-Engine

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Engine fix: ensures MaxVisitCount and MaxHashtableKeyCount are updated when VisitorSafeValueContext indicates SkipLimitCheck is true. Without this fix, expression evaluation can hit visit/key-count limits in safe-value contexts that should bypass them. Already merged to release/v7.4.x, v7.5.x, and v7.6.x.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Original PR was verified by tests added with the change and has been successfully backported to release/v7.4.x, v7.5.x, and v7.6.x branches (all marked Backport-*-Done). Cherry-pick to release/v7.7.0-preview.1 applied cleanly with no conflicts. CI on the backport branch will validate the change in the preview branch context.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Low risk: small, well-scoped engine change to limit-check handling in VisitorSafeValueContext. The same change has already shipped successfully in v7.4, v7.5, and v7.6 release lines without issues. Cherry-pick was clean (no conflicts), so the code applied is identical to the already-validated versions.