[ci-fix] Needs review: Fix PolymorphicTests order-dependent assertion on tvOS Mono (refs #128765) - #129653
[ci-fix] Needs review: Fix PolymorphicTests order-dependent assertion on tvOS Mono (refs #128765)#129653github-actions[bot] wants to merge 4 commits into
Conversation
The test MetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifier used Assert.Collection which is order-sensitive. On tvOS Mono, attribute ordering from Type.GetCustomAttributes differs from CoreCLR, causing DerivedTypes to appear as [Cat, Dog] instead of [Dog, Cat]. Since the ECMA specification does not guarantee attribute ordering from GetCustomAttributes, replace the order-sensitive Assert.Collection with Assert.Contains checks that verify both derived types are present with correct discriminators, regardless of order. Remove the [ActiveIssue] annotation that disabled the test on Apple Mobile Mono since the fix addresses the root cause. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @dotnet/area-system-text-json |
…der-128765-55a8cc5e50e04736
There was a problem hiding this comment.
Pull request overview
Updates a System.Text.Json polymorphism test to avoid relying on reflection attribute ordering, improving cross-runtime stability (notably for Mono on Apple mobile targets).
Changes:
- Remove the
[ActiveIssue]skip fromMetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifier. - Replace order-sensitive
Assert.Collectionvalidation ofJsonPolymorphismOptions.DerivedTypeswith order-insensitive count + membership assertions.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Text.Json/tests/Common/PolymorphicTests.TypeClassifier.cs | Makes derived-type assertions order-insensitive and removes the tvOS Mono skip for the affected test. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Workflow state for the Holistic Review Orchestrator. {
"version": 5,
"last_dispatched_commit": "0fa6bd7fd97344489d24ff3733406232f7074481",
"last_dispatched_base_ref": "main",
"last_dispatched_base_sha": "e6428cb16317ce994463cb132690ec728991edd9",
"last_reviewed_commit": "0fa6bd7fd97344489d24ff3733406232f7074481",
"last_reviewed_base_ref": "main",
"last_reviewed_base_sha": "e6428cb16317ce994463cb132690ec728991edd9",
"last_recorded_worker_run_id": "29679153469",
"review_attempt_commit": "",
"review_attempt_base_ref": "",
"review_attempt_count": 0,
"max_review_attempts": 5,
"review_history_format": "holistic-review-disclosure-v1",
"review_history": [
{
"commit": "0fa6bd7fd97344489d24ff3733406232f7074481",
"review_id": 4730521752
}
]
} |
There was a problem hiding this comment.
Holistic Review
Motivation: Justified. The test MetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifier asserted DerivedTypes in the exact order the [JsonDerivedType] attributes are declared, but reflection attribute enumeration order is not guaranteed by ECMA and differs on tvOS Mono, producing a spurious failure (issue #128765). Making the assertion order-independent addresses the real root cause rather than only suppressing the failure via [ActiveIssue].
Approach: Sound and minimal. Replacing the order-sensitive Assert.Collection with a count check plus two Assert.Contains predicates preserves the test's intent (both derived types with correct discriminators are present) while removing the incorrect ordering dependency. Removing the [ActiveIssue] annotation is appropriate since the fix is a genuine correction, and the change is confined to a single test file. DerivedTypes ordering is not semantically significant for serialization correctness — discriminator resolution is keyed by type and discriminator name, not list position — so relaxing the ordering assertion does not weaken meaningful coverage.
Summary: ✅ LGTM. Test-only change that correctly removes an unwarranted reflection-ordering assumption; low risk with no product-code impact. Two non-blocking notes for the human merger: (1) issue #128765 can be closed once this merges, since the [ActiveIssue] suppression is being removed; (2) as the PR description itself notes, it is worth a quick check for other order-sensitive Assert.Collection/Assert.Equal assertions over reflection-derived collections in the polymorphic test suite that could exhibit the same Mono ordering fragility. The author flagged that the change was not build-validated (environment lacked the required SDK); the edit is straightforward and syntactically correct, but CI should confirm the build and the tvOS Mono run.
Note
This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.
Generated by Holistic Review · 49.3 AIC · ⌖ 10.3 AIC · ⊞ 10K
|
Mono mobile doesn't run on CI anymore |
…fixed & retired-leg PRs (#132318) The `ci-failure-fix` workflow keeps opening help-wanted PRs for failures that no longer happen — retired legs (#129653, "Mono mobile doesn't run on CI anymore"), already-merged fixes (#130231), and stale KBEs (#130232). This is the dominant closed-unmerged class over the last several ticks, and prior feedback issues (#131644, #131699) flagged it without a guard ever landing. ## Changes `.github/workflows/ci-failure-fix.md` only — prompt text, no code: - **Step 4, new gate before any fix attempt** (inserted as item 2; following items renumbered 3/4). Three checks, first trip ends the KBE with a recorded skip — no PR, no loop-in comment: - **Recent occurrence** — signature checked against the newest completed builds of the definition plus Build Analysis occurrence data in the KBE body; nothing in 14d → `skipped: no occurrence in last 14d, likely already fixed or retired` - **Live leg** — the leg must appear in the newest completed build's timeline *and* still be defined in `eng/pipelines/**` at `HEAD`; retired Mono-mobile/wasm legs, deleted queues, dropped images → `skipped: failing leg retired, no longer runs at HEAD` - **Fix already landed** — failing source read at `HEAD` plus `git log` since KBE creation; faulty path already removed → `skipped: fix already present at HEAD; KBE stale` - **Recognized skip reasons list** — the three phrasings registered verbatim so the feedback workflow's tally aggregation stays stable. - One pre-existing trailing space removed (line 192); markdownlint runs repo-wide on any PR touching `.md` and MD009 is the sole enabled rule. Placement is deliberate: after Step 3 dedup, before Step 5's fix attempt, mirroring the existing Step 5.1.1 pipeline-category gate. `Recorded skip` is already a valid outcome in the Step-summary table, so no downstream change is needed. ## Notes No lock-file regeneration: `ci-failure-fix.lock.yml` pulls the prompt via `{{#runtime-import .github/workflows/ci-failure-fix.md}}` and stores no hash of the body — only frontmatter changes require a recompile, and the frontmatter is untouched. No other prompt references Step 4 items by number, so the renumbering is contained. Verified `markdownlint-cli` clean on the file. Nothing built or tested — there is no code here. <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #131873 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Workflow artifact: ci-fix
Artifact kind: help
Linked KBE: #128765
Note
This is an AI/Copilot-generated draft PR that attempts to fix the CI failure described in KBE #128765. It has NOT been build-validated (environment lacks .NET 11 SDK). Human review is needed.
Root cause
The test
MetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifierusesAssert.Collection(order-sensitive) to verifyJsonPolymorphismOptions.DerivedTypes. It expects[Dog, Cat]matching the attribute declaration order onAttrClassifiedAnimal:On tvOS Mono,
Type.GetCustomAttributes()returns these attributes in reverse order ([Cat, Dog]), causing the test to fail. The ECMA specification does not guarantee attribute ordering from reflection APIs.Fix
Replace the order-sensitive
Assert.Collectionwith:Assert.Equal(2, options.DerivedTypes.Count)— verifies the expected number of typesAssert.Contains(...)for each type — verifies presence and discriminator without order dependencyRemove the
[ActiveIssue]annotation since this fix addresses the root cause rather than disabling the test.What is unverified / help needed
DerivedTypessemantically significant for JSON serialization behavior? If so, the real fix may be in the product code (ensuring deterministic ordering). If not, this test fix is correct.Suggested reviewers / area contacts
@eiriktsarpalis(area-System.Text.Json owner)@SteveSandersonMSValidation
dotnet build src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csprojEvidence
Filed by
ci-failure-fix, which attempts validated fixes for[ci-scan]Known Build Errors and otherwise loops in owners. Comment here or on the workflow file to suggest changes;ci-failure-scan-feedbackreads in-scope feedback daily and opens (or updates) a PR with prompt edits.Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: