Skip to content

test(net): guard that hidden-zone reveals reach the client delta - #11581

Open
shoeless wants to merge 2 commits into
Card-Forge:masterfrom
shoeless:test/reveal-sync-delta
Open

test(net): guard that hidden-zone reveals reach the client delta#11581
shoeless wants to merge 2 commits into
Card-Forge:masterfrom
shoeless:test/reveal-sync-delta

Conversation

@shoeless

@shoeless shoeless commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds RevealSyncDeltaTest — a deterministic, in-process regression test that verifies a hidden-zone card reveal reaches a networked client through the real delta-sync path.

The test:

  1. Builds an exact board with the existing AITest helpers (no AI, no sockets, ~10s).
  2. Puts one card in a player's hidden Library and confirms they cannot see it.
  3. Adds Future Sight to their battlefield; its continuous MayLookAt$ Player static reveals the top card (verified against CardView.canBeShownTo).
  4. Runs the real DeltaSyncManager.collectDeltas and asserts the top card's PlayerMayLook is present in the delta the client receives.

Why

DeltaSyncManager.walkAndCollect recurses into hidden-zone (Library/Hand) TrackableCollection properties and collects each nested CardView's dirty props — which is what lets a player see their own revealed top card (Future Sight, Garruk's Horde, etc.) on a networked client. That behavior was not covered by any existing test:

  • DeltaSyncUnitTest only checks DeltaPacket byte-size accounting — it never runs collectDeltas on a real GameView.
  • NetworkPlayIntegrationTest checks visibility for public zones only (Battlefield/Graveyard/Exile) and is stress-gated / non-deterministic.

If a future change stopped walking hidden-zone collections, the owning player would silently stop seeing their own revealed top card — this test would catch it. It also documents a reusable pattern for "does host change X reach the client delta?" tests.

Test-only change; no engine/runtime code touched.

🤖 Generated with Claude Code

@tool4ever tool4ever 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.

imo seems too arbitrary to test that deltas would just start ignoring some zones...
besides NetworkChecksumUtil would quickly catch it anyway

@shoeless
shoeless force-pushed the test/reveal-sync-delta branch from e544c05 to 33b1276 Compare August 11, 2026 05:15
…ent delta

RevealSyncDeltaTest sets up an exact board with the AITest helpers (no AI, no
sockets), grants a top-library reveal via Future Sight's continuous static, runs
the real DeltaSyncManager.collectDeltas, and asserts the top card's PlayerMayLook
travels in the delta the networked client receives.

This guards the delta walker: DeltaSyncManager.walkAndCollect recurses into hidden
zone (Library/Hand) collections and collects each nested CardView's dirty props, so
an owner sees their own revealed top card without any extra zone flagging. No
existing test covers this path — DeltaSyncUnitTest only checks packet byte-sizes,
and NetworkPlayIntegrationTest checks public-zone visibility only (and is
stress-gated). If a future change stopped walking hidden-zone collections, this
fails; otherwise it is a fast (~10s), default-run regression guard, and a reusable
pattern for "does host change X reach the client delta?".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shoeless

Copy link
Copy Markdown
Contributor Author

I checked: PlayerMayLook is checksum-eligible, but collectChecksumObjects only walked Battlefield/Hand/Graveyard/Exile/Command — Library never entered a checksum, so a dropped reveal on a library card (the case here: Future Sight / top-of-library effects) couldn't be caught at runtime, and covered-zone detection is sampled rather than prompt.

Added a second commit that includes Library in the checksum walk so runtime does catch it — feel free to drop that commit if it's unwanted, and equally fine closing the test if you'd rather rely on the checksum alone. @MostCromulent — was leaving Library out of the checksum walk deliberate (perf/scope), or just not needed at the time?

@shoeless
shoeless force-pushed the test/reveal-sync-delta branch from 33b1276 to 55594f6 Compare August 11, 2026 06:52
collectChecksumObjects walked Battlefield/Hand/Graveyard/Exile/Command but not
Library, so hidden-zone card state (e.g. a PlayerMayLook reveal from Future
Sight-style effects) could desync silently — no checksum ever saw it. Add
Library to the walk; the collection hash is order-insensitive (sorted ids) and
the cost is a few hundred extra property hashes per sampled checksum.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shoeless
shoeless force-pushed the test/reveal-sync-delta branch from 55594f6 to 5c6b7d4 Compare August 11, 2026 06:54
@MostCromulent

Copy link
Copy Markdown
Contributor

@MostCromulent — was leaving Library out of the checksum walk deliberate (perf/scope), or just not needed at the time?

I'm pretty sure this was just an oversight rather than a deliberate design choice.

@tool4ever

Copy link
Copy Markdown
Contributor

focus was on public zones since walking libraries with little dynamic properties seems rather pointless

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.

3 participants