nmarshall commited on
Commit
8dc2612
·
1 Parent(s): 052e900

qvm: recover client inactivity policy and effects

Browse files
docs/FINDINGS.md CHANGED
@@ -1887,3 +1887,5 @@ RE-975: Rust matches16 source routing cases, preserving intermission precedence
1887
  RE-976: Forty-eight source command-rewrite cases recover pause-mask1 and mode10/client-mask16 locking, saved-angle restore versus update, and independent server override. Clearing bytes493..495 preserves the low byte492 and command timestamp; buttons clear separately. Other pause bits alone do not trigger this lock. Native later movement execution remains outside this fragment. [Evidence](research/QVM_CLIENT_COMMAND_REWRITE.md).
1888
 
1889
  RE-977: Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. [Evidence](research/RUST_CLIENT_COMMAND_REWRITE.md).
 
 
 
1887
  RE-976: Forty-eight source command-rewrite cases recover pause-mask1 and mode10/client-mask16 locking, saved-angle restore versus update, and independent server override. Clearing bytes493..495 preserves the low byte492 and command timestamp; buttons clear separately. Other pause bits alone do not trigger this lock. Native later movement execution remains outside this fragment. [Evidence](research/QVM_CLIENT_COMMAND_REWRITE.md).
1888
 
1889
  RE-977: Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. [Evidence](research/RUST_CLIENT_COMMAND_REWRITE.md).
1890
+
1891
+ RE-978: A120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified. [Evidence](research/QVM_CLIENT_INACTIVITY.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1941,3 +1941,5 @@ RE-964–973 completed timer deadline/phase/recovery contracts, whole-body compo
1941
  - [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).
1942
 
1943
  - [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).
 
 
 
1941
  - [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).
1942
 
1943
  - [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).
1944
+
1945
+ - [x] RE-978 Original inactivity policy and ordered warning timeout effects ([evidence](research/QVM_CLIENT_INACTIVITY.md)).
docs/RESEARCH_LEDGER.md CHANGED
@@ -2581,3 +2581,7 @@ Forty-eight source command-rewrite cases recover pause-mask1 and mode10/client-m
2581
  ## 2026-10-28 — RE-977 Rust client command rewriting and byte preservation
2582
 
2583
  Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. Focused `cargo xtask test-group rust-client-command-rewrite` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.
 
 
 
 
 
2581
  ## 2026-10-28 — RE-977 Rust client command rewriting and byte preservation
2582
 
2583
  Rust matches48 source command rewrites, retaining pause-mask1 selection, mode10/client-mask16 locking, saved-angle direction and independent server masking. The low adjacent command byte survives clearing movement bytes, and command time is not modified by this API. Unit tests cover non-locking pause bits, angle restore/save order and low-byte preservation. Focused `cargo xtask test-group rust-client-command-rewrite` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.
2584
+
2585
+ ## 2026-10-28 — RE-978 Original inactivity policy and ordered warning timeout effects
2586
+
2587
+ A120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified. Focused `cargo xtask test-group qvm-client-inactivity` passes with deterministic report regeneration, relevant regressions and storage/documentation/whitespace checks. Full suite deferred to the tenth-commit boundary. Original assets unchanged; native IO effects remain captured.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1978,3 +1978,5 @@ RE-964–973 recover the complete bounded timer body and its caller timing prefi
1978
  - [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).
1979
 
1980
  - [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).
 
 
 
1978
  - [x] RE-976 Original command angle preservation and movement-byte masking ([evidence](research/QVM_CLIENT_COMMAND_REWRITE.md)).
1979
 
1980
  - [x] RE-977 Rust client command rewriting and byte preservation ([evidence](research/RUST_CLIENT_COMMAND_REWRITE.md)).
1981
+
1982
+ - [x] RE-978 Original inactivity policy and ordered warning timeout effects ([evidence](research/QVM_CLIENT_INACTIVITY.md)).
docs/research/QVM_CLIENT_INACTIVITY.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Original inactivity policy and ordered warning timeout effects
2
+
3
+ RE-978. Focused validation: `cargo xtask test-group qvm-client-inactivity`. [Machine report](qvm-client-inactivity.json).
4
+
5
+ A120-case source contract executes actual150382 through all bounded policy branches: protected entities, disabled config, pause anchoring, signed movement bytes/attack, dead-client deadline extension, exemptions, warnings and timeout. Word arithmetic wraps before signed comparisons. Mode1 queues team-to-s then a message; other modes request a drop. Native effects remain captured; source deadline/warning fields and supplied health are verified.
docs/research/README.md CHANGED
@@ -1513,3 +1513,5 @@ The extension collector adds five focused tests for native tail calls, command-r
1513
  - [RE-976: Original command angle preservation and movement-byte masking](QVM_CLIENT_COMMAND_REWRITE.md).
1514
 
1515
  - [RE-977: Rust client command rewriting and byte preservation](RUST_CLIENT_COMMAND_REWRITE.md).
 
 
 
1513
  - [RE-976: Original command angle preservation and movement-byte masking](QVM_CLIENT_COMMAND_REWRITE.md).
1514
 
1515
  - [RE-977: Rust client command rewriting and byte preservation](RUST_CLIENT_COMMAND_REWRITE.md).
1516
+
1517
+ - [RE-978: Original inactivity policy and ordered warning timeout effects](QVM_CLIENT_INACTIVITY.md).
docs/research/qvm-client-inactivity.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_client_inactivity.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Verified original client-processing source contract."""
2
+ from pathlib import Path
3
+ from analyze_qvm import write_json
4
+ from qvm_research_support import source
5
+ from qvm_client_processing_support import seed,idle,idle_fixtures
6
+
7
+ def main():
8
+ q,raw,h,ins=source();probes=[]
9
+ for a in idle_fixtures():
10
+ m,b=seed(raw,h,a);m,p,b=idle(ins,m,b,a);p['input']=a;probes.append(p)
11
+ write_json(Path('docs/research/qvm-client-inactivity.json'),dict(source=q['source'],sha256=q['sha256'],probes=probes,limits='120 actual150382 cases cover entity-mask8 bypass, disabled config, pause anchor, movement/attack activity, dead-client deadline extension, exemptions, strict warning/expiry gates and mode-specific team/send/drop effects. Signed word wrap and repeated-warning suppression retained. Native team/send/drop effects captured.'))
12
+ if __name__=='__main__':main()
scripts/qvm_client_processing_oracle.py CHANGED
@@ -10,3 +10,24 @@ def gate(a):
10
  def command(a):
11
  locked=bool(a['pause']&1) or a['mode']==10 and bool(a['flags']&16);angles=list(a['saved'] if locked else a['angles']);saved=list(a['saved'] if locked else a['angles']);clear=locked or bool(a['block'])
12
  return dict(angles=angles,saved=saved,buttons=0 if clear else a['buttons'],move_word=a['move_word']&255 if clear else a['move_word'],command_time=a['command_time'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def command(a):
11
  locked=bool(a['pause']&1) or a['mode']==10 and bool(a['flags']&16);angles=list(a['saved'] if locked else a['angles']);saved=list(a['saved'] if locked else a['angles']);clear=locked or bool(a['block'])
12
  return dict(angles=angles,saved=saved,buttons=0 if clear else a['buttons'],move_word=a['move_word']&255 if clear else a['move_word'],command_time=a['command_time'])
13
+
14
+ WARN_DROP=b'cp "Ten seconds until inactivity drop!\n"'
15
+ WARN_SPEC=b'cp "Ten seconds until forced spectator mode!\n"'
16
+ DROP=b'Dropped due to inactivity'
17
+ MOVED=b'cp "You were moved to spectator due to inactivity!\n"'
18
+ def idle(a):
19
+ deadline=a['deadline'];warned=a['warned'];accepted=True;events=[];tick=signed(a['tick']);limit=(a['tick']+a['idle_seconds']*1000)&0xffffffff
20
+ if a['entity_flags']&8:pass
21
+ elif a['idle_seconds']==0:deadline=(a['tick']+60000)&0xffffffff;warned=0
22
+ elif a['pause']:
23
+ limit=(a['pause_anchor']+a['idle_seconds']*1000)&0xffffffff
24
+ if signed(deadline)<signed(limit):deadline=limit
25
+ elif any(a['moves']) or a['buttons']&1:
26
+ if signed(deadline)<signed(limit):deadline=limit
27
+ warned=0
28
+ elif signed(a['health'])<=0:deadline=(deadline+a['msec'])&0xffffffff
29
+ elif a['exempt']:pass
30
+ elif tick>signed(deadline):
31
+ accepted=False;events=[dict(op='team',slot=2,text=b's'.hex(),force=0),dict(op='send',slot=2,text=MOVED.hex())] if a['mode']==1 else [dict(op='drop',slot=2,text=DROP.hex())]
32
+ elif tick>signed(deadline-10000) and not warned:warned=1;events=[dict(op='send',slot=2,text=(WARN_SPEC if a['mode']==1 else WARN_DROP).hex())]
33
+ return dict(accepted=accepted,events=events,deadline=deadline&0xffffffff,warned=warned,health=a['health']&0xffffffff)
scripts/qvm_client_processing_support.py CHANGED
@@ -49,3 +49,21 @@ def command_view(m):return dict(angles=[m[CLIENT+476+4*j]&0xffffffff for j in ra
49
  def command(ins,m,b,a):
50
  command_seed(m,a);m,e,b=execute(ins,m,b,154256,154389)
51
  return m,dict(**command_view(m),execution={k:e[k] for k in ['stop','trace_length','trace_sha256']}),b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  def command(ins,m,b,a):
50
  command_seed(m,a);m,e,b=execute(ins,m,b,154256,154389)
51
  return m,dict(**command_view(m),execution={k:e[k] for k in ['stop','trace_length','trace_sha256']}),b
52
+
53
+ def idle_fixtures():
54
+ profiles=[('protected',dict(entity_flags=8,deadline=0,warned=1)),('disabled',dict(idle_seconds=0,deadline=0,warned=1)),('paused',dict(pause=1)),('paused-keep',dict(pause=1,deadline=90000,warned=1)),('forward',dict(moves=[1,0,0],deadline=0,warned=1)),('right',dict(moves=[0,128,0],deadline=0,warned=1)),('up',dict(moves=[0,0,255],deadline=0,warned=1)),('attack',dict(buttons=1,deadline=0,warned=1)),('dead',dict(health=0,deadline=9000)),('exempt',dict(exempt=1,deadline=0)),('expired',dict(deadline=9999)),('warning',dict(deadline=19999)),('equal',dict(deadline=10000)),('already-warned',dict(deadline=19999,warned=1)),('warning-boundary',dict(deadline=20000)),('other-button',dict(buttons=2,deadline=9999)),('negative-idle',dict(idle_seconds=0xffffffff,moves=[1,0,0],deadline=0,warned=1)),('wrapped-idle',dict(idle_seconds=0x7fffffff,moves=[1,0,0],deadline=0,warned=1)),('dead-wrap',dict(health=0,deadline=0xffffffff)),('other-pause-bit',dict(pause=2,deadline=0,warned=1))]
55
+ defaults=dict(entity_flags=0,idle_seconds=60,pause=0,pause_anchor=3000,tick=10000,moves=[0,0,0],buttons=0,health=1,exempt=0,deadline=20000,warned=0)
56
+ return [dict(defaults,**changes,name=name,mode=mode,msec=msec) for name,changes in profiles for mode in [0,1] for msec in [0,100,0xffffffff]]
57
+
58
+ def idle_seed(m,a):
59
+ m.update({CLIENT+140:2,34091792+880*2:a['entity_flags'],34085460:a['idle_seconds'],35000452:a['pause'],35000456:a['pause_anchor'],34992532:a['tick'],CLIENT+3140:a['deadline'],CLIENT+4144:a['warned'],CLIENT+208:a['health'],CLIENT+500:a['exempt'],34063260:a['mode'],CLIENT+488:a['buttons'],CLIENT+492:42+sum(v<<(8*(j+1)) for j,v in enumerate(a['moves']))})
60
+
61
+ def idle_run(ins,m,b,msec):
62
+ events=[]
63
+ def team(i,m,a,bs):events.append(dict(op='team',slot=(a[8]-34091368)//880,text=cstring(m,bs,a[12]).hex(),force=a[16]));return m,0,{'team_callback183102_captured':True}
64
+ def send(i,m,a,bs):events.append(dict(op='send',slot=a[8],text=cstring(m,bs,a[12]).hex()));return m,0,{'network_send_captured':True}
65
+ def drop(i,m,a,bs):events.append(dict(op='drop',slot=a[8],text=cstring(m,bs,a[12]).hex()));return m,0,{'native_drop_captured':True}
66
+ m,v,p,b=run(ins,m,150382,150691,28,{8:CLIENT,12:msec},b,{183102:team,-18:send,-17:drop},base=ROOT+0x20000)
67
+ p.update(accepted=v==1,events=events,deadline=m[CLIENT+3140]&0xffffffff,warned=m[CLIENT+4144]&0xffffffff,health=m[CLIENT+208]&0xffffffff);return m,p,b
68
+
69
+ def idle(ins,m,b,a):idle_seed(m,a);return idle_run(ins,m,b,a['msec'])
scripts/test_qvm_client_inactivity.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,unittest
2
+ from pathlib import Path
3
+ from qvm_client_processing_oracle import idle
4
+ class OriginalTests(unittest.TestCase):
5
+ def test_original_contract(self):
6
+ rows=json.loads(Path('docs/research/qvm-client-inactivity.json').read_text())['probes'];self.assertEqual(len(rows),120)
7
+ for p in rows:
8
+ for k,v in idle(p['input']).items():self.assertEqual(p[k],v)
9
+ def test_fixture_identity_and_trace(self):
10
+ r=json.loads(Path('docs/research/qvm-client-inactivity.json').read_text());self.assertEqual(len(r['sha256']),64)
11
+ self.assertTrue(all(p['execution']['trace_length']>0 for p in r['probes']))
12
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -3592,3 +3592,7 @@ edge crates/urt-gameplay/src/client_timer.rs scripts/analyze_rust_client_command
3592
  edge crates/urt-gameplay/src/bin/urt-client-timer.rs scripts/analyze_rust_client_command_rewrite.py
3593
  edge crates/urt-gameplay/src/client_processing.rs scripts/analyze_rust_client_command_rewrite.py
3594
  edge crates/urt-gameplay/src/bin/urt-client-processing.rs scripts/analyze_rust_client_command_rewrite.py
 
 
 
 
 
3592
  edge crates/urt-gameplay/src/bin/urt-client-timer.rs scripts/analyze_rust_client_command_rewrite.py
3593
  edge crates/urt-gameplay/src/client_processing.rs scripts/analyze_rust_client_command_rewrite.py
3594
  edge crates/urt-gameplay/src/bin/urt-client-processing.rs scripts/analyze_rust_client_command_rewrite.py
3595
+ report scripts/analyze_qvm_client_inactivity.py docs/research/qvm-client-inactivity.json
3596
+ edge docs/research/qvm-client-inactivity.json scripts/test_qvm_client_inactivity.py
3597
+ group qvm-client-inactivity scripts/analyze_qvm_client_inactivity.py
3598
+ edge scripts/analyze_qvm_client_inactivity.py scripts/analyze_qvm_resumer_audit.py