Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ It doesn't accept unrelated items.
Use the versions for **Minecraft 1.21.1**, with **NeoForge 21.1.247** and
**Java 21**. You'll need:

- **Sky's Building Pieces 0.3.11.121012** and this add-on.
- **Sky's Building Pieces 0.3.12.121012** and this add-on.
- **Biomes O' Plenty 21.1.0.14**, **TerraBlender 4.1.0.8** and **GlitchCore 2.1.0.2**.

Put those jars in `mods` on both the client and server.
Expand Down
5 changes: 5 additions & 0 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ to export the native launch files. Use one Gradle home for this checkout's
command line and Eclipse launches. The regular client and server use the
merged production output, without test classes or test mods.

The pinned BOP development jars report one allay spawn-registration error,
including in the vendor-only control. Development checks recognise that exact
startup message only with the three verified vendor jar checksums. Raw logs
are kept, and other errors still fail.

## Runtime checks

The test harnesses use Python 3.11 or later. Build the separate runtime
Expand Down
8 changes: 4 additions & 4 deletions gradle/core-dependency.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repository=MinecraftModDevelopmentMods/SkysBuildingPieces
kind=release
commit=4a4f8925cc3a9a77b4a9ad10325d5c8a50867d16
version=0.3.11.121012
commit=6b5c1ae786bc7e164e6341b7304e2e08e70c945a
version=0.3.12.121012
api=1
sha256=C7E8A84301076CE56CDFEA34186AD6EA9AF81D70C8B7489CE1026CDEA2C346A3
development.sha256=C7E8A84301076CE56CDFEA34186AD6EA9AF81D70C8B7489CE1026CDEA2C346A3
sha256=FCDC667590881D75C96471CB6A65DBBA50F859CB6B691EC33834B3C6262B843D
development.sha256=FCDC667590881D75C96471CB6A65DBBA50F859CB6B691EC33834B3C6262B843D
bop_modrinth_version=BtZKRp69
bop_sha256=5F3C8D752C2E0464ECA8C9527D8FFE498129FD37A2FE86A266B64C98371763B1
terrablender_modrinth_version=6e8GCrLb
Expand Down
2 changes: 1 addition & 1 deletion gradle/native-probes.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def compileBootstrap = tasks.register('compileNativeBootstrap', JavaCompile) {
source file(new File(project.ext.coreDirectory, 'src/integrationTest/java/zone/moddev/mc/skysbuildingpieces/probe/RecipeBookChecks.java'))
source file(new File(project.ext.coreDirectory, 'src/integrationTest/java/zone/moddev/mc/skysbuildingpieces/probe/RecombinationChecks.java'))
source file(new File(project.ext.coreDirectory, 'src/integrationTest/java/zone/moddev/mc/skysbuildingpieces/probe/PersistenceRegistrationChecks.java'))
['NativeLegacyChecks', 'DirtCoverageChecks', 'CoverageContributor', 'NativeProbeItems',
['NativeLegacyChecks', 'LiveInventoryRecoveryChecks', 'DirtCoverageChecks', 'CoverageContributor', 'NativeProbeItems',
'SurvivalDropChecks', 'FuelChecks', 'RecipeUniquenessChecks'].each { name ->
source file(new File(project.ext.coreDirectory, 'src/integrationTest/java/zone/moddev/mc/skysbuildingpieces/probe/' + name + '.java'))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void newerCoreOverrideIsLocalOnly() throws Exception {

String pin = text("gradle/core-dependency.properties");

assertTrue(pin.contains("version=0.3.11.121012"));
assertTrue(pin.contains("version=0.3.12.121012"));
assertTrue(pin.contains("api=1"));
}

Expand Down
41 changes: 41 additions & 0 deletions tools/bop_development_notice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""The exact startup notice reproduced with the pinned BOP development jars."""

import re

BOP_SPAWN_CONTROL_HASHES = frozenset({
"5F3C8D752C2E0464ECA8C9527D8FFE498129FD37A2FE86A266B64C98371763B1",
"0C49B5EF447A7F09100E9A210888A7347FBDA0AA75322063991F6063B25FE3F9",
"59D2A3FB3D6877E43018FD6A2B199D526074A864276A5F49091409A1CDC62FAE",
})


def has_controlled_bop_inputs(vendor_inputs):
return BOP_SPAWN_CONTROL_HASHES <= set(vendor_inputs)


BOP_ALLAY_MESSAGE = (
"The following entities have not registered to the RegisterSpawnPlacementsEvent, "
"but a spawn entry was found. This will mean that the entity doesn't have restrictions "
"on its spawn location, please register a spawn placement for the entity, you can "
"register with NO_RESTRICTIONS if you don't want any restrictions."
)
BOP_ALLAY_NOTICE = re.compile(
r"(?m)^\[[^\r\n]+\] \[Server thread/ERROR\] \["
r"(?:net\.neoforged\.neoforge\.server|ne\.ne\.ne\.se)\.ServerLifecycleHooks/\]: "
+ re.escape(BOP_ALLAY_MESSAGE) + r"\n\t - minecraft:allay\n(?![ \t]+-)"
)


def checked_bop_development_text(text):
"""Validate the known startup notice without changing the saved log."""
text = text.replace("\r\n", "\n")
notices = list(BOP_ALLAY_NOTICE.finditer(text))
if len(notices) > 1:
raise ValueError("Repeated BOP allay spawn diagnostic")
if notices:
notice = notices[0]
before = text[:notice.start()]
if "Done (" in before or "Preparing start region for dimension " in before:
raise ValueError("BOP allay spawn diagnostic appeared after startup")
text = text[:notice.start()] + text[notice.end():]
return text
26 changes: 15 additions & 11 deletions tools/native_client_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import re
import tomllib
from native_registry_notices import audit_text, profile_for, audit_biome_proof
from bop_development_notice import checked_bop_development_text



def audit_complete_logs(directory):
def audit_complete_logs(directory, *, bop_development=False):
"""Include rolled first-load logs, so a clean reload cannot hide a failure."""
paths = sorted(path for path in (Path(directory) / "logs").rglob("*")
if path.is_file() and (path.name.endswith(".log") or path.name.endswith(".log.gz")))
Expand All @@ -23,14 +24,16 @@ def audit_complete_logs(directory):
else:
text = path.read_text(encoding="utf-8")
try:
audit_text(text, profile_for(directory))
audit_text(text, profile_for(directory), bop_development=bop_development)
except ValueError as failure:
raise ValueError(str(path) + ": " + str(failure)) from failure
return len(paths)


def classify(log, unchanged_defaults):
def classify(log, unchanged_defaults, *, bop_development=False):
"""Require a complete client login without severe notices."""
if bop_development:
log = checked_bop_development_text(log)
lines = log.splitlines()
severe = [line for line in lines if re.search(r"/(?:ERROR|FATAL)\]", line)]
startup = next((index for index, line in enumerate(lines)
Expand Down Expand Up @@ -64,14 +67,14 @@ def unchanged_native_settings(directory, names):
return True


def audit(directory, phase, control=False):
def audit(directory, phase, control=False, *, bop_development=False):
directory = Path(directory)
log = (directory / "logs/latest.log").read_text(encoding="utf-8")
unchanged = unchanged_native_settings(directory, (
"fml.toml", "neoforge-client.toml", "neoforge-common.toml", "neoforge-server.toml"))
if not unchanged:
raise ValueError("NeoForge settings differ from the controlled defaults")
receipt = classify(log, unchanged)
receipt = classify(log, unchanged, bop_development=bop_development)
required = (("NEOFORGE_CLIENT_CONTROL_PASS joined=true sky_mods=false",) if control else
("BUILDING_PIECES_CLIENT_WORLD_ACCEPTED", "SKY_RECIPE_PREVIEW_MODELS_PASS",
"BUILDING_PIECES_CONTINUOUS_GLASS_PASS", "BUILDING_PIECES_COLOURS_PASS"))
Expand All @@ -88,37 +91,38 @@ def audit(directory, phase, control=False):
raise ValueError("The NeoForge-only control must complete without handshake errors")
if list((directory / "crash-reports").glob("*")):
raise ValueError("Native client produced a crash report")
receipt["complete_log_files"] = audit_complete_logs(directory)
receipt["complete_log_files"] = audit_complete_logs(directory, bop_development=bop_development)
receipt["phase"] = phase
receipt["control_without_sky_mods"] = control
(directory / (phase + "-log-audit.json")).write_text(
json.dumps(receipt, indent=2) + "\n", encoding="utf-8")
return receipt


def classify_server(log, debug, unchanged_defaults, profile=None):
def classify_server(log, debug, unchanged_defaults, profile=None, *, bop_development=False):
"""Require unchanged defaults and a complete native server start."""
lines = log.splitlines()
severe = [line for line in lines if re.search(r"/(?:ERROR|FATAL)\]", line)]
startup = any('Preparing level ' in line or 'Preparing start region for dimension ' in line
for line in lines)
if not unchanged_defaults or not startup or 'Done (' not in log:
raise ValueError('Native server defaults or startup sequence changed')
notices = audit_text(log, profile)
notices = audit_text(log, profile, bop_development=bop_development)
audit_biome_proof(log, profile)
if not debug.strip():
raise ValueError('Native server debug evidence is missing')
return {'native_server_config_notices': 0, 'notices': notices,
'unchanged_native_defaults': True, 'debug_identity_verified': True}

def audit_server(directory, phase):
def audit_server(directory, phase, *, bop_development=False):
directory = Path(directory)
unchanged = unchanged_native_settings(directory, ("fml.toml", "neoforge-common.toml", "neoforge-server.toml"))
receipt = classify_server((directory / 'logs/latest.log').read_text(encoding='utf-8'),
(directory / 'logs/debug.log').read_text(encoding='utf-8'), unchanged, profile_for(directory))
(directory / 'logs/debug.log').read_text(encoding='utf-8'), unchanged, profile_for(directory),
bop_development=bop_development)
if list((directory / 'crash-reports').glob('*')):
raise ValueError('Native server produced a crash report')
receipt['complete_log_files'] = audit_complete_logs(directory)
receipt['complete_log_files'] = audit_complete_logs(directory, bop_development=bop_development)
receipt['phase'] = phase
(directory / (phase + '-server-log-audit.json')).write_text(
json.dumps(receipt, indent=2) + '\n', encoding='utf-8')
Expand Down
5 changes: 4 additions & 1 deletion tools/native_registry_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
from pathlib import Path
import re
from bop_development_notice import checked_bop_development_text


def validate_registry_proofs(root, profile):
Expand Down Expand Up @@ -112,8 +113,10 @@ def audit_biome_proof(text, profile):
raise ValueError("The complete native biome conversion was not verified")


def audit_text(text, profile=None):
def audit_text(text, profile=None, *, bop_development=False):
text = text.replace("\r\n", "\n")
if bop_development:
text = checked_bop_development_text(text)
observed = {}
pattern = r"Unidentified mapping from registry (minecraft:[a-z_/]+)\n(.*?)(?:\n\n)"
for registry, body in re.findall(pattern, text, re.S):
Expand Down
5 changes: 4 additions & 1 deletion tools/run_development_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess

from run_packaged_checks import audit, digest, prepare
from bop_development_notice import has_controlled_bop_inputs


def main():
Expand Down Expand Up @@ -43,7 +44,9 @@ def main():
console = directory / (options.phase + "-console.log")
with console.open("x", encoding="utf-8") as output:
subprocess.run(command, check=True, stdout=output, stderr=subprocess.STDOUT, timeout=600)
audit(directory, options.phase, options.mode)
vendor_inputs = {row["sha256"] for row in expected}
audit(directory, options.phase, options.mode,
bop_development=has_controlled_bop_inputs(vendor_inputs))
print("NEOFORGE_BUILDING_PIECES_BOP_DEVELOPMENT_PASS", options.mode, options.phase)


Expand Down
12 changes: 6 additions & 6 deletions tools/run_packaged_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,25 +287,25 @@ def payload(data, x, z):
output.write("\n")


def audit_console(directory, phase):
def audit_console(directory, phase, *, bop_development=False):
"""Include loader diagnostics that can happen before Minecraft opens its logs."""
path = directory / (phase + "-console.log")
console = path.read_text(encoding="utf-8")
status_error = re.search(r"(?m)^(?:ERROR|FATAL) Status(?:Console)?Listener\b.*", console)
if status_error:
raise ValueError("Unexpected loader logging failure: " + status_error[0])
audit_text(console, profile_for(directory))
audit_text(console, profile_for(directory), bop_development=bop_development)


def audit(directory, phase, mode, biomes_only=False):
audit_console(directory, phase)
def audit(directory, phase, mode, biomes_only=False, *, bop_development=False):
audit_console(directory, phase, bop_development=bop_development)
if mode == "client":
audit_client(directory, phase)
audit_client(directory, phase, bop_development=bop_development)
shutil.copyfile(directory / "logs/latest.log", directory / (phase + "-complete.log"))
shutil.copyfile(directory / "logs/debug.log", directory / (phase + "-debug.log"))
return
log = (directory / "logs/latest.log").read_text(encoding="utf-8")
audit_server(directory, phase)
audit_server(directory, phase, bop_development=bop_development)
required = ("Done (", "BUILDING_PIECES_BOP_NATIVE_BOOTSTRAP_PASS")
if (directory / 'forward-fixture.json').is_file():
required += ('BOP_NATIVE_BIOMES_PASS biomes=73 loaded_chunks=true',) if biomes_only else (
Expand Down
39 changes: 39 additions & 0 deletions tools/test_bop_development_notice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Keep the known vendor notice narrow and all other diagnostics visible."""

import unittest

from bop_development_notice import BOP_ALLAY_MESSAGE, BOP_SPAWN_CONTROL_HASHES, has_controlled_bop_inputs
from native_registry_notices import audit_text


class BopDevelopmentNoticeTest(unittest.TestCase):
def test_complete_vendor_hashes_are_required(self):
expected = set(BOP_SPAWN_CONTROL_HASHES)
self.assertTrue(has_controlled_bop_inputs(expected))
self.assertTrue(has_controlled_bop_inputs(expected | {"another Sky jar"}))
for missing in expected:
with self.subTest(missing=missing):
self.assertFalse(has_controlled_bop_inputs(expected - {missing}))
self.assertFalse(has_controlled_bop_inputs((expected - {missing}) | {"different vendor jar"}))

def test_only_one_exact_startup_notice_is_accepted(self):
prefix = "[time] [Server thread/ERROR] [ne.ne.ne.se.ServerLifecycleHooks/]: "
known = prefix + BOP_ALLAY_MESSAGE + "\n\t - minecraft:allay\n"
startup = '[Server thread/INFO] [MinecraftServer/]: Preparing level "world"\nDone (1.0s)!'
self.assertEqual(audit_text(known + startup, bop_development=True), [])
with self.assertRaises(ValueError):
audit_text(known + startup)
for text in (
known + known + startup,
startup + "\n" + known,
known.replace("minecraft:allay", "minecraft:bat") + startup,
known + "\t - minecraft:bat\n" + startup,
known.replace("ServerLifecycleHooks", "DifferentLogger") + startup,
known + "[time] [Server thread/ERROR] [Sky/]: Broken generation\n" + startup,
):
with self.subTest(text=text), self.assertRaises(ValueError):
audit_text(text, bop_development=True)


if __name__ == "__main__":
unittest.main()
Loading