gameplay: advance server entity expiry frame
Browse files- crates/urt-gameplay/src/bin/urt-server-entities.rs +61 -0
- crates/urt-gameplay/src/server_entities.rs +59 -0
- docs/FINDINGS.md +2 -0
- docs/PROVISIONAL_TODO.md +2 -0
- docs/RESEARCH_LEDGER.md +4 -0
- docs/research/README.md +2 -0
- docs/research/RUST_SERVER_EXPIRY_FRAME.md +5 -0
- docs/research/rust-server-expiry-frame.json +139 -0
- scripts/analyze_rust_server_expiry_frame.py +30 -0
- scripts/test_rust_server_expiry_frame.py +13 -0
- xtask/checks.tsv +9 -0
crates/urt-gameplay/src/bin/urt-server-entities.rs
CHANGED
|
@@ -8,6 +8,10 @@ fn main() {
|
|
| 8 |
let mut bytes = Vec::new();
|
| 9 |
std::io::stdin().read_to_end(&mut bytes).unwrap();
|
| 10 |
let bsp = BspVisibility::parse(&bytes).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
let bounds = Bounds::new([-16.; 3], [16.; 3]).unwrap();
|
| 12 |
let mut pool = EntityPool {
|
| 13 |
count: 64,
|
|
@@ -65,3 +69,60 @@ fn main() {
|
|
| 65 |
terminal.count
|
| 66 |
);
|
| 67 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
let mut bytes = Vec::new();
|
| 9 |
std::io::stdin().read_to_end(&mut bytes).unwrap();
|
| 10 |
let bsp = BspVisibility::parse(&bytes).unwrap();
|
| 11 |
+
if std::env::args().nth(1).as_deref() == Some("frame") {
|
| 12 |
+
frame(&bsp);
|
| 13 |
+
return;
|
| 14 |
+
}
|
| 15 |
let bounds = Bounds::new([-16.; 3], [16.; 3]).unwrap();
|
| 16 |
let mut pool = EntityPool {
|
| 17 |
count: 64,
|
|
|
|
| 69 |
terminal.count
|
| 70 |
);
|
| 71 |
}
|
| 72 |
+
|
| 73 |
+
fn frame(bsp: &BspVisibility<'_>) {
|
| 74 |
+
use urt_gameplay::server_entities::EntityFrameEffect;
|
| 75 |
+
let bounds = Bounds::new([-16.; 3], [16.; 3]).unwrap();
|
| 76 |
+
let mut pool = EntityPool {
|
| 77 |
+
count: 69,
|
| 78 |
+
slots: vec![EntitySlot { words: [0; 220] }; 1024],
|
| 79 |
+
};
|
| 80 |
+
for slot in [1, 64, 65, 67, 68] {
|
| 81 |
+
let record = &mut pool.slots[slot];
|
| 82 |
+
record.words[532 / 4] = 1;
|
| 83 |
+
record.words[568 / 4] = if slot == 67 { 101 } else { 100 };
|
| 84 |
+
record.words[572 / 4] = u32::from([64, 65, 67, 68].contains(&slot));
|
| 85 |
+
if slot != 65 {
|
| 86 |
+
record.words[180 / 4] = 2;
|
| 87 |
+
record.words[520 / 4] = (slot + 100) as u32;
|
| 88 |
+
}
|
| 89 |
+
record.words[536 / 4] = (slot + 200) as u32;
|
| 90 |
+
}
|
| 91 |
+
pool.slots[65].words[548 / 4] = 1;
|
| 92 |
+
pool.slots[68].words[528 / 4] = 400;
|
| 93 |
+
let mut server = ServerEntities::new(bounds, pool).unwrap();
|
| 94 |
+
for slot in [64, 65, 67, 68] {
|
| 95 |
+
server.link(bsp, server.id_at(slot).unwrap(), true).unwrap();
|
| 96 |
+
}
|
| 97 |
+
let before = server.links().spatial().query(bounds, 8).slots;
|
| 98 |
+
let invalid = server.expire_frame(401, |_| None).is_err();
|
| 99 |
+
let after_error = server.links().spatial().query(bounds, 8).slots;
|
| 100 |
+
let out = server
|
| 101 |
+
.expire_frame(401, |parent| (parent == 400).then_some(401))
|
| 102 |
+
.unwrap();
|
| 103 |
+
let dispatch = out.dispatch.iter().map(|id| id.slot()).collect::<Vec<_>>();
|
| 104 |
+
let effects = out
|
| 105 |
+
.effects
|
| 106 |
+
.iter()
|
| 107 |
+
.map(|effect| match effect {
|
| 108 |
+
EntityFrameEffect::ClearClientEvent { entity, client } => {
|
| 109 |
+
format!(r#"["clear",{},{}]"#, entity.slot(), client)
|
| 110 |
+
}
|
| 111 |
+
EntityFrameEffect::Release { entity, request } => match request {
|
| 112 |
+
EntityRelease::ReleaseResource(v) => {
|
| 113 |
+
format!(r#"["resource",{},{}]"#, entity.slot(), v)
|
| 114 |
+
}
|
| 115 |
+
EntityRelease::ReleaseObject(v) => format!(r#"["object",{},{}]"#, entity.slot(), v),
|
| 116 |
+
EntityRelease::Unlink => panic!("server should consume unlink"),
|
| 117 |
+
},
|
| 118 |
+
})
|
| 119 |
+
.collect::<Vec<_>>()
|
| 120 |
+
.join(",");
|
| 121 |
+
let after = server.links().spatial().query(bounds, 8).slots;
|
| 122 |
+
let live = (0..69)
|
| 123 |
+
.filter(|&slot| server.id_at(slot).is_some())
|
| 124 |
+
.collect::<Vec<_>>();
|
| 125 |
+
println!(
|
| 126 |
+
r#"{{"before":{before:?},"invalid":{invalid},"after_error":{after_error:?},"dispatch":{dispatch:?},"effects":[{effects}],"after":{after:?},"live":{live:?}}}"#
|
| 127 |
+
);
|
| 128 |
+
}
|
crates/urt-gameplay/src/server_entities.rs
CHANGED
|
@@ -22,6 +22,7 @@ impl EntityId {
|
|
| 22 |
}
|
| 23 |
}
|
| 24 |
|
|
|
|
| 25 |
pub struct ServerEntities {
|
| 26 |
pool: EntityPool,
|
| 27 |
links: EntityLinks,
|
|
@@ -30,6 +31,24 @@ pub struct ServerEntities {
|
|
| 30 |
next_generation: u64,
|
| 31 |
}
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
impl ServerEntities {
|
| 34 |
/// Start from level records before any links have been published.
|
| 35 |
pub fn new(world: Bounds, pool: EntityPool) -> Result<Self, Error> {
|
|
@@ -132,6 +151,46 @@ impl ServerEntities {
|
|
| 132 |
Ok(frame)
|
| 133 |
}
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
fn checked_slot(&self, id: EntityId) -> Result<usize, Error> {
|
| 136 |
if self.id_at(id.slot) == Some(id) {
|
| 137 |
Ok(id.slot)
|
|
|
|
| 22 |
}
|
| 23 |
}
|
| 24 |
|
| 25 |
+
#[derive(Clone)]
|
| 26 |
pub struct ServerEntities {
|
| 27 |
pool: EntityPool,
|
| 28 |
links: EntityLinks,
|
|
|
|
| 31 |
next_generation: u64,
|
| 32 |
}
|
| 33 |
|
| 34 |
+
#[derive(Clone, Debug, PartialEq, Eq)]
|
| 35 |
+
pub enum EntityFrameEffect {
|
| 36 |
+
ClearClientEvent {
|
| 37 |
+
entity: EntityId,
|
| 38 |
+
client: u32,
|
| 39 |
+
},
|
| 40 |
+
Release {
|
| 41 |
+
entity: EntityId,
|
| 42 |
+
request: EntityRelease,
|
| 43 |
+
},
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
| 47 |
+
pub struct ServerEntityFrame {
|
| 48 |
+
pub dispatch: Vec<EntityId>,
|
| 49 |
+
pub effects: Vec<EntityFrameEffect>,
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
impl ServerEntities {
|
| 53 |
/// Start from level records before any links have been published.
|
| 54 |
pub fn new(world: Bounds, pool: EntityPool) -> Result<Self, Error> {
|
|
|
|
| 151 |
Ok(frame)
|
| 152 |
}
|
| 153 |
|
| 154 |
+
/// Run the event-aging prefix in registered slot order. Commit the frame
|
| 155 |
+
/// together so a failed typed resource lookup leaves all membership intact.
|
| 156 |
+
pub fn expire_frame(
|
| 157 |
+
&mut self,
|
| 158 |
+
tick: u32,
|
| 159 |
+
mut object_child: impl FnMut(u32) -> Option<u32>,
|
| 160 |
+
) -> Result<ServerEntityFrame, Error> {
|
| 161 |
+
let mut staged = self.clone();
|
| 162 |
+
let mut out = ServerEntityFrame::default();
|
| 163 |
+
for slot in 0..self.registered_count as usize {
|
| 164 |
+
let Some(id) = staged.id_at(slot) else {
|
| 165 |
+
continue;
|
| 166 |
+
};
|
| 167 |
+
let client = staged.pool.slots[slot].words[520 / 4];
|
| 168 |
+
// The QVM writes zero without inspecting the old client event word.
|
| 169 |
+
let mut client_event = 1;
|
| 170 |
+
let event = (client != 0).then_some(&mut client_event);
|
| 171 |
+
let result = staged.expire(id, tick, event, &mut object_child)?;
|
| 172 |
+
if client_event == 0 {
|
| 173 |
+
out.effects
|
| 174 |
+
.push(EntityFrameEffect::ClearClientEvent { entity: id, client });
|
| 175 |
+
}
|
| 176 |
+
out.effects
|
| 177 |
+
.extend(
|
| 178 |
+
result
|
| 179 |
+
.releases
|
| 180 |
+
.into_iter()
|
| 181 |
+
.map(|request| EntityFrameEffect::Release {
|
| 182 |
+
entity: id,
|
| 183 |
+
request,
|
| 184 |
+
}),
|
| 185 |
+
);
|
| 186 |
+
if result.dispatch {
|
| 187 |
+
out.dispatch.push(id);
|
| 188 |
+
}
|
| 189 |
+
}
|
| 190 |
+
*self = staged;
|
| 191 |
+
Ok(out)
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
fn checked_slot(&self, id: EntityId) -> Result<usize, Error> {
|
| 195 |
if self.id_at(id.slot) == Some(id) {
|
| 196 |
Ok(id.slot)
|
docs/FINDINGS.md
CHANGED
|
@@ -2085,3 +2085,5 @@ RE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 det
|
|
| 2085 |
- The server pool removes linked metadata on expiry and rejects an earlier occupant's handle after slot reuse. [Server entity lifetimes](research/RUST_SERVER_ENTITIES.md).
|
| 2086 |
|
| 2087 |
- Defuse events now link in the owned server pool before payload publication and can expire through the same world. [Registered defuse events](research/RUST_SERVER_DEFUSE.md).
|
|
|
|
|
|
|
|
|
| 2085 |
- The server pool removes linked metadata on expiry and rejects an earlier occupant's handle after slot reuse. [Server entity lifetimes](research/RUST_SERVER_ENTITIES.md).
|
| 2086 |
|
| 2087 |
- Defuse events now link in the owned server pool before payload publication and can expire through the same world. [Registered defuse events](research/RUST_SERVER_DEFUSE.md).
|
| 2088 |
+
|
| 2089 |
+
- The server expiry pass consumes unlink while preserving client clear and resource request order across slots. [Server expiry frame](research/RUST_SERVER_EXPIRY_FRAME.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -2147,3 +2147,5 @@ RE-974–983 completed routing, command rewrite, inactivity, movement-parameter
|
|
| 2147 |
- [x] RE-1069 Own entity registration, spatial links and slot generations in the server pool ([evidence](research/RUST_SERVER_ENTITIES.md)).
|
| 2148 |
|
| 2149 |
- [x] RE-1070 Execute allocated defuse links in the registered server pool ([evidence](research/RUST_SERVER_DEFUSE.md)).
|
|
|
|
|
|
|
|
|
| 2147 |
- [x] RE-1069 Own entity registration, spatial links and slot generations in the server pool ([evidence](research/RUST_SERVER_ENTITIES.md)).
|
| 2148 |
|
| 2149 |
- [x] RE-1070 Execute allocated defuse links in the registered server pool ([evidence](research/RUST_SERVER_DEFUSE.md)).
|
| 2150 |
+
|
| 2151 |
+
- [x] RE-1071 Advance server entity expiry in slot order and report external work ([evidence](research/RUST_SERVER_EXPIRY_FRAME.md)).
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -2955,3 +2955,7 @@ The server pool consumes unlink requests, invalidates freed identities and keeps
|
|
| 2955 |
## 2026-11-25 — RE-1070 Execute allocated defuse links in the registered server pool
|
| 2956 |
|
| 2957 |
The server pool now links the constructed event before the callback writes payload or resolves radio, and owns the resulting identity through expiry. See [registered defuse cases](research/RUST_SERVER_DEFUSE.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2955 |
## 2026-11-25 — RE-1070 Execute allocated defuse links in the registered server pool
|
| 2956 |
|
| 2957 |
The server pool now links the constructed event before the callback writes payload or resolves radio, and owns the resulting identity through expiry. See [registered defuse cases](research/RUST_SERVER_DEFUSE.md).
|
| 2958 |
+
|
| 2959 |
+
## 2026-11-25 — RE-1071 Advance server entity expiry in slot order and report external work
|
| 2960 |
+
|
| 2961 |
+
The frame pass advances the owned spatial lifetimes, emits ordered client and resource effects, and stages rollback on an invalid child lookup. See [server expiry frame](research/RUST_SERVER_EXPIRY_FRAME.md).
|
docs/research/README.md
CHANGED
|
@@ -1713,3 +1713,5 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 1713 |
- [Ownership of registered entity slots](RUST_SERVER_ENTITIES.md)
|
| 1714 |
|
| 1715 |
- [Defuse events in the registered server pool](RUST_SERVER_DEFUSE.md)
|
|
|
|
|
|
|
|
|
| 1713 |
- [Ownership of registered entity slots](RUST_SERVER_ENTITIES.md)
|
| 1714 |
|
| 1715 |
- [Defuse events in the registered server pool](RUST_SERVER_DEFUSE.md)
|
| 1716 |
+
|
| 1717 |
+
- [Slot-ordered server expiry pass](RUST_SERVER_EXPIRY_FRAME.md)
|
docs/research/RUST_SERVER_EXPIRY_FRAME.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Slot-ordered server expiry pass
|
| 2 |
+
|
| 3 |
+
`ServerEntities::expire_frame` applies the event-aging prefix to registered live slots in order. It returns the entities that reach ordinary dispatch, followed separately by the client clear and resource requests in their observed order. Unlink is applied to the owned index. The pass stages the pool and links, so an unresolved object-child lookup leaves earlier records and memberships intact.
|
| 4 |
+
|
| 5 |
+
[The controlled frame](rust-server-expiry-frame.json) mixes ordinary, protected, unexpired and freed records. It checks client clear before resource release, nested object release order, skipped inactive slots and rollback after a late error. Integration with the client event store and the rest of per-entity dispatch remains open.
|
docs/research/rust-server-expiry-frame.json
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"expected": {
|
| 3 |
+
"after": [
|
| 4 |
+
67
|
| 5 |
+
],
|
| 6 |
+
"after_error": [
|
| 7 |
+
68,
|
| 8 |
+
67,
|
| 9 |
+
65,
|
| 10 |
+
64
|
| 11 |
+
],
|
| 12 |
+
"before": [
|
| 13 |
+
68,
|
| 14 |
+
67,
|
| 15 |
+
65,
|
| 16 |
+
64
|
| 17 |
+
],
|
| 18 |
+
"dispatch": [
|
| 19 |
+
1
|
| 20 |
+
],
|
| 21 |
+
"effects": [
|
| 22 |
+
[
|
| 23 |
+
"clear",
|
| 24 |
+
1,
|
| 25 |
+
101
|
| 26 |
+
],
|
| 27 |
+
[
|
| 28 |
+
"clear",
|
| 29 |
+
64,
|
| 30 |
+
164
|
| 31 |
+
],
|
| 32 |
+
[
|
| 33 |
+
"resource",
|
| 34 |
+
64,
|
| 35 |
+
264
|
| 36 |
+
],
|
| 37 |
+
[
|
| 38 |
+
"resource",
|
| 39 |
+
65,
|
| 40 |
+
265
|
| 41 |
+
],
|
| 42 |
+
[
|
| 43 |
+
"clear",
|
| 44 |
+
68,
|
| 45 |
+
168
|
| 46 |
+
],
|
| 47 |
+
[
|
| 48 |
+
"object",
|
| 49 |
+
68,
|
| 50 |
+
401
|
| 51 |
+
],
|
| 52 |
+
[
|
| 53 |
+
"object",
|
| 54 |
+
68,
|
| 55 |
+
400
|
| 56 |
+
],
|
| 57 |
+
[
|
| 58 |
+
"resource",
|
| 59 |
+
68,
|
| 60 |
+
268
|
| 61 |
+
]
|
| 62 |
+
],
|
| 63 |
+
"invalid": true,
|
| 64 |
+
"live": [
|
| 65 |
+
1,
|
| 66 |
+
65,
|
| 67 |
+
67
|
| 68 |
+
]
|
| 69 |
+
},
|
| 70 |
+
"limits": "Controlled server expiry pass with supplied object and client resource identities.",
|
| 71 |
+
"rust": {
|
| 72 |
+
"after": [
|
| 73 |
+
67
|
| 74 |
+
],
|
| 75 |
+
"after_error": [
|
| 76 |
+
68,
|
| 77 |
+
67,
|
| 78 |
+
65,
|
| 79 |
+
64
|
| 80 |
+
],
|
| 81 |
+
"before": [
|
| 82 |
+
68,
|
| 83 |
+
67,
|
| 84 |
+
65,
|
| 85 |
+
64
|
| 86 |
+
],
|
| 87 |
+
"dispatch": [
|
| 88 |
+
1
|
| 89 |
+
],
|
| 90 |
+
"effects": [
|
| 91 |
+
[
|
| 92 |
+
"clear",
|
| 93 |
+
1,
|
| 94 |
+
101
|
| 95 |
+
],
|
| 96 |
+
[
|
| 97 |
+
"clear",
|
| 98 |
+
64,
|
| 99 |
+
164
|
| 100 |
+
],
|
| 101 |
+
[
|
| 102 |
+
"resource",
|
| 103 |
+
64,
|
| 104 |
+
264
|
| 105 |
+
],
|
| 106 |
+
[
|
| 107 |
+
"resource",
|
| 108 |
+
65,
|
| 109 |
+
265
|
| 110 |
+
],
|
| 111 |
+
[
|
| 112 |
+
"clear",
|
| 113 |
+
68,
|
| 114 |
+
168
|
| 115 |
+
],
|
| 116 |
+
[
|
| 117 |
+
"object",
|
| 118 |
+
68,
|
| 119 |
+
401
|
| 120 |
+
],
|
| 121 |
+
[
|
| 122 |
+
"object",
|
| 123 |
+
68,
|
| 124 |
+
400
|
| 125 |
+
],
|
| 126 |
+
[
|
| 127 |
+
"resource",
|
| 128 |
+
68,
|
| 129 |
+
268
|
| 130 |
+
]
|
| 131 |
+
],
|
| 132 |
+
"invalid": true,
|
| 133 |
+
"live": [
|
| 134 |
+
1,
|
| 135 |
+
65,
|
| 136 |
+
67
|
| 137 |
+
]
|
| 138 |
+
}
|
| 139 |
+
}
|
scripts/analyze_rust_server_expiry_frame.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Check slot-ordered expiry, external work and atomic frame failure."""
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
import subprocess
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
from analyze_qvm import write_json
|
| 8 |
+
from analyze_rust_world_visibility import fixture
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
subprocess.run(['cargo', 'build', '--offline', '-p', 'urt-gameplay', '--bin',
|
| 13 |
+
'urt-server-entities'], check=True)
|
| 14 |
+
binary = Path(os.environ.get('CARGO_TARGET_DIR', 'target')) / 'debug' / 'urt-server-entities'
|
| 15 |
+
rust = json.loads(subprocess.run([str(binary), 'frame'], input=fixture(3),
|
| 16 |
+
capture_output=True, check=True).stdout)
|
| 17 |
+
expected = dict(before=[68, 67, 65, 64], invalid=True, after_error=[68, 67, 65, 64],
|
| 18 |
+
dispatch=[1], effects=[['clear', 1, 101], ['clear', 64, 164],
|
| 19 |
+
['resource', 64, 264], ['resource', 65, 265],
|
| 20 |
+
['clear', 68, 168], ['object', 68, 401],
|
| 21 |
+
['object', 68, 400], ['resource', 68, 268]],
|
| 22 |
+
after=[67], live=[1, 65, 67])
|
| 23 |
+
write_json(Path('docs/research/rust-server-expiry-frame.json'), {
|
| 24 |
+
'expected': expected, 'rust': rust,
|
| 25 |
+
'limits': 'Controlled server expiry pass with supplied object and client resource identities.',
|
| 26 |
+
})
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
if __name__ == '__main__':
|
| 30 |
+
main()
|
scripts/test_rust_server_expiry_frame.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class ServerExpiryFrameTests(unittest.TestCase):
|
| 7 |
+
def test_slot_order_and_rollback(self):
|
| 8 |
+
report = json.loads(Path('docs/research/rust-server-expiry-frame.json').read_text())
|
| 9 |
+
self.assertEqual(report['expected'], report['rust'])
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if __name__ == '__main__':
|
| 13 |
+
unittest.main()
|
xtask/checks.tsv
CHANGED
|
@@ -5001,3 +5001,12 @@ edge crates/urt-gameplay/src/defuse.rs scripts/analyze_rust_server_defuse.py
|
|
| 5001 |
edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_server_defuse.py
|
| 5002 |
edge crates/urt-gameplay/src/world_visibility.rs scripts/analyze_rust_server_defuse.py
|
| 5003 |
edge crates/urt-gameplay/src/bin/urt-defuse.rs scripts/analyze_rust_server_defuse.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5001 |
edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_server_defuse.py
|
| 5002 |
edge crates/urt-gameplay/src/world_visibility.rs scripts/analyze_rust_server_defuse.py
|
| 5003 |
edge crates/urt-gameplay/src/bin/urt-defuse.rs scripts/analyze_rust_server_defuse.py
|
| 5004 |
+
report scripts/analyze_rust_server_expiry_frame.py docs/research/rust-server-expiry-frame.json
|
| 5005 |
+
edge docs/research/rust-server-expiry-frame.json scripts/test_rust_server_expiry_frame.py
|
| 5006 |
+
group rust-server-expiry-frame scripts/analyze_rust_server_expiry_frame.py
|
| 5007 |
+
group rust-server-expiry-frame scripts/analyze_rust_server_entities.py
|
| 5008 |
+
group rust-server-expiry-frame scripts/analyze_rust_entity_event_expiry.py
|
| 5009 |
+
group gameplay scripts/analyze_rust_server_expiry_frame.py
|
| 5010 |
+
edge crates/urt-gameplay/src/server_entities.rs scripts/analyze_rust_server_expiry_frame.py
|
| 5011 |
+
edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_server_expiry_frame.py
|
| 5012 |
+
edge crates/urt-gameplay/src/bin/urt-server-entities.rs scripts/analyze_rust_server_expiry_frame.py
|