Skip to content

fix: generate canonical bools in NetworkVariable serialization tests - #4198

Open
NoelStephensUnity wants to merge 4 commits into
develop-3.x.xfrom
fix/test-canonical-random-bools
Open

NoelStephensUnity wants to merge 4 commits into
develop-3.x.xfrom
fix/test-canonical-random-bools

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Purpose of this PR

Fixes 4 NetworkVariableTests failures on the mac arm64 IL2CPP nightly, where List<bool> and NativeHashMap<K, bool> comparisons fail even though both sides print identical contents.

RandGenBytes<bool> filled each bool with a random byte, so most values were neither 0 nor 1. Those print True but can compare unequal under IL2CPP on ARM64. The new RandGenBool returns only false or true, and replaces every RandGenBytes<bool> call site plus the NativeArray<bool> lambda from #4194, so all bool cases share one generator.

Jira ticket

None.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Automated tests:

  • Covered by existing automated tests

Test-only change; the mac arm64 IL2CPP nightly is the confirming run.

Up-port

Not needed; this targets develop-3.x.x.

Backports

develop-2.0.0 uses the same generator (13 call sites); a separate PR if it shows the same failure there.

RandGenBytes<bool> filled each bool with a random byte, so most values were
neither 0 nor 1. On mac arm64 IL2CPP the List<bool> and NativeHashMap<K, bool>
cases then failed with both sides printing identical all-True contents.
RandGenBool returns only false or true.
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code owner October 19, 2026 17:18

@u-pr u-pr Bot 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.

💡 Harness Review

Needs changes

The change consistently replaces raw-byte boolean generation with canonical values across the managed and native collection serialization tests.

Reviewed commit 9d1ac26

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

@@              Coverage Diff               @@
##           develop-3.x.x    #4198   +/-   ##
==============================================
  Coverage          76.03%   76.03%           
==============================================
  Files                159      159           
  Lines              27344    27344           
==============================================
  Hits               20791    20791           
  Misses              6553     6553           
Components Coverage Δ
com.unity.netcode.gameobjects 76.03% <ø> (ø)

ℹ️ Need help interpreting these results?

…tors

With RandGenBool an overwrite keeps the existing value half the time, so when
no elements were added or removed, changed2 could equal original2 and the
"do not match" assertions failed. Each overwrite now redraws until it differs
from the original element.
@NoelStephensUnity NoelStephensUnity changed the title test: generate canonical bools in NetworkVariable serialization tests fix: generate canonical bools in NetworkVariable serialization tests Oct 21, 2026
@NoelStephensUnity

Copy link
Copy Markdown
Member Author

ngo

This branch has not been deployed

No deployments
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.

1 participant