[PR #4824] [MERGED] Game tests: the runner, block-based and function tests; RUN starts the test #5874

Closed
opened 2026-11-03 05:15:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4824
Author: @levzzz5154
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: parity/T2-runner


📝 Commits (2)

  • c5abd34 Game tests: the runner, block-based and function tests, RUN starts the test
  • 12eb38e Merge hr/main into parity/T2-runner

📊 Changes

4 files changed (+1058 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+8 -0)
➕ crates/horizon-client/src/game/game_tests.rs (+960 -0)
📝 crates/horizon-client/src/game/test_blocks.rs (+11 -1)
📝 crates/horizon-client/src/game/test_instances.rs (+79 -16)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #3520 (stage 2 of 3 for the game-test runner: the runner and RUN; /test follows). Mostly one new file (game/game_tests.rs, about 900 lines with its tests): the runner's pieces only work together.

Rows

  • ServerGamePacketListenerImpl.handleTestInstanceBlockAction (RUN): the action now starts the test (TestInstanceBlockEntity.runTest -> GameTestRunner -> TestCommand.trackAndStartRunner), instead of only placing the structure.

What changed

  • GameTestInfo: the structure placed (prepareTestStructure: the block's data, placeStructure, encaseStructure with barriers, block ticks and events of the area cleared), the -(setup_ticks + 2) countdown, tickInternal (start, actions due, timeout), succeed/fail/finish.
  • GameTestTicker / GameTestRunner: batches by environment (50 to a batch), runBatch, the tests ticked once per server tick for the level they are in, a clear (GameTestTicker.clear) deferred to the end of a pass in progress.
  • BlockBasedTestInstance.run: finds the one START block (the two test_block.error.* failures), triggers it and checks every tick: an ACCEPT block triggered succeeds, a triggered FAIL block fails with its message, a triggered LOG block logs and resets. FunctionGameTestInstance with the one built-in function, always_pass.
  • GameTestHelper: absolutePos (rotated through StructureTemplate.transform), getBlockEntity and its two assertion errors, forEveryBlockInStructure, onEachTick, GameTestAssertException/AssertPos/Timeout/Unknown descriptions.
  • ReportGameListener: pass sets the block FINISHED (green beam) and tells every player; a failure stores the error message on the block (red or orange beam), says it in red (yellow when optional), and an assertion at a position adds an error marker. TestSummaryDisplayer (commands.test.summary*, batch.starting) to the console and the operators, FailedTestTracker, barriers removed on a pass.
  • The test's data (max/setup ticks, environment, function) is read with the rest of the test instance.

Not done in this PR

Test sequences (GameTestSequence, succeedWhen...), retries and flaky tests (RetryOptions, max_attempts), environment definitions other than the empty all_of, force-loading the chunks and removing the entities of a finished test, the coordinate hints the summary logs, GlobalTestReporter files.

Vanilla followed

TestInstanceBlockEntity.runTest, GameTestInfo.*, GameTestTicker.*, GameTestRunner.*, GameTestBatchFactory.fromGameTestInfo, BlockBasedTestInstance.*, FunctionGameTestInstance.run, BuiltinTestFunctions, ReportGameListener.*, MultipleTestTracker, TestCommand.trackAndStartRunner and its summary listeners, GameTestHelper.absolutePos/getBlockEntity/forEveryBlockInStructure/onEachTick, MinecraftServer.tickServer.

Tests

game::game_tests::tests (countdown, per-tick actions, a failure kept over a success, error messages). fmt and clippy -D warnings clean on horizon-client. Not run in the game.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4824 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/T2-runner` --- ### 📝 Commits (2) - [`c5abd34`](https://github.com/horizon-rust/horizon/commit/c5abd34fb1aa71dc9c8ddea873a19eacde32e31c) Game tests: the runner, block-based and function tests, RUN starts the test - [`12eb38e`](https://github.com/horizon-rust/horizon/commit/12eb38e1312b53f87c5768448b52ffd0246bf561) Merge hr/main into parity/T2-runner ### 📊 Changes **4 files changed** (+1058 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+8 -0) ➕ `crates/horizon-client/src/game/game_tests.rs` (+960 -0) 📝 `crates/horizon-client/src/game/test_blocks.rs` (+11 -1) 📝 `crates/horizon-client/src/game/test_instances.rs` (+79 -16) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3520 (stage 2 of 3 for the game-test runner: the runner and RUN; `/test` follows). Mostly one new file (`game/game_tests.rs`, about 900 lines with its tests): the runner's pieces only work together. ## Rows - `ServerGamePacketListenerImpl.handleTestInstanceBlockAction` (RUN): the action now starts the test (`TestInstanceBlockEntity.runTest` -> `GameTestRunner` -> `TestCommand.trackAndStartRunner`), instead of only placing the structure. ## What changed - `GameTestInfo`: the structure placed (`prepareTestStructure`: the block's data, `placeStructure`, `encaseStructure` with barriers, block ticks and events of the area cleared), the `-(setup_ticks + 2)` countdown, `tickInternal` (start, actions due, timeout), `succeed`/`fail`/`finish`. - `GameTestTicker` / `GameTestRunner`: batches by environment (50 to a batch), `runBatch`, the tests ticked once per server tick for the level they are in, a clear (`GameTestTicker.clear`) deferred to the end of a pass in progress. - `BlockBasedTestInstance.run`: finds the one START block (the two `test_block.error.*` failures), triggers it and checks every tick: an ACCEPT block triggered succeeds, a triggered FAIL block fails with its message, a triggered LOG block logs and resets. `FunctionGameTestInstance` with the one built-in function, `always_pass`. - `GameTestHelper`: `absolutePos` (rotated through `StructureTemplate.transform`), `getBlockEntity` and its two assertion errors, `forEveryBlockInStructure`, `onEachTick`, `GameTestAssertException`/`AssertPos`/`Timeout`/`Unknown` descriptions. - `ReportGameListener`: pass sets the block FINISHED (green beam) and tells every player; a failure stores the error message on the block (red or orange beam), says it in red (yellow when optional), and an assertion at a position adds an error marker. `TestSummaryDisplayer` (`commands.test.summary*`, `batch.starting`) to the console and the operators, `FailedTestTracker`, barriers removed on a pass. - The test's data (max/setup ticks, environment, function) is read with the rest of the test instance. ## Not done in this PR Test sequences (`GameTestSequence`, `succeedWhen`...), retries and flaky tests (`RetryOptions`, `max_attempts`), environment definitions other than the empty `all_of`, force-loading the chunks and removing the entities of a finished test, the coordinate hints the summary logs, `GlobalTestReporter` files. ## Vanilla followed `TestInstanceBlockEntity.runTest`, `GameTestInfo.*`, `GameTestTicker.*`, `GameTestRunner.*`, `GameTestBatchFactory.fromGameTestInfo`, `BlockBasedTestInstance.*`, `FunctionGameTestInstance.run`, `BuiltinTestFunctions`, `ReportGameListener.*`, `MultipleTestTracker`, `TestCommand.trackAndStartRunner` and its summary listeners, `GameTestHelper.absolutePos/getBlockEntity/forEveryBlockInStructure/onEachTick`, `MinecraftServer.tickServer`. ## Tests `game::game_tests::tests` (countdown, per-tick actions, a failure kept over a success, error messages). fmt and clippy `-D warnings` clean on horizon-client. Not run in the game. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:15:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5874
No description provided.