Skip to content

[Test Quality] Cover wildcard pattern fallthrough after protocol mismatch - #11347

Merged
lpcox merged 1 commit into
mainfrom
test-quality/pattern-protocol-fallthrough-cb98836dc6412fe5
Nov 9, 2026
Merged

lpcox merged 1 commit into
mainfrom
test-quality/pattern-protocol-fallthrough-cb98836dc6412fe5

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Contract

isDomainMatchedByPattern (src/domain-matchers.ts) decides whether a plain --allow-domains entry is already covered by a wildcard pattern, using protocol compatibility rules ((redacted) It must evaluate *every* pattern; a protocol-incompatible match on an earlier pattern must not stop the search. See the doc comment in src/domain-matchers.tsandsrc/domain-patterns.ts` header.

Previous weakness

Every existing test used a single pattern for protocol cases, or multiple patterns with the same protocol. A regression that returns false on the first host-matching-but-protocol-incompatible pattern (instead of continuing) passed all 205 tests in domain-patterns, domain-utils, squid-config-domains (verified by temporary mutation). Impact: a domain would be wrongly treated as not covered, producing redundant/incorrect ACL entries.

Change

One test added to src/domain-patterns.test.ts (real function, no mocks): http-only then https-only pattern; http-only then both pattern for a both entry; and a negative control where no pattern covers the entry.

Evidence

  • Baseline (mutation applied, original tests): jest --runInBand --no-coverage --runTestsByPath src/domain-patterns.test.ts src/domain-utils.test.ts src/squid-config-domains.test.ts → 205 passed (mutation missed).
  • Mutation + new test: 1 failed (Expected: true / Received: false in the new test), 88 passed.
  • Mutation reverted: 89 passed in domain-patterns.test.ts. ESLint: 0 errors (6 pre-existing warnings).
  • No production changes in the diff.

CI

Discovered by root Jest (src/**/*.test.ts) in the existing unit test job. This is component-level evidence only, not Squid enforcement.

Generated by Test Quality Improver · copilot · auto (Claude Sonnet 5.5) · ~27 AIC · ⌖ ~2 AIC · ⊞ 11.5K · ◷

  • expires on Dec 9, 2026, 4:45 AM UTC

@lpcox
lpcox marked this pull request as ready for review November 9, 2026 05:35
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 05:35

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues were identified, and the change is limited to targeted regression coverage for protocol-aware wildcard matching.

No open issues 🎉

What changed in this PR

This pull request adds regression coverage for wildcard domain matching when an earlier host match is incompatible by protocol, without changing production code.

Changes:

  • Tests fallthrough from HTTP-only to HTTPS-only wildcard patterns.
  • Covers both protocol entries with a later compatible pattern.
  • Adds a negative control for unmatched domains.
File Description
src/​domain-patterns.test.ts Adds regression tests for protocol-aware wildcard pattern fallthrough.

Review effort: Lite (auto)

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install gh-aw extension

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

✅ Copilot review passed with no inline comments.

@github-actions[bot] Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

Copilot AI left a comment

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.

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

No open issues 🎉

Review effort: Lite (auto)

@lpcox
lpcox merged commit 1c63c45 into main Nov 9, 2026
42 of 48 checks passed
@lpcox
lpcox deleted the test-quality/pattern-protocol-fallthrough-cb98836dc6412fe5 branch November 9, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants