From 4c3199ed646daa3a79b1a67c70a2d4baf7d73498 Mon Sep 17 00:00:00 2001 From: ghptc Date: Tue, 27 Oct 2026 08:51:02 -0300 Subject: [PATCH] test(zombies): qualify classic camping and message policy --- docs/zombies-classic.md | 104 +++++++++++++++++++++++++++++++++++ tests/btd_regression.gsc | 57 +++++++++++++++++++ tests/run_btd_integration.py | 5 +- tests/run_btd_regression.py | 24 ++++++-- 4 files changed, 184 insertions(+), 6 deletions(-) create mode 100644 docs/zombies-classic.md diff --git a/docs/zombies-classic.md b/docs/zombies-classic.md new file mode 100644 index 00000000..508c1751 --- /dev/null +++ b/docs/zombies-classic.md @@ -0,0 +1,104 @@ +# Zombies Classic qualification + +## Decision log — 2026-10-27 + +- Fetched engine protected master `db09ce3807cc4a7334bf6477b90f552876c9501c`. + PR #20 is merged, including the undefined death-inflictor field guard and + missing zombie spawn-angle initialization. Keep both private source overlays. +- Workspace PR #15 is merged at + `6c5b4b3a0ff92d2898a179904335c5c85e8863ee`. RCON activation remains a separate + authorization/qualification gate; this change does not enable it. +- Config master was `8fc7c3d16e52e76750e8f3604847b8e01abd18b9`. + [Config PR #12](https://github.com/ghptc/cod4-config-server/pull/12) changes + only existing Zombies policy values: `btd_anticamp=0` and + `btd_msg2="^7Server admins are ^4pitta"`. Original message wording, rotating + message implementation, name color, and mod credits remain intact. +- Inspected verified private plaintext GSC: `_anti_camp_time.gsc` starts its + punishment timer only for values 2/3; `_anti_camp_teleport.gsc` creates map + exclusion triggers only for 1/3. `_initialize.gsc` calls both dispatchers. + Zero suppresses both before they start. No engine changes, geometry bypass, + new commands, or zombie balance changes are needed. +- Preserve original assets and all eight integrity headers through the existing + locked preparation and workspace packaging pipeline. Never commit extracted + scripts or generated runtimes. `sv_pure=1` remains mandatory. + +## Repeatable checks + +Use a newly prepared private runtime packaged by workspace master against the +reviewed config checkout. See [death/wave regression](btd-death-regression.md) +for preparation constraints and existing lifecycle reproductions. + +```sh +python3 -m unittest discover -s tests -p 'test_*.py' +python3 tests/run_btd_regression.py --runtime PRIVATE_RUNTIME --game GAME_DATA --binary bin/cod4x18_dedrun --scenario classic --fixed +python3 tests/run_btd_regression.py --runtime PRIVATE_RUNTIME --game GAME_DATA --binary bin/cod4x18_dedrun --scenario classic --fixed --classic-control timer +python3 tests/run_btd_regression.py --runtime PRIVATE_RUNTIME --game GAME_DATA --binary bin/cod4x18_dedrun --scenario classic --fixed --classic-control teleport +python3 tests/run_btd_regression.py --runtime PRIVATE_RUNTIME --game GAME_DATA --binary bin/cod4x18_dedrun --scenario lifecycle --fixed +python3 tests/run_btd_integration.py --runtime PRIVATE_RUNTIME --game GAME_DATA --catalog CONFIG_CHECKOUT --workspace WORKSPACE_CHECKOUT +``` + +Classic uses the actual vendor timer dispatcher, checks for exclusion triggers, +and holds a synthetic player stationary at a vendor-blocked elevated Crash +position beyond an accelerated timeout. Independent negative controls restore +each original mechanism and must detect it. They test timer activation and +teleport-trigger creation, not every punishment or every map location. +The integration runner injects obsolete nested private camping/message values +and requires canonical policy at startup, every supported map, and restart. +The original lifecycle and Promod integration remain separate required checks. + +## Local evidence + +Engine build `make -j4` passed from the engine master above; tested executable +SHA-256 `ea3d0097320095f7d9080248b6f4ea63a65d646a3bd10f68794a8756a6368918`. +Config head `51a5286d08081e115088a5cf3d082ad6bf283dc4` passed its existing +Configuration check and 22 catalog tests. No original input bytes were edited. + +- Python/native unit suite: 44 tests, success with one optional public-client + checkout test skipped (`COD4X_CLIENT_SOURCE` unset). Sandboxed native execution + was blocked by SIGSYS; the authorized unsandboxed rerun passed. +- Classic native VM: passed, `/tmp/btd-death-regression-beqflkln`. + Timer and teleport negative controls detected their restored mechanisms, + `/tmp/btd-death-regression-ebw3iwns` and + `/tmp/btd-death-regression-hfrxj8_o`; no script errors in these runs. +- BTD all-map integration: 71/71 checks, all 15 maps and restart, + `/tmp/cod4-btd-qualified-iwscbz7o`, against workspace master above. Checks + include canonical configuration precedence, eight headers, pure mode, UDP + administration, denied mode activation, and clean shutdown. +- Fixed lifecycle passed at `/tmp/btd-death-regression-uzdhldmv`: death callback, + respawn, vendor zombie spawning/death handlers, wave two, two UDP admission + handshakes and Strike/Crash transitions. Fixed expression passed at + `/tmp/btd-death-regression-tdv5m0d3`; the original missing-field expression + defect was reproduced at `/tmp/btd-death-regression-maz0tp6d`. +- Independent context/reviewer agent found no blocking issues. Its initial + position-test concern was resolved by asserting the expected elevated height + and horizontal position before the stationary interval. + +Full local logs remain private at those paths. These are synthetic results; +they do not certify human gameplay or a remote deployed image. + +## Delivery gates and rollback + +Owner merge approval is required for both focused PRs after mandatory checks and +independent review. No service was authorized for deployment by this work. +After owner merge and explicit homologation authorization, use the existing +workspace master command, verifying its resolved master revisions and image: + +```sh +COD4_BTD_ASSETS='/tmp/cod4-btd-package/Before The Dawn Alpha 001' COD4_INTEGRITY_HEADERS=/tmp/cod4-btd-prepared/integrity/addiwdheaders ./scripts/deploy-homolog.sh zombies +``` + +Run from the operator's configured ec2-workspace checkout. Do not approve its +final promotion/production-artifact prompt from startup health alone. First +verify the running homologation digest and obtain supervised real-client combat, +death/respawn, waves, camping, elevated positions, message, reconnection and map +transition evidence. No current remote digest is asserted here; preserved +incident inspection is historical. Keep production on its known-good Promod. +Declining that prompt exits nonzero but leaves the successful homologation +candidate running and preserves the existing `.state/approved`; it is not a +rollback. The prompt records approval for later promotion, not a production +deployment. + +Rollback the Classic policy by reverting config PR #12 and rebuilding through +the existing reviewed master workflow; retain PR #20's safety fixes. Runtime +rollback must use the existing workspace procedure and exact previous approved +digest with operator authorization. Do not overwrite preserved PoC evidence. diff --git a/tests/btd_regression.gsc b/tests/btd_regression.gsc index 06d91655..52a7c2ea 100644 --- a/tests/btd_regression.gsc +++ b/tests/btd_regression.gsc @@ -28,6 +28,11 @@ main() return; } setdvar("btd_test_result", "spawned"); + if (getdvar("btd_test_scenario") == "classic") + { + player classic(); + return; + } wait 1; player suicide(); wait 2; @@ -70,3 +75,55 @@ main() kick(player getentitynumber()); setdvar("btd_test_result", "lifecycle_pass"); } + +classic() +{ + // Run the shipped dispatchers. Zero must suppress both independent systems. + self btd_general\_anti_camp_time::main(); + if (isdefined(self.campingtime)) + { + setdvar("btd_test_result", "classic_timer_enabled"); + return; + } + triggers = getentarray("trigger_radius", "classname"); + for (i = 0; i < triggers.size; i++) + { + if (isdefined(triggers[i].goto)) + { + setdvar("btd_test_result", "classic_teleport_enabled"); + return; + } + } + self freezecontrols(true); + // Crash's helicopter is one of the vendor's explicitly blocked positions. + self setorigin((996, 584, 322)); + wait 2; + start = self.origin; + setdvar("btd_test_classic_height", start[2]); + if (start[2] < 230 || distance2d(start, (996, 584, 322)) > 35) + { + setdvar("btd_test_result", "classic_position_failed"); + return; + } + health = self.health; + level.status = "play"; + // More than twice the accelerated camping timeout; no zombies spawn yet. + wait 6; + if (!isalive(self) || self.sessionstate != "playing" || self.health < health || + isdefined(self.campingtime)) + { + setdvar("btd_test_result", "classic_camping_failed"); + return; + } + if (distance(start, self.origin) > 8) + { + setdvar("btd_test_result", "classic_position_failed"); + return; + } + if (getdvar("btd_msg2") != "^7Server admins are ^4pitta") + { + setdvar("btd_test_result", "classic_message_failed"); + return; + } + setdvar("btd_test_result", "classic_pass"); +} diff --git a/tests/run_btd_integration.py b/tests/run_btd_integration.py index 6c467242..1a5ba157 100644 --- a/tests/run_btd_integration.py +++ b/tests/run_btd_integration.py @@ -42,7 +42,8 @@ def load(name): assert (mod / 'canonical-mode.cfg').read_bytes() == (args.catalog / 'modes/zombies/server.cfg').read_bytes() password = secrets.token_hex(16) (mod / 'private.cfg').write_text(f'set rcon_password "{password}"\nexec obsolete.cfg\n') -(mod / 'obsolete.cfg').write_text('set g_gametype "sd"\nset bot_enable "1"\nset btd_grace_time "900"\n') +(mod / 'obsolete.cfg').write_text('set g_gametype "sd"\nset bot_enable "1"\nset btd_grace_time "900"\n' + 'set btd_anticamp "3"\nset btd_msg2 "obsolete administrator fixture"\n') checks = {} for attempt in range(2): with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as channel: @@ -73,6 +74,7 @@ def value(name): state = {name: value(name) for name in ('g_gametype', 'bot_enable', 'btd_grace_time', 'sv_pure')} print('startup', attempt, state, flush=True) checks[f'{attempt}_precedence'] = state == {'g_gametype': 'war', 'bot_enable': '0', 'btd_grace_time': '60', 'sv_pure': '1'} + checks[f'{attempt}_classic_policy'] = value('btd_anticamp') == '0' and value('btd_msg2') == 'Server admins are pitta' checks[f'{attempt}_bad_password'] = 'Bad rcon' in rcon('change_mode zombies', 'invalid-fixture') checks[f'{attempt}_status'] = fs_game in rcon('change_mode') and 'targets: none' in rcon('change_mode') for requested in ('zombies', 'promod', 'hardcore', 'unknown'): @@ -89,6 +91,7 @@ def value(name): state = {name: value(name) for name in ('mapname', 'g_gametype', 'sv_pure')} print('map', state, flush=True) checks[f'{attempt}_{mapname}'] = state == {'mapname': mapname, 'g_gametype': 'war', 'sv_pure': '1'} + checks[f'{attempt}_{mapname}_classic_policy'] = value('btd_anticamp') == '0' and value('btd_msg2') == 'Server admins are pitta' checks[f'{attempt}_credentials_after_maps'] = bool(re.search(r'map\s*:', rcon('status'))) marker = home / 'persistent' / 'qualification-marker' if attempt == 0: diff --git a/tests/run_btd_regression.py b/tests/run_btd_regression.py index 876cd99d..d5583f06 100644 --- a/tests/run_btd_regression.py +++ b/tests/run_btd_regression.py @@ -20,8 +20,12 @@ p.add_argument('--' + name, required=True, type=Path) p.add_argument('--fixed', action='store_true') p.add_argument('--reproduce-spawn-defect', action='store_true', help='Apply death guard only, expect the native missing-angle failure') -p.add_argument('--scenario', choices=('expression', 'death', 'lifecycle'), required=True) +p.add_argument('--scenario', choices=('expression', 'death', 'lifecycle', 'classic'), required=True) +p.add_argument('--classic-control', choices=('timer', 'teleport'), + help='Negative control: restore one original anti-camping mechanism') a = p.parse_args() +if a.classic_control and (a.scenario != 'classic' or not a.fixed): + p.error('--classic-control requires --fixed --scenario classic') assert (a.runtime / '.bot-test-runtime').is_file() spec = importlib.util.spec_from_file_location('btd', ROOT / 'tools/btd/prepare.py') btd = importlib.util.module_from_spec(spec); spec.loader.exec_module(btd) @@ -53,6 +57,11 @@ if a.scenario == 'lifecycle': with (mod/'canonical-mode.cfg').open('a') as cfg: cfg.write('\nset btd_grace_time "10"\nset btd_wave_settings "2"\nset btd_start_zoms "5"\n') +if a.scenario == 'classic': + with (mod / 'canonical-mode.cfg').open('a') as cfg: + cfg.write('\nset btd_camp_max_time "2"\nset btd_camp_message_time "1"\n') + if a.classic_control: + cfg.write('set btd_anticamp "' + {'timer': '2', 'teleport': '1'}[a.classic_control] + '"\n') with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s: s.bind(('127.0.0.1', 0)); port = s.getsockname()[1] cmd = [str(home / 'cod4x18_dedrun'), '+set', 'dedicated', '1', '+set', 'net_ip', '127.0.0.1', @@ -94,8 +103,8 @@ def admit(attempt): text = re.sub(r'\^[0-9]', '', logpath.read_text(errors='replace')) if 'script runtime error' in text or 'script compile error' in text: break proc.stdin.write(b'btd_test_result\nbtd_test_respawn\nbtd_test_zombie_spawn\nbtd_test_wave\n'); proc.stdin.flush() - success = {'expression': 'expression_pass', 'death': 'death_callback_survived', 'lifecycle': 'lifecycle_pass'}[a.scenario] - if '"'+success+'"' in text or re.search(r'"(?:spawn|respawn|zombie_spawn|wave)_failed"', text): break + success = {'expression': 'expression_pass', 'death': 'death_callback_survived', 'lifecycle': 'lifecycle_pass', 'classic': 'classic_pass'}[a.scenario] + if '"'+success+'"' in text or re.search(r'"(?:spawn|respawn|zombie_spawn|wave)_failed"|"classic_[a-z_]+(?:failed|enabled)"', text): break if a.scenario == 'lifecycle' and '"lifecycle_pass"' in text and not a.reproduce_spawn_defect: time.sleep(2) for attempt in range(2): @@ -122,11 +131,16 @@ def admit(attempt): 'respawn_pass': '"btd_test_respawn" is: "passed"' in text, 'zombie_spawn_pass': '"btd_test_zombie_spawn" is: "passed"' in text, 'wave_pass': '"btd_test_wave" is: "passed"' in text, + 'classic_pass': '"classic_pass"' in text, + 'classic_control': a.classic_control, + 'classic_control_detected': bool(a.classic_control and '"classic_'+a.classic_control+'_enabled"' in text), 'lifecycle_pass': '"lifecycle_pass"' in text} (home/'results.json').write_text(json.dumps(result, indent=2)+'\n') print(json.dumps(result, indent=2)) -expected = result[{'expression':'expression_pass','death':'death_callback_survived','lifecycle':'lifecycle_pass'}[a.scenario]] -if a.reproduce_spawn_defect: +expected = result[{'expression':'expression_pass','death':'death_callback_survived','lifecycle':'lifecycle_pass','classic':'classic_pass'}[a.scenario]] +if a.classic_control: + assert not error and result['classic_control_detected'], 'Negative control not detected: '+str(home) +elif a.reproduce_spawn_defect: assert error and 'type undefined is not a vector' in text, 'Spawn defect not reproduced: '+str(home) elif a.fixed: assert not error and expected, 'Fixed regression failed: '+str(home) else: assert error and "has unmatching types 'undefined' and 'string'" in text, 'Expected failure not reproduced: '+str(home)