@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Keep verify's Rust steps for any change beyond website content or documentation."""
|
||||
"""Keep verify's Rust steps for any change beyond documentation."""
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
|
||||
def needs_rust(paths):
|
||||
# horizon-theme's Rust tests check that the generated website tokens match.
|
||||
return any(path == "website/src/tokens.css" or not (
|
||||
path.startswith(("website/", "docs/")) or path.endswith(".md")
|
||||
) for path in paths)
|
||||
return any(not (path.startswith("docs/") or path.endswith(".md")) for path in paths)
|
||||
|
||||
|
||||
def changed_paths(base, head):
|
||||
|
||||
@@ -7103,6 +7103,44 @@ CHECKS += ['sonic']
|
||||
CHECK_FNS['sonic'] = check_sonic
|
||||
|
||||
|
||||
def check_creative_tools(host, guest, out):
|
||||
"""#2035: switching Survival -> Creative cannot mine with a restricted tool.
|
||||
Verify both the player's prediction and the host's authoritative block;
|
||||
an ordinary tool must still break the same block.
|
||||
"""
|
||||
seen = {}
|
||||
for label, player in (('host', host), ('guest', guest)):
|
||||
x, y, z = (int(v // 1) for v in pos_of(player))
|
||||
cell = (x, y + 1, z + 2)
|
||||
host('command', command=f'fill {x - 1} {y} {z + 1} {x + 1} {y + 3} {z + 3} minecraft:air')
|
||||
player('command', command='gamemode survival')
|
||||
player('command', command='item replace entity @s weapon.mainhand with minecraft:netherite_sword')
|
||||
player('command', command='gamemode creative')
|
||||
host('command', command=f'setblock {cell[0]} {cell[1]} {cell[2]} minecraft:stone')
|
||||
player.wait(10)
|
||||
player.raw('look-at', x + 0.5, y + 1.5, z + 2.5)
|
||||
player.raw('mouse', 'left', 'down')
|
||||
try:
|
||||
player.wait(15)
|
||||
finally:
|
||||
player.raw('mouse', 'left', 'up')
|
||||
seen[label] = {'client': player.raw('block', *cell).get('block'),
|
||||
'server': host.raw('block', *cell).get('block')}
|
||||
player.shot(out, 'creative-sword')
|
||||
assert seen[label]['client'] == seen[label]['server'] == 'minecraft:stone', seen
|
||||
player('command', command='item replace entity @s weapon.mainhand with minecraft:diamond_pickaxe')
|
||||
player.wait(6)
|
||||
player.raw('mouse', 'left', 'click')
|
||||
player.wait(10)
|
||||
seen[label]['ordinary_tool'] = host.raw('block', *cell).get('block')
|
||||
assert seen[label]['ordinary_tool'] == 'minecraft:air', seen
|
||||
return seen
|
||||
|
||||
|
||||
CHECKS += ['creative_tools']
|
||||
CHECK_FNS['creative_tools'] = check_creative_tools
|
||||
|
||||
|
||||
def check_cushions(host, guest, out):
|
||||
"""#1935: place a colored cushion, consume it, track it, sit, dismount and break it."""
|
||||
seen = {}
|
||||
|
||||
+6
-12
@@ -8,7 +8,7 @@
|
||||
|
||||
From the files the branch changes since its merge base with --base (committed or not) it decides what to run:
|
||||
rustfmt, clippy with warnings denied and the tests of the touched crates; the launcher (its own workspace) the
|
||||
same way when it, horizon-prepare or horizon-theme changed; website/src/tokens.css against horizon-theme;
|
||||
same way when it, horizon-prepare or horizon-theme changed; crates/horizon-theme/tokens.css against horizon-theme;
|
||||
Cargo.lock changing only with a Cargo.toml; the Python tests and the public-tree check; and the vanilla
|
||||
harnesses the changes can affect, picked as CI's parity job picks them (tools/parity.py --changed). Harnesses run
|
||||
where the vanilla data is (a prepared .local/ here, or the Mac mini); elsewhere they are listed for CI.
|
||||
@@ -68,7 +68,6 @@ mkdir -p "$state/parity-runner" "$state/parity-target"
|
||||
ln -sfn "$state/parity-runner" .local/parity-runner && ln -sfn "$state/parity-target" .local/parity-target""",
|
||||
}
|
||||
ROOT_RUST = {"Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "rustfmt.toml", "clippy.toml"}
|
||||
TOKENS = "website/src/tokens.css"
|
||||
LAUNCHER_FEATURES = """export features=""
|
||||
if [ "$(uname)" = Darwin ] && ! xcrun metal --version > /dev/null 2>&1; then features="--features gpui/runtime_shaders"; fi
|
||||
in_shell() { if [ "$(uname)" = Linux ] && ! pkg-config --exists xkbcommon 2>/dev/null && command -v nix-shell > /dev/null; then
|
||||
@@ -96,8 +95,6 @@ def touched_crates(paths, packages):
|
||||
return None
|
||||
crates = set()
|
||||
for path in paths:
|
||||
if path == TOKENS:
|
||||
path = packages.get("horizon-theme", "crates/horizon-theme") + "/"
|
||||
if is_doc(path):
|
||||
continue
|
||||
owners = [name for name, directory in packages.items() if path.startswith(directory.rstrip("/") + "/")]
|
||||
@@ -113,12 +110,10 @@ def area(path):
|
||||
return None
|
||||
if path.startswith(("launcher/", "crates/horizon-prepare/")):
|
||||
return "launcher"
|
||||
if path.startswith("website/"):
|
||||
return "website"
|
||||
if path.startswith((".github/", "tools/ci/")):
|
||||
return "CI"
|
||||
if path.startswith("crates/horizon-theme/"):
|
||||
return None # the design system feeds the game, the launcher and the website alike
|
||||
return None # the design system feeds the game, the launcher and the website (its tokens.css) alike
|
||||
return "game"
|
||||
|
||||
|
||||
@@ -292,7 +287,7 @@ def plan(args, base, changed, crates_of, libraries, dependencies):
|
||||
# The Python tests also hold ROADMAP.md to roadmap/roadmap.toml (tests/test_roadmap.py).
|
||||
python = any(path.endswith(".py") or path.startswith(("tests/", "tools/", "roadmap/")) or path == "ROADMAP.md"
|
||||
for path in changed)
|
||||
crates = touched_crates(changed, crates_of) if rust or TOKENS in changed else []
|
||||
crates = touched_crates(changed, crates_of) if rust else []
|
||||
# An unrecognised Rust path must not silently skip validation.
|
||||
if rust and crates == []:
|
||||
crates = None
|
||||
@@ -317,8 +312,8 @@ 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("tokens.css up to date", "cargo test --locked -p horizon-theme --lib website_tokens_are_up_to_date",
|
||||
skip=None if any(p.startswith(("crates/horizon-theme/", "xtask/")) or p == TOKENS for p in changed)
|
||||
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"),
|
||||
]
|
||||
launcher_skip = None if launcher else "launcher untouched"
|
||||
@@ -500,8 +495,7 @@ def main():
|
||||
parser.error(f"no merge base with {args.base} (git fetch?)")
|
||||
merge_base = git("merge-base", "HEAD", args.base).strip()
|
||||
counts = line_counts(merge_base, changed)
|
||||
crates_of, libraries, dependencies = packages() if any(workspace_rust(p) for p in changed) or TOKENS in changed \
|
||||
else ({}, set(), {})
|
||||
crates_of, libraries, dependencies = packages() if any(workspace_rust(p) for p in changed) else ({}, set(), {})
|
||||
steps = plan(args, args.base, changed, crates_of, libraries, dependencies)
|
||||
print(f"pr_ready: {len(changed)} files changed since {args.base}; checks on {args.host}", file=sys.stderr, flush=True)
|
||||
|
||||
|
||||
+9
-6
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Horizon's roadmap: roadmap/roadmap.toml is the source, ROADMAP.md is generated from it.
|
||||
|
||||
python3 tools/roadmap.py build write ROADMAP.md and website/data/roadmap.json
|
||||
python3 tools/roadmap.py build write ROADMAP.md and roadmap/roadmap.json
|
||||
python3 tools/roadmap.py build --check fail when either is out of date (CI)
|
||||
python3 tools/roadmap.py check --offline the file's own rules (CI)
|
||||
python3 tools/roadmap.py check the same, then GitHub: links resolve, no stale Now item
|
||||
@@ -28,8 +28,9 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
SOURCE = ROOT / "roadmap" / "roadmap.toml"
|
||||
OUTPUT = ROOT / "ROADMAP.md"
|
||||
# What the website's hub reads (website/build.mjs), and serves at /data/roadmap.json for Kira and others.
|
||||
SITE_DATA = ROOT / "website" / "data" / "roadmap.json"
|
||||
# What the website's hub reads from main at build time (ludovic111/horizon-site), and serves at /data/roadmap.json
|
||||
# for Kira and others.
|
||||
SITE_DATA = ROOT / "roadmap" / "roadmap.json"
|
||||
# The journal's weekly summaries, one file per ISO week: roadmap/journal/2026-43.md (roadmap/README.md).
|
||||
JOURNAL = ROOT / "roadmap" / "journal"
|
||||
WEEK = re.compile(r"(\d{4})-(\d{2})\.md$")
|
||||
@@ -259,7 +260,7 @@ def weeks(directory=JOURNAL):
|
||||
|
||||
|
||||
def site_data(data):
|
||||
"""website/data/roadmap.json: the items as the hub and Kira read them, in the file's order."""
|
||||
"""roadmap/roadmap.json: the items as the hub and Kira read them, in the file's order."""
|
||||
keys = ("id", "title", "status", "area", "plain", "dev", "links", "focus", "ongoing", "shipped_in", "post",
|
||||
"announce")
|
||||
out = {
|
||||
@@ -375,7 +376,9 @@ def online_problems(data, states, now):
|
||||
# --- sync -----------------------------------------------------------------------------------------------------
|
||||
|
||||
def family(paths):
|
||||
"""Which releases carry a change: the launcher's, the website (deployed from main) or the game's."""
|
||||
"""Which releases carry a change: the launcher's, the website (deployed when merged) or the game's. The site
|
||||
left this repository on 2026-10-26 (ludovic111/horizon-site), so only older pull requests are website-only;
|
||||
an item the site alone ships takes shipped_in = "website" by hand."""
|
||||
if paths and all(path.startswith("launcher/") for path in paths):
|
||||
return "launcher"
|
||||
if paths and all(path.startswith("website/") for path in paths):
|
||||
@@ -563,7 +566,7 @@ def command_sync(args):
|
||||
SOURCE.write_text(text)
|
||||
for path, content in outputs(new).items():
|
||||
path.write_text(content)
|
||||
print("roadmap: wrote roadmap/roadmap.toml, ROADMAP.md and website/data/roadmap.json")
|
||||
print("roadmap: wrote roadmap/roadmap.toml, ROADMAP.md and roadmap/roadmap.json")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare Creative mining eligibility for every item and tool overrides."""
|
||||
import json
|
||||
|
||||
try:
|
||||
from . import lab, oracle_harness as harness
|
||||
except ImportError:
|
||||
import lab, oracle_harness as harness
|
||||
|
||||
|
||||
def make_input(build):
|
||||
resources = lab.LOCAL / 'horizon-client' / '26.3'
|
||||
items = json.loads((resources / 'items.json').read_text())
|
||||
rows = [dict(item=item, creative=creative, count=count, tool=tool)
|
||||
for item in sorted(items)
|
||||
for creative in (False, True)
|
||||
for count in (0, 1)
|
||||
for tool in ('default', 'allow', 'deny', 'implicit')]
|
||||
path = build / 'inputs.jsonl'
|
||||
path.write_text(''.join(json.dumps(row) + '\n' for row in rows))
|
||||
return path, len(rows)
|
||||
|
||||
|
||||
def main():
|
||||
harness.differential(
|
||||
'rust-creative-mining-parity', 'VanillaCreativeMiningOracle',
|
||||
'creative_mining_probe', make_input,
|
||||
'Item.canDestroyBlock with each vanilla item, empty stacks, Survival/Creative '
|
||||
'abilities, and explicit/implicit tool overrides. Block destruction and network '
|
||||
'prediction call this predicate; end-to-end packet handling is not covered here.',
|
||||
sources=[lab.ROOT / 'crates/horizon-client/src/items.rs'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user