Merge remote-tracking branch 'origin/main' into refactor/horizon-items
# Conflicts: # crates/horizon-items/src/item_data.rs
This commit is contained in:
+185
-5
@@ -114,6 +114,10 @@ address. The script then checks, from both sides, what a guest's game used to ge
|
||||
use to completion still consumes the item (#1293).
|
||||
- eating: each side sees the other player eat: the item in use (LivingEntity's flags) on the
|
||||
player it draws, and no longer once the bread is eaten (#803);
|
||||
- eat_full: holding right click with melon slices until the food bar is full: the guest's own
|
||||
client eats each slice when the server says it is done (entity event 9,
|
||||
USE_ITEM_COMPLETE), so no other bite starts; held on chorus fruit, both fruits are
|
||||
eaten across its cooldown (#2471).
|
||||
- xp: experience orbs 4 blocks away fly to the guest, show on the guest's screen and give the
|
||||
guest their points (not the host).
|
||||
- objects: boats, minecarts, armor stands, item frames and paintings the host summons reach the
|
||||
@@ -301,7 +305,7 @@ CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sp
|
||||
'eat', 'eating', 'xp', 'objects', 'projectiles', 'thrown', 'sparks', 'hud', 'sidebar', 'border', 'particles',
|
||||
'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects',
|
||||
'portals', 'distance', 'growth', 'doors', 'flight', 'ladder', 'boats', 'minecarts', 'frames', 'hands',
|
||||
'lightning', 'riding', 'mounts', 'worldspawn', 'beds', 'shield', 'deathmining', 'contacts', 'absorption',
|
||||
'lightning', 'riding', 'occupied_horse', 'mounts', 'worldspawn', 'beds', 'shield', 'deathmining', 'contacts', 'absorption',
|
||||
'breath', 'lava', 'levels', 'drops', 'underwater', 'fireworks']
|
||||
|
||||
|
||||
@@ -4239,6 +4243,49 @@ def check_riding(host, guest, out):
|
||||
return result
|
||||
|
||||
|
||||
def check_occupied_horse(host, guest, out):
|
||||
"""#1759: a mob passenger fills a zombie horse's seat, for both real players."""
|
||||
spots = apart(host, guest)
|
||||
result = {}
|
||||
tag = 'occupied_horse'
|
||||
host('command', command='time set midnight')
|
||||
for label, player in (('host', host), ('guest', guest)):
|
||||
x, y, z = spots[label]
|
||||
at = (x + 0.5, y, z + 2.5)
|
||||
player('command', command='gamemode creative')
|
||||
player('command', command='clear @s')
|
||||
result[label] = {}
|
||||
for occupied in (True, False):
|
||||
passengers = ',Passengers:[{id:"minecraft:zombie",NoAI:1b,PersistenceRequired:1b}]' if occupied else ''
|
||||
try:
|
||||
player('command', command=f'summon minecraft:zombie_horse {at[0]} {y} {at[2]} '
|
||||
f'{{Tame:1b,NoAI:1b,NoGravity:1b,Tags:["{tag}"]{passengers}}}')
|
||||
player.wait(5)
|
||||
horse = next(m for m in player.raw('mobs', 16)['near']
|
||||
if m['kind'] == 'minecraft:zombie_horse' and m['health'] > 0
|
||||
and math.dist(m['pos'], at) < 0.1)
|
||||
if occupied:
|
||||
# Assert the setup too: a missing passenger would make this a false positive.
|
||||
passengers_nbt = host('command', command=f'data get entity @e[tag={tag},limit=1] Passengers')
|
||||
assert 'minecraft:zombie' in json.dumps(passengers_nbt), passengers_nbt
|
||||
player.raw('look-at', at[0], y + 0.8, at[2])
|
||||
player.raw('mouse', 'right', 'click')
|
||||
player.wait(10)
|
||||
riding = player('status').get('riding')
|
||||
expected = None if occupied else horse['id']
|
||||
assert riding == expected, f'{label}: occupied={occupied}, riding={riding}, expected={expected}'
|
||||
result[label]['occupied' if occupied else 'free'] = riding
|
||||
player.shot(out, f'occupied-horse-{label}-{occupied}')
|
||||
if not occupied:
|
||||
hold(player, 'shift', 5)
|
||||
finally:
|
||||
player('command', command=f'kill @e[tag={tag}]')
|
||||
player('command', command=f'kill @e[type=minecraft:zombie,x={x},y={y},z={z},distance=..6]')
|
||||
player('command', command=f'tp @s {x + 0.5} {y} {z + 0.5} 0 0')
|
||||
player.wait(25)
|
||||
return result
|
||||
|
||||
|
||||
# Mount inventories: (kind, summon NBT, what goes in by shift-click and the menu slot it lands
|
||||
# in: 700 the saddle, 701 the body armour or carpet, 710 the chest's first slot).
|
||||
MOUNT_MENUS = [
|
||||
@@ -4729,7 +4776,7 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour,
|
||||
'barter': check_barter, 'worn': check_worn, 'kills': check_kills,
|
||||
'arrows': check_arrows, 'predict': check_predict, 'ladder': check_ladder,
|
||||
'boats': check_boats, 'minecarts': check_minecarts, 'frames': check_frames, 'hands': check_hands,
|
||||
'lightning': check_lightning, 'riding': check_riding, 'mounts': check_mounts,
|
||||
'lightning': check_lightning, 'riding': check_riding, 'occupied_horse': check_occupied_horse, 'mounts': check_mounts,
|
||||
'worldspawn': check_world_spawn, 'beds': check_beds, 'shield': check_shield, 'deathmining': check_death_mining,
|
||||
'contacts': check_contacts, 'absorption': check_absorption, 'breath': check_breath,
|
||||
'lava': check_lava, 'levels': check_levels, 'drops': check_drops,
|
||||
@@ -4748,9 +4795,17 @@ def run(ctl, out, resources, checks):
|
||||
host, guest = Game('host', ctl, resources), Game('guest', ctl, resources)
|
||||
# Either way explicitly: the game's default is the server thread.
|
||||
host.d.env['HORIZON_SERVER_THREAD'] = '1' if SERVER_THREAD else '0'
|
||||
# A headless run (HORIZON_E2E_HEADLESS) has no focused window to draw in: the games render
|
||||
# offscreen and never pause on the focus loss, or the world would stand still.
|
||||
headless = bool(os.environ.get('HORIZON_E2E_HEADLESS'))
|
||||
launch = ['launch']
|
||||
if headless or sys.platform == 'darwin':
|
||||
launch.append('--offscreen')
|
||||
if headless:
|
||||
launch.append('--no-pause')
|
||||
results = {}
|
||||
try:
|
||||
host.pid = host('launch', wait=False, offscreen=sys.platform == 'darwin')['pid']
|
||||
host.pid = host.raw(*launch)['pid']
|
||||
# Guests' commands need the world's Allow Commands as well as the LAN's (#372): a creative
|
||||
# world has them; everyone plays in survival.
|
||||
host.raw('open', 'Lan', 5, 'creative')
|
||||
@@ -4764,7 +4819,7 @@ def run(ctl, out, resources, checks):
|
||||
host('command', command='gamerule spawn_mobs false')
|
||||
port = host.raw('lan', 'open', 0, 'commands')['port']
|
||||
host.player = host.raw('lan', 'status').get('host', 'Player') # the host's profile name
|
||||
guest.pid = guest('launch', wait=False, offscreen=sys.platform == 'darwin')['pid']
|
||||
guest.pid = guest.raw(*launch)['pid']
|
||||
guest.raw('connect', f'127.0.0.1:{port}', GUEST_NAME)
|
||||
guest.raw('wait-for', 'loaded', '--timeout', 300)
|
||||
guest.wait(40)
|
||||
@@ -5218,6 +5273,64 @@ CHECKS += ['helduse']
|
||||
CHECK_FNS.update(helduse=check_held_use)
|
||||
|
||||
|
||||
def check_eat_full(host, guest, out):
|
||||
"""Holding right click past a full food bar starts no other bite; chorus fruit's cooldown
|
||||
doesn't leave the use stuck (#2471)."""
|
||||
guest('command', command='gamemode survival')
|
||||
guest('command', command='clear @s')
|
||||
# Full health: natural regeneration at 18 food or more would eat into the bar.
|
||||
guest('command', command='effect give @s minecraft:instant_health 1 10')
|
||||
guest('command', command='effect give @s minecraft:hunger 60 127')
|
||||
for _ in range(400):
|
||||
if remote(guest)['food'] <= 17:
|
||||
break
|
||||
guest.wait(1)
|
||||
guest('command', command='effect clear @s')
|
||||
guest('command', command='give @s minecraft:melon_slice 16')
|
||||
guest.wait(5)
|
||||
guest.raw('select', 'minecraft:melon_slice')
|
||||
hungry = remote(guest)['food']
|
||||
# A slice (2 food) takes 32 ticks (1.6 s): the button stays down well past the slices that fill
|
||||
# the bar, with room for a slow server.
|
||||
slices = -(-(20 - hungry) // 2)
|
||||
hold = threading.Thread(target=guest.raw, args=('use-item', '--hold', slices * 4.0 + 6.0))
|
||||
hold.start()
|
||||
deadline = time.monotonic() + slices * 4.0 + 2.0
|
||||
while remote(guest)['food'] < 20 and time.monotonic() < deadline:
|
||||
time.sleep(0.1)
|
||||
# The bar is full and the button is still down: nothing is in use over the next 20 ticks
|
||||
# (sleeps, as `wait` is refused while the held use-item runs).
|
||||
using = []
|
||||
for _ in range(4):
|
||||
time.sleep(0.25)
|
||||
using.append(guest('state').get('using'))
|
||||
guest.shot(out, 'eat-full')
|
||||
hold.join()
|
||||
guest.wait(10)
|
||||
full = {'hungry': hungry, 'fed': remote(guest)['food'], 'using': using,
|
||||
'eaten': 16 - guest('inventory')['counts'].get('minecraft:melon_slice', 0), 'needed': slices}
|
||||
assert hungry < 20, f'the guest is not hungry: {full}'
|
||||
assert full['fed'] == 20 and full['eaten'] == slices, f'the bar did not fill: {full}'
|
||||
assert using == [None] * 4, f'another bite started with a full food bar: {full}'
|
||||
|
||||
# Chorus fruit can always be eaten, then its group cools down for 20 ticks: the client waits
|
||||
# it out (MultiPlayerGameMode.useItem) and eats the second fruit with the button still held.
|
||||
guest('command', command='clear @s')
|
||||
guest('command', command='give @s minecraft:chorus_fruit 2')
|
||||
guest.wait(5)
|
||||
guest.raw('select', 'minecraft:chorus_fruit')
|
||||
guest.raw('use-item', '--hold', 7.0)
|
||||
guest.wait(10)
|
||||
chorus = {'left': guest('inventory')['counts'].get('minecraft:chorus_fruit', 0),
|
||||
'using': guest('state').get('using')}
|
||||
assert chorus == {'left': 0, 'using': None}, f'the held use did not eat both chorus fruits: {chorus}'
|
||||
return {'full': full, 'chorus': chorus}
|
||||
|
||||
|
||||
CHECKS += ['eat_full']
|
||||
CHECK_FNS.update(eat_full=check_eat_full)
|
||||
|
||||
|
||||
def check_consume_release(host, guest, out):
|
||||
"""#1293: releasing a consumable in either hand cancels it on client and server, while
|
||||
holding it to completion applies its effects and remainder (Consumable.onConsume)."""
|
||||
@@ -5262,8 +5375,10 @@ def check_consume_release(host, guest, out):
|
||||
assert effects == before, f'{case} applied consumption effects after release: {cancelled}'
|
||||
game.shot(out, f'consume-release-{hand}-{item}')
|
||||
# A sustained press must still consume normally, including the milk's empty bucket.
|
||||
# The use ends with the server's USE_ITEM_COMPLETE, 32 server ticks after its
|
||||
# UseItem: room for a busy server before letting go.
|
||||
game.raw('mouse', 'right', 'down')
|
||||
game.wait(40)
|
||||
game.wait(50)
|
||||
game.raw('mouse', 'right', 'up')
|
||||
game.wait(10)
|
||||
inventory = game('inventory')
|
||||
@@ -6277,6 +6392,65 @@ CHECKS += ['recipe_removal']
|
||||
CHECK_FNS.update(recipe_removal=check_recipe_removal)
|
||||
|
||||
|
||||
def check_recipe_settings(host, guest, out):
|
||||
"""RecipeBookComponent sends both settings to the server; each player's
|
||||
own book keeps them when the authoritative world saves and reopens (#2290)."""
|
||||
def inventory(game):
|
||||
back_to_game(game)
|
||||
game.raw('key', 'e', 'tap')
|
||||
game.wait(5)
|
||||
return game('screen')['recipe_book']
|
||||
|
||||
def flags(book):
|
||||
return {'open': book['open'], 'filtering': book['filtering']}
|
||||
|
||||
def set_flags(game, opened, filtering):
|
||||
book = inventory(game)
|
||||
if not book['open']:
|
||||
game.raw('click-at', *centre(book['targets'][0]))
|
||||
game.wait(5)
|
||||
book = game('screen')['recipe_book']
|
||||
if book['filtering'] != filtering:
|
||||
target = next(t for t in book['targets'] if t[2:] == [26.0, 16.0])
|
||||
game.raw('click-at', *centre(target))
|
||||
game.wait(5)
|
||||
if not opened:
|
||||
book = game('screen')['recipe_book']
|
||||
game.raw('click-at', *centre(book['targets'][0]))
|
||||
game.wait(5)
|
||||
actual = flags(game('screen')['recipe_book'])
|
||||
assert actual == {'open': opened, 'filtering': filtering}, f'{game.name}: {actual}'
|
||||
game.shot(out, 'recipe-settings-before')
|
||||
back_to_game(game)
|
||||
return actual
|
||||
|
||||
# Deliberately different settings ensure neither player's book overwrites the other's.
|
||||
before = {host.name: set_flags(host, True, True),
|
||||
guest.name: set_flags(guest, False, True)}
|
||||
host.wait(20)
|
||||
guest.raw('disconnect')
|
||||
host.raw('pause')
|
||||
host.raw('click-button', 'Save and Quit to Title')
|
||||
host.raw('wait-for', 'screen', 'title', '--timeout', 120)
|
||||
host.raw('open', 'Lan')
|
||||
host('wait_ready', seconds=400)
|
||||
port = host.raw('lan', 'open', 0, 'commands')['port']
|
||||
guest.raw('connect', f'127.0.0.1:{port}', GUEST_NAME)
|
||||
guest.raw('wait-for', 'loaded', '--timeout', 300)
|
||||
guest.wait(20)
|
||||
after = {}
|
||||
for game in (host, guest):
|
||||
after[game.name] = flags(inventory(game))
|
||||
game.shot(out, 'recipe-settings-reopened')
|
||||
back_to_game(game)
|
||||
assert after == before, f'saved recipe settings reset: before={before}, after={after}'
|
||||
return {'before': before, 'reopened': after}
|
||||
|
||||
|
||||
CHECKS += ['recipe_settings']
|
||||
CHECK_FNS.update(recipe_settings=check_recipe_settings)
|
||||
|
||||
|
||||
def check_recipe_targets(host, guest, out):
|
||||
"""RecipeCommand gives and takes the recipes of each target's own ServerRecipeBook: a
|
||||
`/recipe give|take <other player>` changes that player's book and reaches their client,
|
||||
@@ -7362,9 +7536,15 @@ def check_cushions(host, guest, out):
|
||||
assert player('status').get('riding') is None, seen
|
||||
player('command', command='gamemode creative')
|
||||
player.raw('look-at', at[0], at[1] + .125, at[2])
|
||||
before = {g.name: g('status').get('particles', {}).get('block', 0) for g in (host, guest)}
|
||||
player.raw('mouse', 'left', 'click')
|
||||
player.wait(10)
|
||||
assert not cushions(host) and not cushions(player), seen
|
||||
seen[label]['break_particles'] = {
|
||||
g.name: g('status').get('particles', {}).get('block', 0) - before[g.name]
|
||||
for g in (host, guest)
|
||||
}
|
||||
assert all(n == 10 for n in seen[label]['break_particles'].values()), seen
|
||||
return seen
|
||||
|
||||
|
||||
|
||||
+25
-1
@@ -800,16 +800,21 @@ class LocalExecutor:
|
||||
self.name, self.jobs, self.memory_budget, self.timeout = HOST, jobs, memory_budget, timeout
|
||||
self.max_peak = max_peak # set while other machines can take heavier harnesses
|
||||
self.running = {}
|
||||
self.solo = set() # harnesses that run alone here (solo_harnesses)
|
||||
self.dead = False # this machine never drops out, unlike a remote host
|
||||
self.available, self.measured = 0, 0.0
|
||||
(STATE_DIR / "logs").mkdir(parents=True, exist_ok=True)
|
||||
(STATE_DIR / "traces").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def free(self):
|
||||
if any(harness_of(label) in self.solo for label in self.running):
|
||||
return 0
|
||||
return self.jobs - len(self.running)
|
||||
|
||||
def accepts(self, name):
|
||||
return True
|
||||
# A solo harness waits until nothing else runs here; the others fill the slots meanwhile, so solo ones
|
||||
# run last, alone.
|
||||
return name not in self.solo or not self.running
|
||||
|
||||
def fits(self, expected, only_here=True):
|
||||
"""Admission by recorded peak, within the budget and leaving MEMORY_RESERVE of what is free now.
|
||||
@@ -1462,6 +1467,21 @@ def known_flaky(config):
|
||||
return dict(config.get("known_flaky", {}))
|
||||
|
||||
|
||||
def solo_harnesses(config):
|
||||
"""Harnesses tools/parity_hosts.json's "solo" lists ({name: reason}: those driving game windows, whose frames
|
||||
are drawn on the CPU on Linux runners) run alone on a machine with SOLO_CPUS CPUs or fewer for this process
|
||||
(playhorizon's runner has 4): beside other harnesses there they lose ticks between control requests. The set,
|
||||
or an empty one on a bigger machine. PARITY_SOLO=1 or 0 forces it on or off."""
|
||||
forced = os.environ.get("PARITY_SOLO")
|
||||
cpus = len(os.sched_getaffinity(0)) if hasattr(os, "sched_getaffinity") else os.cpu_count() or 1
|
||||
if forced == "0" or forced != "1" and cpus > SOLO_CPUS:
|
||||
return set()
|
||||
return set(config.get("solo", {}))
|
||||
|
||||
|
||||
SOLO_CPUS = 4
|
||||
|
||||
|
||||
def named_only(config):
|
||||
"""Harnesses tools/parity_hosts.json keeps out of every automatic selection (--changed, --failed, the default,
|
||||
--flake-check): they run only when named or with --all, the nightly audit. {name: reason}"""
|
||||
@@ -1640,6 +1660,10 @@ def main():
|
||||
reuse_oracles = not (args.fresh or args.all)
|
||||
local = LocalExecutor(jobs, int(memory_available() * 0.75), args.timeout,
|
||||
REMOTE_LOCAL_PEAK if remotes and args.jobs is None else None)
|
||||
local.solo = solo_harnesses(config)
|
||||
if local.solo & {harness_of(name) for name in selected}:
|
||||
print(f"Alone on this machine ({SOLO_CPUS} CPUs or fewer), after the others: "
|
||||
f"{', '.join(sorted(local.solo & {harness_of(name) for name in selected}))}", flush=True)
|
||||
results, elapsed = run(selected, state, hasher, environment_key(hasher), [*remotes, local], reuse_oracles,
|
||||
rounds, known_flaky(config))
|
||||
finally:
|
||||
|
||||
@@ -23,23 +23,29 @@
|
||||
"playhorizon": {
|
||||
"ssh": "ludovic@playhorizon",
|
||||
"root": ".actions-runners/horizon/parity-host",
|
||||
"shell": "systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit=horizon-parity-worker-$$ bash -c",
|
||||
"shell": "systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit=horizon-parity-worker-$$ taskset -c 0-3 bash -c",
|
||||
"setup": "test ! -e ~/.actions-runners/horizon/paused && set -a && . ~/.actions-runners/horizon/.env && set +a && export PATH=$(cat ~/.actions-runners/horizon/.path) && unset WAYLAND_DISPLAY && export DISPLAY=:$(cat ~/.actions-runners/horizon/display)",
|
||||
"python": "python3.13",
|
||||
"jobs": 6,
|
||||
"jobs": 3,
|
||||
"nice": 10,
|
||||
"exclude": {
|
||||
"mob_ai": "the vanilla oracle runs out of its 3 GB heap here (OutOfMemoryError in IO workers; passes on the desktop and the Mac) - 2026-10-26 trial",
|
||||
"lan_integration": "two clients rendered on the CPU (lavapipe): different timing subtests fail on each run (elytra, consume-release, barter, critical-hits) - 2026-10-26 trial",
|
||||
"world_reopen": "failed twice here (no Save and Quit button after reopening; the minecart-count flake), passes on the desktop - 2026-10-26 trial"
|
||||
},
|
||||
"note": "a partner's server (Ubuntu, 8 EPYC threads, 30 GB, Detroit; tailnet only), used by nothing else: 6 jobs, in the CI runner's environment, slice and Xvfb screen (tools/ci/linux-runner.sh); the always-on Linux host since the ThinkPad stopped running harnesses (2026-10-26)"
|
||||
"note": "a partner's server (Ubuntu, 8 EPYC threads, 30 GB, Detroit; tailnet only), its CI runner has CPUs 4-7, so workers get 0-3 (as tools/remote.sh runs do) and 3 jobs, in the CI runner's environment, slice and Xvfb screen (tools/ci/linux-runner.sh); the always-on Linux host since the ThinkPad stopped running harnesses (2026-10-26)"
|
||||
}
|
||||
},
|
||||
"local_only": {
|
||||
"save_roundtrip": "runs the game on a virtual screen (vscreen) with a null ALSA device, or offscreen in the logged-in macOS session"
|
||||
},
|
||||
"linux_only": {},
|
||||
"solo": {
|
||||
"remote_fireball": "two game windows (lan_e2e); on 4 CPUs beside other harnesses, screenshots and control requests take ticks the check needs",
|
||||
"remote_fireworks": "two game windows (lan_e2e); a screenshot took ~1.5 s beside 3 other harnesses on playhorizon's runner, past the sparks' life (2026-10-27)",
|
||||
"server_player_sculk": "two game windows (lan_e2e); failed on playhorizon's runner beside other harnesses, passes alone (2026-10-27)",
|
||||
"world_reopen": "a game window reopening a world: failed on playhorizon's runner beside other harnesses (2026-10-27)"
|
||||
},
|
||||
"named_only": {
|
||||
"lan_integration": "the whole lan_e2e suite: ~40 min a run on a loaded runner, and single checks flake under load; run it by name, or tools/lan_e2e.py"
|
||||
},
|
||||
|
||||
@@ -290,6 +290,14 @@ def mod_features(crates):
|
||||
return f" --features {','.join(features)}" if features else ""
|
||||
|
||||
|
||||
# What horizon-client's full content-root tests load (mod_content_tests.rs). They take minutes on prepared data, so
|
||||
# they are #[ignore]d and run here only when one of these changes.
|
||||
CONTENT_ROOT = ("crates/horizon-client/src/mod_content", "crates/horizon-client/src/assets.rs",
|
||||
"crates/horizon-client/src/blocks.rs", "crates/horizon-client/src/items.rs", "crates/horizon-items/",
|
||||
"crates/horizon-mods/", "crates/horizon-assets/")
|
||||
CONTENT_ROOT_TESTS = "cargo test --locked -p horizon-client --features horizon-client/mods --lib mod_content::tests:: -- --ignored"
|
||||
|
||||
|
||||
def plan(args, base, changed, crates_of, libraries, dependencies):
|
||||
"""The checks for these changed files, in the order they run."""
|
||||
rust = any(workspace_rust(path) for path in changed)
|
||||
@@ -323,6 +331,9 @@ def plan(args, base, changed, crates_of, libraries, dependencies):
|
||||
skip=test_skip, summary=tests_passed),
|
||||
Step("doc tests", f"cargo test --locked {doc_selection} --doc",
|
||||
skip=test_skip or (None if doc_crates else "no library touched"), summary=tests_passed),
|
||||
Step("content root tests", CONTENT_ROOT_TESTS, summary=tests_passed,
|
||||
skip=None if crates is None or any(p.startswith(CONTENT_ROOT) for p in changed)
|
||||
else "content root untouched"),
|
||||
Step("tokens.css up to date", "cargo test --locked -p horizon-theme --lib tokens_css_is_up_to_date",
|
||||
skip=None if any(p.startswith(("crates/horizon-theme/", "xtask/")) for p in changed)
|
||||
else "theme untouched"),
|
||||
|
||||
+11
-1
@@ -347,7 +347,17 @@ def bullet(pr):
|
||||
def known_issues(path=ROOT / "docs" / "known-issues.md"):
|
||||
if not path.exists():
|
||||
return []
|
||||
return [line.rstrip() for line in path.read_text().splitlines() if line.startswith("- ")]
|
||||
issues = []
|
||||
in_bullet = False
|
||||
for line in path.read_text().splitlines():
|
||||
if line.startswith("- "):
|
||||
issues.append(line.rstrip())
|
||||
in_bullet = True
|
||||
elif in_bullet and line.startswith((" ", "\t")) and line.strip():
|
||||
issues[-1] += " " + line.strip()
|
||||
else:
|
||||
in_bullet = False
|
||||
return issues
|
||||
|
||||
|
||||
def line_intro(kind, version, previous):
|
||||
|
||||
+26
-11
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run a command on a Linux build host (default playhorizon) at a worktree's commit, and get its output back.
|
||||
#
|
||||
# tools/remote.sh [--host H] [--name N] [--cpus LIST] [--jobs J] <worktree> <command...>
|
||||
# tools/remote.sh [--host H] [--name N] [--cpus LIST] [--exclusive] [--jobs J] <worktree> <command...>
|
||||
# tools/remote.sh .claude/worktrees/my-fix cargo test -p horizon-world --lib
|
||||
# tools/remote.sh . python3 tools/parity.py food light
|
||||
# tools/remote.sh --cpus 0-3 --exclusive . python3 tools/perf_bench.py # a benchmark: CPUs 0-3 to itself
|
||||
# tools/remote.sh --list # checkouts on the host, their size and last use
|
||||
# tools/remote.sh --gc [DAYS] # remove checkouts unused for DAYS (default 2)
|
||||
#
|
||||
@@ -18,19 +19,24 @@
|
||||
# What the command leaves running is stopped when it ends; stopping this script stops the command on the host.
|
||||
# The exit status is the command's.
|
||||
#
|
||||
# CPUs: playhorizon's CI runner has CPUs 4-7 (a systemd drop-in pins it, docs/release-flow.md), so runs here get
|
||||
# 0-3 by default and never slow a pull request's parity job. A run holds its CPU set's lock shared; --exclusive (a
|
||||
# benchmark: name it with --cpus and say so in its pull request) holds it alone, so it starts only when no other run
|
||||
# uses those CPUs, and the others wait for it to end. --cpus 4-7 or all compete with CI: only when it is idle.
|
||||
#
|
||||
# The host is lent by a partner who keeps hypervisor access: never send secrets, tokens or credentials there,
|
||||
# and never treat a result from it as a CI result.
|
||||
set -euo pipefail
|
||||
|
||||
# CPUs 0-3 stay free for benchmarks (perf-world-entry measures on playhorizon pinned to them); --cpus all for every one.
|
||||
host=playhorizon name="" jobs="" cpus=4-7
|
||||
usage() { sed -n '2,8s/^# \{0,1\}//p' "$0" >&2; exit 2; }
|
||||
host=playhorizon name="" jobs="" cpus=0-3 exclusive=0
|
||||
usage() { sed -n '2,9s/^# \{0,1\}//p' "$0" >&2; exit 2; }
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--host) host=$2; shift 2;;
|
||||
--name) name=$2; shift 2;;
|
||||
--jobs) jobs=$2; shift 2;;
|
||||
--cpus) cpus=$2; shift 2;;
|
||||
--exclusive) exclusive=1; shift;;
|
||||
--list) exec ssh "ludovic@$host" 'cd ~/remote-work 2>/dev/null && for d in */; do d=${d%/};
|
||||
printf "%-32s %8s last used %s\n" "$d" "$(du -sh "$d" 2>/dev/null | cut -f1)" "$(stat -c %y "$d.logs" 2>/dev/null | cut -c1-16)"; done';;
|
||||
--gc) days=${2:-2}; exec ssh "ludovic@$host" "cd ~/remote-work 2>/dev/null || exit 0
|
||||
@@ -58,7 +64,8 @@ command=$(printf '%q ' "$@")
|
||||
# The host side reads its script and these four values on stdin (nothing is re-split by a remote shell); its
|
||||
# own environment comes from the runner's files there.
|
||||
{
|
||||
printf 'name=%q sha=%q jobs=%q cpus=%q command=%q\n' "$name" "$sha" "$jobs" "$cpus" "$command"
|
||||
[[ $cpus =~ ^[0-9,-]+$|^all$ ]] || { echo "remote.sh: --cpus takes a list such as 0-3, or all" >&2; exit 2; }
|
||||
printf 'name=%q sha=%q jobs=%q cpus=%q exclusive=%q command=%q\n' "$name" "$sha" "$jobs" "$cpus" "$exclusive" "$command"
|
||||
cat <<'REMOTE'
|
||||
set -euo pipefail
|
||||
if [ "$cpus" = all ]; then pin=(); jobs=${jobs:-$(nproc)}; else pin=(taskset -c "$cpus"); jobs=${jobs:-$(taskset -c "$cpus" nproc)}; fi
|
||||
@@ -71,19 +78,27 @@ unset WAYLAND_DISPLAY
|
||||
mkdir -p ~/remote-work && cd ~/remote-work
|
||||
exec 9> "$name.lock"
|
||||
flock -n 9 || { echo "remote.sh: $name is busy with another run" >&2; exit 75; }
|
||||
# The CPU set's lock: shared by ordinary runs, held alone by an --exclusive one (a benchmark).
|
||||
exec 8> ".cpus-$cpus.lock"
|
||||
if [ "$exclusive" = 1 ]; then
|
||||
flock -x -n 8 || { echo "remote.sh: other runs use CPUs $cpus; try again when they are done (--list)" >&2; exit 75; }
|
||||
elif ! flock -s -n 8; then
|
||||
echo "remote.sh: an exclusive run (a benchmark) has CPUs $cpus; waiting for it to end" >&2
|
||||
flock -s 8
|
||||
fi
|
||||
if [ ! -d "$name/.git" ]; then
|
||||
git clone -q --filter=blob:none --no-checkout https://github.com/ludovic111/horizon "$name" 9>&-
|
||||
git clone -q --filter=blob:none --no-checkout https://github.com/ludovic111/horizon "$name" 8>&- 9>&-
|
||||
fi
|
||||
cd "$name"
|
||||
# The lock's descriptor stays out of everything started here (9>&-): a daemon one of them starts (sccache's server,
|
||||
# The lock's descriptor stays out of everything started here (8>&- 9>&-): a daemon one of them starts (sccache's server,
|
||||
# from the preparer's build or the command's) would hold the lock after the run.
|
||||
git fetch -q --no-tags origin "$sha" 9>&-
|
||||
git fetch -q --no-tags origin "$sha" 8>&- 9>&-
|
||||
git checkout -q --force --detach "$sha"
|
||||
git clean -qfd -e /target -e /.local
|
||||
# The host's vanilla data, linked as CI's runner links it; for harnesses also .local/horizon-client, prepared by
|
||||
# this commit's own preparer (once per preparer version, kept beside the data and shared by every name).
|
||||
if [[ $command =~ parity|lan_e2e|horizon-prepare ]]; then
|
||||
RUNNER_WORKSPACE=$(dirname "$HORIZON_SHARED_SOURCE") RUNNER_TEMP=$(mktemp -d) bash tools/ci/vanilla-data.sh >&2 9>&-
|
||||
RUNNER_WORKSPACE=$(dirname "$HORIZON_SHARED_SOURCE") RUNNER_TEMP=$(mktemp -d) bash tools/ci/vanilla-data.sh >&2 8>&- 9>&-
|
||||
else
|
||||
mkdir -p .local
|
||||
for d in minecraft tools datagen; do
|
||||
@@ -103,11 +118,11 @@ unit=remote-$name.scope
|
||||
systemctl --user stop "$unit" 2>/dev/null || true
|
||||
session=$PPID
|
||||
( while kill -0 "$session" 2>/dev/null; do sleep 2; done; systemctl --user stop "$unit" 2>/dev/null ) \
|
||||
< /dev/null > /dev/null 2>&1 9>&- &
|
||||
< /dev/null > /dev/null 2>&1 8>&- 9>&- &
|
||||
watcher=$!
|
||||
status=0
|
||||
systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit="$unit" \
|
||||
"${pin[@]}" nice -n 10 bash -c "$command" 2>&1 < /dev/null 9>&- | tee "$log" || status=${PIPESTATUS[0]}
|
||||
"${pin[@]}" nice -n 10 bash -c "$command" 2>&1 < /dev/null 8>&- 9>&- | tee "$log" || status=${PIPESTATUS[0]}
|
||||
kill "$watcher" 2>/dev/null || true
|
||||
systemctl --user stop "$unit" 2>/dev/null || true
|
||||
exit "$status"
|
||||
|
||||
@@ -5,8 +5,9 @@ Each case runs a sequence of operations on a fresh book: awarding recipes
|
||||
(advancement rewards, /recipe give, crafting; special recipes are never
|
||||
learnt, and the count is the displays added), taking them back, the client
|
||||
having seen a highlighted recipe, the open and filter settings of the four
|
||||
book types, and saving and loading the player's recipeBook compound (with
|
||||
unknown ids dropped, and a compound missing a list ignored). The Java oracle
|
||||
book types (through the serverbound settings packet's codec), and saving and
|
||||
loading the player's recipeBook compound (with unknown ids dropped, and a
|
||||
compound missing a list ignored). The Java oracle
|
||||
(VanillaRecipeBookOracle) drives ServerRecipeBook and its codec;
|
||||
examples/probe/recipe_book_fixture drives horizon_client::recipe_book. After each
|
||||
operation the count, the known and highlighted recipes, the settings and
|
||||
@@ -35,6 +36,12 @@ def main():
|
||||
ids = sorted('minecraft:' + p.stem for p in (lib.RESOURCES / 'data/minecraft/recipe').glob('*.json'))
|
||||
rng = random.Random(args.seed)
|
||||
cases = []
|
||||
# Every book and flag combination crosses the wire, then survives a save/load.
|
||||
for book_type in TYPES:
|
||||
for opened in (False, True):
|
||||
for filtering in (False, True):
|
||||
cases.append({'ops': [{'op': 'set', 'type': book_type, 'open': opened,
|
||||
'filtering': filtering}, {'op': 'save'}, {'op': 'load'}]})
|
||||
for _ in range(args.cases):
|
||||
ops, known = [], set()
|
||||
for _ in range(rng.randrange(1, 12)):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
"""A connected client advances ghast fireballs between tracker packets.
|
||||
"""A connected client advances ghast fireballs and thrown items between tracker packets.
|
||||
|
||||
AbstractHurtingProjectile.tick/applyInertia run on clients as well as servers.
|
||||
Like lan_e2e's falling-entity check, sample motion more often than the tracker
|
||||
interval; an interpolation-only client stalls for most of that interval.
|
||||
AbstractHurtingProjectile.tick/applyInertia run on clients as well as servers, and
|
||||
a thrown item ticks itself on the client too. Like lan_e2e's falling-entity check,
|
||||
sample motion more often than the tracker interval; an interpolation-only client
|
||||
stalls for most of that interval (#1762).
|
||||
"""
|
||||
import json
|
||||
import math
|
||||
@@ -40,6 +41,44 @@ def check_motion(host, guest, out):
|
||||
return {'positions': samples}
|
||||
|
||||
|
||||
def check_thrown(host, guest, out):
|
||||
"""A thrown egg, an ender pearl and a wind charge fly on between tracker packets.
|
||||
|
||||
The server sends a thrown item's position every 10 ticks; a client that only
|
||||
eased towards it hung in the air for half a second (#1762). Vanilla's client
|
||||
ticks the projectile itself, as Entity's no-op interpolation handler does.
|
||||
"""
|
||||
x, y, z = (math.floor(v) for v in lan.pos_of(guest))
|
||||
for game in (host, guest):
|
||||
game('command', command='gamemode survival')
|
||||
results = {}
|
||||
for item, kind in (('minecraft:egg', 'Egg'), ('minecraft:ender_pearl', 'EnderPearl'),
|
||||
('minecraft:wind_charge', 'WindCharge')):
|
||||
# A clear lane along +X at the guest's eye height, with room to fall.
|
||||
host('command', command=f'fill {x + 2} {y - 7} {z - 2} {x + 60} {y - 7} {z + 2} minecraft:stone')
|
||||
host('command', command=f'fill {x + 2} {y - 6} {z - 2} {x + 60} {y + 3} {z + 2} minecraft:air')
|
||||
guest('command', command=f'tp @s {x + 0.5:.2f} {y:.2f} {z + 0.5:.2f}')
|
||||
guest.wait(20)
|
||||
guest('command', command='clear @s')
|
||||
guest('command', command=f'item replace entity @s weapon.mainhand with {item}')
|
||||
guest.wait(10)
|
||||
# The server throws along the rotation it has: let it arrive first.
|
||||
guest.raw('look-at', f'{x + 40:.2f}', f'{y + 1.62:.2f}', f'{z + 0.5:.2f}')
|
||||
guest.wait(5)
|
||||
guest.raw('use-item')
|
||||
samples = []
|
||||
for _ in range(6):
|
||||
shots = [p for p in guest('status')['projectiles'] if p['kind'] == kind]
|
||||
samples.append(shots[0]['position'][0] if shots else None)
|
||||
guest.wait(2)
|
||||
seen = [p for p in samples if p is not None]
|
||||
moves = sum(b != a for a, b in zip(seen, seen[1:]))
|
||||
results[item] = {'positions': samples, 'moves': moves}
|
||||
assert len(seen) >= 4, f'{item} visible in only {len(seen)} samples: {samples}'
|
||||
assert moves >= len(seen) - 2, f'{item} stalled between tracker updates: {samples}'
|
||||
return results
|
||||
|
||||
|
||||
def main():
|
||||
subprocess.run(['cargo', 'build', '--locked', '--profile', 'fast', '-p', 'horizon-client',
|
||||
'--bin', 'horizon-client', '--bin', 'horizon-ctl'], cwd=lab.ROOT, check=True)
|
||||
@@ -47,6 +86,7 @@ def main():
|
||||
['cargo', 'metadata', '--format-version', '1', '--no-deps'], cwd=lab.ROOT, text=True))
|
||||
ctl = lab.ROOT / metadata['target_directory'] / 'fast' / 'horizon-ctl'
|
||||
lan.CHECK_FNS['remote-fireball'] = check_motion
|
||||
lan.CHECK_FNS['remote-thrown'] = check_thrown
|
||||
# Use the runner's current display (xvfb on Linux), with fresh isolated homes.
|
||||
lan.game_env = lambda _screen, home: lab.game_env(
|
||||
HORIZON_HOME=home, HORIZON_TELEMETRY_URL='off')
|
||||
@@ -57,7 +97,7 @@ def main():
|
||||
out = lab.LOCAL / 'remote-fireball-parity' / mode
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
# lan.Game launches each client with lab.game_env and private scratch homes.
|
||||
reports[mode] = lan.run(ctl, out, lab.RESOURCES.resolve(), ['remote-fireball'])
|
||||
reports[mode] = lan.run(ctl, out, lab.RESOURCES.resolve(), ['remote-fireball', 'remote-thrown'])
|
||||
lab.write_json(lab.LOCAL / 'remote-fireball-parity' / 'report.json', reports)
|
||||
assert all(r['pass'] for mode in reports.values() for r in mode.values()), reports
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ hosts: the guest always uses the server-player path.
|
||||
import json
|
||||
import math
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
import lab
|
||||
import lan_e2e as lan
|
||||
@@ -43,17 +44,29 @@ def check_walk(host, guest, out, role):
|
||||
until(host, lambda: phase(host), lambda s: 'sculk_sensor_phase=inactive' in s)
|
||||
player.wait(10)
|
||||
assert 'sculk_sensor_phase=inactive' in phase(host), 'setup activated the sensor'
|
||||
player.raw('key', 'w', 'down')
|
||||
# The sensor stays active 30 ticks. Each client samples it every tick from inside one ctl script, so a
|
||||
# runner that answers control requests slowly (frames drawn on the CPU) can't miss that window between
|
||||
# separate requests; the other client samples alongside the walk.
|
||||
probe = f'getblock {sensor[0]} {sensor[1]} {sensor[2]}'
|
||||
other = guest if player is host else host
|
||||
seen = {}
|
||||
|
||||
def watch(viewer, lines):
|
||||
seen[viewer.name] = [r['block'] for r in viewer.script(lines, every=True) if 'block' in r]
|
||||
watcher = threading.Thread(target=watch, args=(other, ['wait 1', probe] * 100))
|
||||
watcher.start()
|
||||
try:
|
||||
player.wait(15)
|
||||
watch(player, ['key w down', *['wait 1', probe] * 15, 'key w up', *['wait 1', probe] * 85])
|
||||
finally:
|
||||
player.raw('key', 'w', 'up')
|
||||
watcher.join()
|
||||
moved = {'client': math.dist(lan.pos_of(player), start),
|
||||
'server': math.dist(lan.server_player(host, player)['position'], start)}
|
||||
assert all(d > 1 for d in moved.values()), moved
|
||||
for viewer in (host, guest):
|
||||
until(viewer, lambda: phase(viewer), lambda s: 'sculk_sensor_phase=active' in s, ticks=85)
|
||||
return {'moved': moved, 'phase': phase(host)}
|
||||
active = {name: next((i for i, s in enumerate(states) if 'sculk_sensor_phase=active' in s), None)
|
||||
for name, states in seen.items()}
|
||||
assert len(active) == 2 and all(i is not None for i in active.values()), f'sensor never active: {seen}'
|
||||
return {'moved': moved, 'first_active_sample': active}
|
||||
finally:
|
||||
player.raw('key', 'w', 'up')
|
||||
host('command', command=f'fill {x - 2} {y} {z - 2} {x + 5} {y + 3} {z + 5} minecraft:air')
|
||||
|
||||
@@ -68,14 +68,23 @@ def main():
|
||||
return json.loads(result.stdout) if result.stdout.strip().startswith('{') else result.stdout
|
||||
|
||||
def carts():
|
||||
found = ctl('status')['carts']
|
||||
return sorted((c['kind'], *(round(v, 1) for v in c['position'])) for c in found)
|
||||
"""The loaded minecarts once their list stops changing: on a loaded runner the mineshaft's chunks and their
|
||||
entities keep arriving after the world counts as loaded, so one reading can be short of a cart."""
|
||||
last = None
|
||||
for _ in range(30):
|
||||
found = sorted((c['kind'], *(round(v, 1) for v in c['position'])) for c in ctl('status')['carts'])
|
||||
if found == last:
|
||||
return found
|
||||
last = found
|
||||
ctl('wait', '40')
|
||||
return last
|
||||
|
||||
ctl('launch', '--resources', str(RESOURCES), '--world', 'reopen', '--seed', '7', '--creative',
|
||||
'--render-distance', '4', *extra)
|
||||
failures = 0
|
||||
try:
|
||||
ctl('wait-ready', '300')
|
||||
ctl('wait-for', 'loaded', '--timeout', '300') # as after each reopen below
|
||||
ctl('command', 'summon minecraft:minecart ~2 ~ ~2')
|
||||
ctl('wait', '20')
|
||||
expected = carts()
|
||||
|
||||
Reference in New Issue
Block a user