You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix requireLocalPort for range, regex, and host-and-port rules - #344185
Matching port-range, process-regex, and host-and-port rules discarded requireLocalPort, so requesting a warning when the local port changes had no effect. Merge the matched value while preserving explicit false and existing rule precedence. An exact-port rule that omits the flag also preserves a value inherited from an earlier matching range.
Adds 15 tests covering all three selectors with true, false, and unset values, unmatched-rule fallback, exact-port precedence, range/regex precedence, and a range flag combined with an exact-port label. The fallback interaction tests use rules containing only requireLocalPort and populated remote.otherPortsAttributes; matching empty rules and rules with no defined attributes remain eligible for fallback.
Behavior change: a range, process-regex, or host-and-port rule that sets only requireLocalPort now resolves an attribute, so remote.otherPortsAttributes no longer supplies its onAutoForward, label, or elevateIfNeeded values for that port. This applies to both explicit true and explicit false, matching existing exact-port behavior. Previously, dropping the flag made these rules accidentally use the fallback. For example, fallback onAutoForward: "ignore" no longer suppresses automatic forwarding for a port covered by such a rule; put onAutoForward: "ignore" on the matching rule if that behavior is wanted. The existing fallback-selection logic is unchanged.
Validation of the runtime fix on f8f2501f:
Original baseline: 4 passing controls and 4 expected failures for the dropped attribute.
Copilot's mixed-rule case: an additional regression test failed before the exact-port merge correction.
After both corrections: 21 passing browser tests across the new suite and adjacent remote-resource, automatic-forwarding, and URL-finder suites.
Full client typecheck passed:npm run typecheck-client, no diagnostics.
Client build (npm run build-fast -- --client-only), targeted ESLint, and git diff --check passed.
Independent source review found no actionable issues after the follow-up correction.
Test-only follow-up on 531b4772:
Added six fallback-interaction tests and strengthened the three unmatched-rule tests; production code is unchanged from f8f2501f.
With the original two compiled assignments temporarily restored, the three flag-only tests failed as expected and the three empty/unset-rule controls passed. The current compiled output was restored before candidate verification.
All 27 browser tests passed across the same four suites after the follow-up; incremental client build, targeted ESLint, and git diff --check passed.
The full client typecheck and native run below were performed on f8f2501f; they were not rerun for this test-only follow-up. The new fallback interactions were verified in the browser unit suite, not separately in the desktop app.
Native end-to-end verification used the rebuilt Code OSS Dev 1.144.0 client on macOS with the repository's Electron 43.8.3 runtime and the controlled TCP fixture described in #344184:
Range with requireLocalPort: true: native mismatch warning shown.
Range with true plus an exact-port rule defining only a label: native warning shown.
Exact port with true: native warning shown.
Exact port with false: no warning.
All four actual TCP forwards returned HTTP 200 with the expected response, with attempts spaced beyond the dialog cooldown.
This native run uses a local tunnel provider, not Remote SSH or Dev Containers. Native regex and host-and-port dialogs were not separately exercised; their attribute resolution is covered by the browser regression suite. Uncompiled built-in extensions in the client-only development build reported unrelated activation errors; the fixture registered and all four controlled forwarding paths completed.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The exact-port branch still resets a range or regex requireLocalPort: true to undefined when the exact rule leaves the flag unset, so the warning can still be lost.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The core fix is small, but it changes default fallback behavior for flag-only range, regex, and host-and-port rules, which the PR does not mention or test.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Document or test changed defaults for requireLocalPort-only rules
Behavior change: a range, regex, or host-and-port rule that sets only requireLocalPort now counts as a match. Before this change, such a rule fell back to remote.otherPortsAttributes, so the defaults for onAutoForward, label, and elevateIfNeeded applied to those ports. Those defaults are now skipped. This matches how exact-port rules already behave, but the PR does not mention it and no test covers it. Please confirm this is intended, then document it or add a test that asserts it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #344184.
Matching port-range, process-regex, and host-and-port rules discarded
requireLocalPort, so requesting a warning when the local port changes had no effect. Merge the matched value while preserving explicitfalseand existing rule precedence. An exact-port rule that omits the flag also preserves a value inherited from an earlier matching range.Adds 15 tests covering all three selectors with true, false, and unset values, unmatched-rule fallback, exact-port precedence, range/regex precedence, and a range flag combined with an exact-port label. The fallback interaction tests use rules containing only
requireLocalPortand populatedremote.otherPortsAttributes; matching empty rules and rules with no defined attributes remain eligible for fallback.Behavior change: a range, process-regex, or host-and-port rule that sets only
requireLocalPortnow resolves an attribute, soremote.otherPortsAttributesno longer supplies itsonAutoForward,label, orelevateIfNeededvalues for that port. This applies to both explicittrueand explicitfalse, matching existing exact-port behavior. Previously, dropping the flag made these rules accidentally use the fallback. For example, fallbackonAutoForward: "ignore"no longer suppresses automatic forwarding for a port covered by such a rule; putonAutoForward: "ignore"on the matching rule if that behavior is wanted. The existing fallback-selection logic is unchanged.Validation of the runtime fix on
f8f2501f:npm run typecheck-client, no diagnostics.npm run build-fast -- --client-only), targeted ESLint, andgit diff --checkpassed.Test-only follow-up on
531b4772:f8f2501f.git diff --checkpassed.f8f2501f; they were not rerun for this test-only follow-up. The new fallback interactions were verified in the browser unit suite, not separately in the desktop app.Native end-to-end verification used the rebuilt Code OSS Dev 1.144.0 client on macOS with the repository's Electron 43.8.3 runtime and the controlled TCP fixture described in #344184:
requireLocalPort: true: native mismatch warning shown.trueplus an exact-port rule defining only a label: native warning shown.true: native warning shown.false: no warning.This native run uses a local tunnel provider, not Remote SSH or Dev Containers. Native regex and host-and-port dialogs were not separately exercised; their attribute resolution is covered by the browser regression suite. Uncompiled built-in extensions in the client-only development build reported unrelated activation errors; the fixture registered and all four controlled forwarding paths completed.