367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
115 lines
7.6 KiB
Python
115 lines
7.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Actual native food/count/stand interruption fixture; preserve baseline.
|
|
|
|
Gatewaytest4509 only, already genuinely authenticated and server-acknowledged
|
|
seated. Uses original /use0/1 input. GM commands only read auras/save and restore
|
|
the single consumed unit. Screenshots require review; no healing/aura UI claim.
|
|
"""
|
|
import argparse,json,os
|
|
from contextlib import ExitStack
|
|
from pathlib import Path
|
|
from client_session import Session
|
|
from native_engine_character_test import Controller,ROOT,local_listeners
|
|
from native_test_guard import require_local_turtle_ports,require_authenticated_turtle_realm,require_native_gameplay_policy
|
|
from local_tortoise import db
|
|
import client_ui as ui
|
|
from native_world_trace import WorldTrace
|
|
|
|
def main():
|
|
parser=argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--baseline-count',type=int,required=True)
|
|
parser.add_argument('--evidence',type=Path,default=ROOT/'runtime/native-food-state.json')
|
|
parser.add_argument('--observe-aura',action='store_true',help='Capture real aura receive metadata and read-only original client aura API output; screenshots still require review')
|
|
args=parser.parse_args();path=args.evidence.resolve()
|
|
if args.baseline_count<2 or not path.is_relative_to(ROOT/'runtime'):parser.error('Positive stack baseline≥2 and runtime evidence required')
|
|
os.umask(0o077);require_local_turtle_ports(local_listeners())
|
|
pid=int((ROOT/'runtime/native-client.pid').read_text());c=Controller(pid)
|
|
require_authenticated_turtle_realm(c.rpc('inspect-wire-account'))
|
|
require_native_gameplay_policy(c.rpc('inspect-native-channel-policy'))
|
|
def inspect():
|
|
p=c.rpc('inspect-engine-pipe')
|
|
if p['error'] or p['closed']:raise RuntimeError('Native connection lost; preserve recovery evidence')
|
|
return p
|
|
def food(p):return next(i for i in p['inventory']['rows'] if i['entry']==117)
|
|
before=inspect();original=food(before);baseline=args.baseline_count
|
|
if original['count']!=baseline or not before['cast_result']['stand_received'] or before['cast_result']['stand_state']!=1:raise RuntimeError('Require confirmed food baseline and genuine seated acknowledgment')
|
|
guid=int(original['guid'])&0xffffffff
|
|
if db(f'SELECT ci.guid,ci.slot FROM tw_char.character_inventory ci WHERE ci.item={guid};')!='4509\t23':raise RuntimeError('Require designated character food in actual root slot23')
|
|
query=f'SELECT count FROM tw_char.item_instance WHERE guid={guid};'
|
|
if db(query)!=str(baseline):raise RuntimeError('Saved inventory differs; no use issued')
|
|
report={'pid':pid,'external_gateway_running':False,'baseline':original,'ui_review_required':True,'healing_verified':False,'aura_ui_verified':False,'restoration_pending':False}
|
|
def chat(s,text):
|
|
previous=ui.KEY_DELAY;ui.KEY_DELAY=.03
|
|
try:s.macro(text)
|
|
finally:ui.KEY_DELAY=previous
|
|
used=False
|
|
with ExitStack() as stack:
|
|
trace=stack.enter_context(WorldTrace(c)) if args.observe_aura else None
|
|
s=stack.enter_context(Session(pid));s.wait_world();s.focus()
|
|
def aura_probe(label):
|
|
if not args.observe_aura:return
|
|
# Ordinary original UI API only. Report protected values honestly;
|
|
# never unwrap, instrument or circumvent a restricted value.
|
|
chat(s,'/run GWFoodAuraProbe("'+label+'")')
|
|
try:
|
|
ui.key(s.d,'F1')
|
|
if args.observe_aura:
|
|
chat(s,'/run GWFoodAuraProbe=function(l)local a=C_UnitAuras.GetPlayerAuraBySpellID(433);print("GW Food",l,a and (issecretvalue and issecretvalue(a.spellId) and "restricted" or a.spellId) or "absent")end')
|
|
aura_probe('before')
|
|
# Typed restoration is self-only in this owned native profile;
|
|
# no foreign player identity is installed in the visible bindings.
|
|
chat(s,'/s .list auras');s.shot(path.with_name(path.stem+'-before.png'))
|
|
used=True;report['restoration_pending']=True;chat(s,'/use 0 1')
|
|
def consumed():
|
|
p=inspect();r=p['cast_result']
|
|
return p if food(p)['count']==baseline-1 and r['count']>before['cast_result']['count'] and r['spell']==433 and r['status']==0 else None
|
|
p=c.wait(consumed,8);report['consumed']=dict(item=food(p),cast=p['cast_result'],request_result=p['item_request']['result'])
|
|
aura_probe('active')
|
|
chat(s,'/s .list auras');s.shot(path.with_name(path.stem+'-active.png'))
|
|
prior=p['cast_result']['stand_received'];ui.key(s.d,'x')
|
|
def stood():
|
|
p=inspect();r=p['cast_result'];return p if r['stand_received']>prior and r['stand_state']==0 else None
|
|
p=c.wait(stood,6);report['standing']=p['cast_result']
|
|
aura_probe('interrupted')
|
|
chat(s,'/s .list auras');s.shot(path.with_name(path.stem+'-interrupted.png'))
|
|
# Verified in actual70334: recover the real server's already
|
|
# received rows that wrapped above the visible chat viewport.
|
|
chat(s,'/run local t={};local n=ChatFrame1:GetNumMessages();for i=math.max(1,n-100),n do local m=ChatFrame1:GetMessageInfo(i);if m and(m:find("Target unit has")or m:find("id: 433 "))then t[#t+1]=m end end;for _,m in ipairs(t)do print("GW aura",m)end')
|
|
s.shot(path.with_name(path.stem+'-aura-history.png'))
|
|
except Exception as error:
|
|
report['error']=str(error);raise
|
|
finally:
|
|
try:
|
|
if used:
|
|
inspect();s.wait_world()
|
|
# Stand through the genuine engine input before cleanup,
|
|
# even if an earlier evidence collection step failed.
|
|
p=inspect()
|
|
if p['cast_result']['stand_state']==1:
|
|
prior=p['cast_result']['stand_received'];ui.key(s.d,'x')
|
|
c.wait(lambda:(v if (v:=inspect())['cast_result']['stand_received']>prior and v['cast_result']['stand_state']==0 else None),6)
|
|
chat(s,'/s .save')
|
|
# The native cache is live, whereas SQL may wait for normal
|
|
# save processing. Never restore a unit solely on a timeout.
|
|
count=food(inspect())['count']
|
|
if count==baseline-1:
|
|
report['restoration_pending']=True;chat(s,'/s .additem 117 1')
|
|
c.wait(lambda:(v if food(v:=inspect())['count']==baseline else None),6)
|
|
elif count!=baseline:raise RuntimeError('Unexpected stack change; preserve baseline instead of guessing cleanup')
|
|
chat(s,'/s .save');report['saved_restored_count']=c.wait(lambda:(v if (v:=db(query))==str(baseline) else None),6)
|
|
report['restoration_pending']=False
|
|
chat(s,'/run local i=C_Container.GetContainerItemInfo(0,1);print("GW food restored",i and i.stackCount)')
|
|
s.shot(path.with_name(path.stem+'-restored.png'))
|
|
if args.observe_aura:chat(s,'/run GWFoodAuraProbe=nil')
|
|
except Exception as error:
|
|
report['cleanup_or_final_diagnostic_error']=str(error)
|
|
raise
|
|
finally:
|
|
try:
|
|
p=inspect();report['final']=dict(item=food(p),cast=p['cast_result'],policy_error=c.rpc('inspect-native-channel-policy')['error'])
|
|
except Exception as error:report['final_inspection_error']=str(error)
|
|
if trace:report['aura_trace']=trace.report()
|
|
path.write_text(json.dumps(report,indent=2)+'\n')
|
|
print('Actual native food-state evidence (review required):',path)
|
|
if __name__=='__main__':main()
|