Skip to content

Fix quarantine eligibility for conditional shared test sources - #70098

Merged
wtgodbe merged 4 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/fix-quarantine-conditional-namespaces
Oct 29, 2026
Merged

wtgodbe merged 4 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/fix-quarantine-conditional-namespaces

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Oct 29, 2026

Copy link
Copy Markdown
Member

Associated issue: #70094. Separate from the test quarantine in #70095.

Problem

The quarantine collector selects the first textual namespace in shared sources such as IIS Common.FunctionalTests/HttpsTests.cs. Nested conditional namespaces therefore hide the IIS identity and associate the IISExpress identity with a shared directory that has no project file, rejecting collected failure evidence as source-missing or project-history-incomplete.

Changes

  • Resolve conditional shared sources per actual consuming project using literal DefineConstants and exact Compile Include/Exclude/Remove membership. Mask inactive branches without changing source offsets.
  • Apply the same context to historical source, assembly, identity, and quarantine transitions. Include all consuming-project changes, including multiline symbol-only edits, as history candidates.
  • Preserve fail-closed handling for unsupported ownership, ambiguous history, renames, and project moves. Scope Compile exclusions to their own Include rather than unrelated shared-source items.
  • Add an end-to-end committed-git fixture covering IIS, IISExpress, nested namespaces, excluded consumers, per-branch quarantine history, symbol-only activation/removal, unknown removals, and ordered DefineConstants assignments.

Validation

  • Regression fixture fails against the original collector with source-missing; corrected collector passes the complete eligibility suite.
  • Actual IIS and IISExpress test identities both resolve exactly to HttpsTests.cs and their respective consuming csproj directories.
  • All 21 unquarantine tests, pull-request output validator fixtures, JavaScript issue-handler fixtures, and five workflow-policy tests pass.
  • Two review agents reached consensus after correcting their findings and verifying focused regressions.
  • Ran gh aw compile test-quarantine and strict no-emit validation successfully. Regeneration produces no lockfile diff; the generated lockfile was not manually edited.

This is deliberately not a full MSBuild evaluator. Existing conservative history exclusions remain, and the live scheduled workflow was not dispatched.

Attribute linked test sources to actual consuming projects using literal project constants and Compile membership. Apply matching contexts to current and historical quarantine scans, including project-only symbol changes, while preserving conservative ownership and rename checks.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 17:20
@wtgodbe
wtgodbe requested a review from a team as a code owner October 29, 2026 17:20

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.

🟡 Changes recommended

Shared-source resolution and conditional handling can incorrectly reject eligible tests or report false quarantine removals, while validation rejects legitimate edits affecting multiple consumers.

5 open issues
What changed in this PR

Updates the quarantine eligibility collector to resolve conditional shared test sources in each consuming project’s context, addressing the IIS/IISExpress resolution problem in #70094. The actual test quarantine remains separate in #70095.

Changes:

  • Adds project-aware source resolution using literal symbols and Compile membership, with inactive branches masked without shifting offsets.
  • Extends historical scans to shared sources and project-only changes.
  • Adds regression fixtures and documents supported behavior and conservative limitations.
File Description
.github/​workflows/​scripts/​test-quarantine/​test_collect_case_a_eligibility.py Adds shared-source, conditional-symbol, exclusion, and quarantine-history fixtures.
.github/​workflows/​scripts/​test-quarantine/​README.md Documents project-context resolution and its limitations.
.github/​workflows/​scripts/​test-quarantine/​collect_case_a_eligibility.py Adds consuming-project context to source resolution and historical eligibility checks.

Review effort: Balanced

Normalize wildcard history scopes, match exact declared types, apply consuming-project context to assembly quarantines, and skip proven non-members while retaining unresolved ownership as ambiguous. Validate shared removals by physical attribute locations and require receipts for every affected identity; retain the single-target addition policy.

Co-authored-by: Copilot <[email protected]>

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.

🟡 Changes recommended

Shared-source quarantine removals can pass validation without eligibility evidence for every consuming project or freshness checks covering subsequent linked-source changes.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Respect MSBuild Include and Remove ordering for assembly membership

.github/​workflows/​scripts/​test-quarantine/​collect_case_a_eligibility.py:187

This treats every Compile Remove as a permanent veto, although MSBuild evaluates items in document order. A literal removal of ../Shared/AssemblyInfo.cs followed by a literal include of that same file compiles it, but this function returns False. Both current and historical assembly scans then omit its active quarantine and can classify an already-quarantined test as a new candidate. Preserve Include/Remove ordering when determining membership, or return unknown for unsupported re-inclusion sequences rather than treating them as proven exclusions.

5 resolved since last review

Review effort: Balanced

Check linked source scopes for stale evidence, track individual quarantine annotation locations, and preserve Compile item evaluation order and uncertainty.

Co-authored-by: Copilot <[email protected]>
@wtgodbe

wtgodbe commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Also addressed the review-body finding about Compile item ordering in f2fe384. Literal Include/Remove operations are now evaluated in document order: a later Include restores membership after Remove, while unresolved conditional operations preserve uncertainty. Literal conditional paths remain in history-search scopes so an unresolved linked assembly annotation cannot silently disappear from the analysis. Regression cases cover Remove→Include, Include→Remove, conditional-only re-inclusion, and definite re-inclusion after a conditional removal, checking both current and historical assembly quarantine state.

Validation passed: full eligibility collector and PR-output validator suites, all 21 unquarantine tests, workflow policy and JavaScript handler tests, and gh aw compile test-quarantine --strict. The compiler-generated lockfile remains unchanged.

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.

🔵 Needs a closer look

Shared-source quarantine removals can collapse or omit consuming projects, allowing annotations to be removed without checking every affected project's quarantine history and eligibility.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

High severity Block shared-source edits with unresolved quarantine consumers

.github/​workflows/​scripts/​test-quarantine/​collect_case_a_eligibility.py:320

For a known literal consumer with unsupported DefineConstants, such as a conditional assignment, this drops the conditional-namespace source unless it contains an assembly quarantine. If another consumer resolves successfully, removing a common method quarantine requires only that consumer's receipt, even though the omitted project also compiles the file and loses the annotation. Track unresolved consumers through source indexing and reject shared-source edits until every affected consumer's eligibility can be checked.

High severity Preserve consuming projects for shared assembly quarantine targets

.github/​workflows/​scripts/​test-quarantine/​collect_case_a_eligibility.py:828

When two projects link the same unconditionally quarantined AssemblyInfo.cs, the index now records both consumers, but current_quarantine_targets, collect_requarantine_history, and downstream target keys omit the consuming project and collapse them into one target. Removing that shared attribute can therefore unquarantine both assemblies while checking history and Part 2 eligibility for only one. Preserve the consuming project throughout logical targets and receipts, deduplicating only the physical edit, or reject multi-consumer assembly removals until those checks are supported.

1 resolved since last review

Review effort: Balanced

Retain unresolved consuming projects, fail closed on shared assembly or duplicate-identity removals, and invalidate stale evidence when project changes introduce another consumer.

Co-authored-by: Copilot <[email protected]>
@wtgodbe

wtgodbe commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Addressed both newly reported findings from review #70098 (review) in 560f094.

  • Unresolved consumers: source indexing now retains known/potential literal consumers even when conditional constants or membership cannot be resolved. Their paths are marked unproven in history and Part 2 collection, and the output validator independently rejects edits to them—even if supplied receipts claim eligibility.
  • Collapsed assembly consumers: chose the conservative rejection option. Shared assembly annotations, and shared method/type/data targets with identical logical identities in multiple projects, cannot authorize automatic edits until receipts can distinguish every consumer. Proven distinct-identity shared removals and assembly annotations active in only one consumer remain supported.

Reproduced the previously accepted unsafe removals, added regression/positive-control cases, and also blocked consumers introduced after evidence collection. Full collector, validator, 22 Part 2, five policy, and JavaScript handler tests pass. Real IIS/IISExpress resolution remains exact. Regenerated with gh aw compile test-quarantine --strict; no lockfile change.

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.

🔵 Needs a closer look

Human assessment is needed because shared-consumer discovery can silently omit affected projects, making eligibility-receipt coverage unreliable for shared-attribute removals.

1 open issue

Review effort: Balanced

@wtgodbe
wtgodbe merged commit 72cac49 into dotnet:main Oct 29, 2026
14 checks passed
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:25 — with GitHub Actions Inactive
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:25 — with GitHub Actions Inactive
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:26 — with GitHub Actions Inactive
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:28 — with GitHub Actions Inactive
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:29 — with GitHub Actions Inactive
@wtgodbe
wtgodbe temporarily deployed to copilot-pat-pool October 29, 2026 20:29 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 2%

No docs needed: the PR is internal CI/test-quarantine automation with no signals of user-facing change.

Documentation surfaces considered

  • Conceptual article: Not required — Changes only touch repository automation scripts under .github/workflows/scripts/test-quarantine; no user-facing behavior.
  • Migration guidance: Not required — No upgrade action for users.
  • Breaking change: Not required — No public API or behavior change; internal CI tooling.

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 4, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 560f094f Deployed Oct 29, 2026 by wtgodbe via conclusion #128
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