883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
24 lines
2.0 KiB
Python
24 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Read-only native DB2 relation filters, typed bounds and output preservation."""
|
|
import hashlib,json,subprocess,sys,tempfile
|
|
from pathlib import Path
|
|
root=Path(__file__).resolve().parents[1];build=root/'build/db2-gameplay';tool=build/'DB2Gameplay.dll'
|
|
base=Path.home()/'Projects/WoW-Hybrid/servers/trinity-forever/install/bin/dbc/enUS';dbd=Path.home()/'Projects/WoW-Hybrid/tools/WoWDBDefs/definitions'
|
|
if not tool.exists() or not (base/'ItemXItemEffect.db2').exists():raise SystemExit(77)
|
|
assert (build/'source.sha256').read_text().strip()==hashlib.sha256((root/'ops/gameplay_db2_export.cs').read_bytes()).hexdigest(),'Rebuild local DB2 exporter before testing current source'
|
|
expected=json.loads((root/'docs/evidence/data/item-sparse-compat/native-existing-effect-links.json').read_text());items=sorted({r['ItemID'] for r in expected});selected=','.join(map(str,items))
|
|
with tempfile.TemporaryDirectory(dir=root/'runtime') as directory:
|
|
output=Path(directory)/'rows.json'
|
|
def run(*args,table='ItemXItemEffect'):
|
|
return subprocess.run(['dotnet',str(tool),str(base),str(dbd),table,str(output),'*',*args],capture_output=True,text=True,timeout=20)
|
|
r=run('--where=ItemID:'+selected);assert r.returncode==0,r.stderr
|
|
assert json.loads(output.read_text())==expected
|
|
before=output.read_bytes();assert run('--where=ItemID:'+selected).returncode!=0 and output.read_bytes()==before
|
|
output.unlink()
|
|
for bad in ('--where=ItemID:0','--where=ItemID:1,1','--where=ItemID:2147483648','--where=ItemID:bad','--where=ItemID::1','--where=:1'):
|
|
assert run(bad).returncode==1 and not output.exists(),'Malformed relation filter wrote output or aborted'
|
|
assert run('--where=Display_lang:1',table='ItemSparse').returncode==1 and not output.exists(),'Text relation field accepted'
|
|
chosen=expected[0];assert run('--ids='+str(chosen['ID']),'--where=ItemID:'+str(chosen['ItemID'])).returncode==0
|
|
assert json.loads(output.read_text())==[chosen]
|
|
print('Actual native relation rows, scalar filter bounds, ID intersection and existing-output preservation passed; no client/database changes.')
|