Skip to content

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

Merged
EmandM merged 5 commits into
develop-3.x.xfrom
fix/test-canonical-random-bools
Oct 26, 2026
Merged

EmandM merged 5 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.05%   +0.02%     
=================================================
  Files                159      159              
  Lines              27344    27341       -3     
=================================================
+ Hits               20791    20795       +4     
+ Misses              6553     6546       -7     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.11% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

Components Coverage Δ
com.unity.netcode.gameobjects 76.05% <88.46%> (+0.02%) ⬆️

ℹ️ 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

@EmandM
EmandM enabled auto-merge (squash) October 26, 2026 15:58
@EmandM
EmandM merged commit b5c186c into develop-3.x.x Oct 26, 2026
26 checks passed
@EmandM
EmandM deleted the fix/test-canonical-random-bools branch October 26, 2026 20:13
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