gameplay: name defuse feedback actions
Browse files- crates/urt-gameplay/src/bin/urt-defuse.rs +11 -7
- crates/urt-gameplay/src/defuse.rs +21 -17
- crates/urt-gameplay/src/effect_feedback.rs +10 -13
- crates/urt-gameplay/src/location_feedback.rs +3 -3
- docs/FINDINGS.md +2 -0
- docs/PROVISIONAL_TODO.md +2 -0
- docs/RESEARCH_LEDGER.md +4 -0
- docs/research/QVM_LOCATION_ALLOCATION_BATCH.md +2 -0
- docs/research/README.md +2 -0
- docs/research/RUST_DEFUSE_EFFECT_NAMES.md +5 -0
- xtask/checks.tsv +5 -0
crates/urt-gameplay/src/bin/urt-defuse.rs
CHANGED
|
@@ -22,19 +22,23 @@ fn list(v: &[u32]) -> String {
|
|
| 22 |
fn hex(v: &[u8]) -> String {
|
| 23 |
v.iter().map(|v| format!("{v:02x}")).collect()
|
| 24 |
}
|
|
|
|
| 25 |
fn events(v: &[DefuseEffect]) -> String {
|
| 26 |
v.iter()
|
| 27 |
.map(|e| match e {
|
| 28 |
DefuseEffect::Allocate { event } => format!(r#"{{"op":"allocate","event":{event}}}"#),
|
| 29 |
-
DefuseEffect::
|
| 30 |
-
format!(r#"{{"op":"sound","slot":{slot},"sound":{
|
| 31 |
}
|
| 32 |
DefuseEffect::Log { format, slot } => {
|
| 33 |
format!(r#"{{"op":"log","format":"{}","slot":{slot}}}"#, hex(format))
|
| 34 |
}
|
| 35 |
-
DefuseEffect::
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
})
|
| 40 |
.collect::<Vec<_>>()
|
|
@@ -274,9 +278,9 @@ fn located_full(w: &[u32]) -> String {
|
|
| 274 |
.map(|plan| {
|
| 275 |
let allocation = outcome.allocation.as_mut().expect("radio follows an event");
|
| 276 |
assert!(allocation.after_allocation.is_empty());
|
| 277 |
-
allocation.after_allocation.push(DefuseEffect::
|
| 278 |
slot: plan.slot,
|
| 279 |
-
|
| 280 |
});
|
| 281 |
radio_fixture::radio_fields(plan.output, &fixture.state)
|
| 282 |
})
|
|
|
|
| 22 |
fn hex(v: &[u8]) -> String {
|
| 23 |
v.iter().map(|v| format!("{v:02x}")).collect()
|
| 24 |
}
|
| 25 |
+
// Serialize historical source report names at the evidence boundary.
|
| 26 |
fn events(v: &[DefuseEffect]) -> String {
|
| 27 |
v.iter()
|
| 28 |
.map(|e| match e {
|
| 29 |
DefuseEffect::Allocate { event } => format!(r#"{{"op":"allocate","event":{event}}}"#),
|
| 30 |
+
DefuseEffect::TeamRadio { slot, code } => {
|
| 31 |
+
format!(r#"{{"op":"sound","slot":{slot},"sound":{code}}}"#)
|
| 32 |
}
|
| 33 |
DefuseEffect::Log { format, slot } => {
|
| 34 |
format!(r#"{{"op":"log","format":"{}","slot":{slot}}}"#, hex(format))
|
| 35 |
}
|
| 36 |
+
DefuseEffect::AddScore { slot, delta: 1 } => {
|
| 37 |
+
format!(r#"{{"op":"teleport","slot":{slot}}}"#)
|
| 38 |
+
}
|
| 39 |
+
DefuseEffect::AddScore { .. } => panic!("source fixture adds exactly one point"),
|
| 40 |
+
DefuseEffect::IncrementCounter { slot, index } => {
|
| 41 |
+
format!(r#"{{"op":"award","slot":{slot},"value":{index}}}"#)
|
| 42 |
}
|
| 43 |
})
|
| 44 |
.collect::<Vec<_>>()
|
|
|
|
| 278 |
.map(|plan| {
|
| 279 |
let allocation = outcome.allocation.as_mut().expect("radio follows an event");
|
| 280 |
assert!(allocation.after_allocation.is_empty());
|
| 281 |
+
allocation.after_allocation.push(DefuseEffect::TeamRadio {
|
| 282 |
slot: plan.slot,
|
| 283 |
+
code: plan.code,
|
| 284 |
});
|
| 285 |
radio_fixture::radio_fields(plan.output, &fixture.state)
|
| 286 |
})
|
crates/urt-gameplay/src/defuse.rs
CHANGED
|
@@ -23,23 +23,24 @@ pub enum DefuseEffect {
|
|
| 23 |
Allocate {
|
| 24 |
event: u32,
|
| 25 |
},
|
| 26 |
-
///
|
| 27 |
-
|
| 28 |
slot: i32,
|
| 29 |
-
|
| 30 |
},
|
| 31 |
Log {
|
| 32 |
format: Vec<u8>,
|
| 33 |
slot: i32,
|
| 34 |
},
|
| 35 |
-
///
|
| 36 |
-
|
| 37 |
slot: i32,
|
|
|
|
| 38 |
},
|
| 39 |
-
///
|
| 40 |
-
|
| 41 |
slot: i32,
|
| 42 |
-
|
| 43 |
},
|
| 44 |
}
|
| 45 |
fn validate(input: DefuseInput) -> Result<(), Error> {
|
|
@@ -67,9 +68,9 @@ pub fn begin_defuse(
|
|
| 67 |
state.event[1] |= 32;
|
| 68 |
Ok(vec![
|
| 69 |
DefuseEffect::Allocate { event: 83 },
|
| 70 |
-
DefuseEffect::
|
| 71 |
slot: input.slot,
|
| 72 |
-
|
| 73 |
},
|
| 74 |
])
|
| 75 |
}
|
|
@@ -109,7 +110,7 @@ mod begin_tests {
|
|
| 109 |
&e[..],
|
| 110 |
[
|
| 111 |
DefuseEffect::Allocate { event: 83 },
|
| 112 |
-
DefuseEffect::
|
| 113 |
]
|
| 114 |
));
|
| 115 |
let mut s = state();
|
|
@@ -253,10 +254,13 @@ pub fn finish_defuse(
|
|
| 253 |
slot: input.slot,
|
| 254 |
},
|
| 255 |
DefuseEffect::Allocate { event: 84 },
|
| 256 |
-
DefuseEffect::
|
| 257 |
-
DefuseEffect::Award {
|
| 258 |
slot: input.slot,
|
| 259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
},
|
| 261 |
])
|
| 262 |
}
|
|
@@ -296,8 +300,8 @@ mod finish_tests {
|
|
| 296 |
[
|
| 297 |
DefuseEffect::Log { .. },
|
| 298 |
DefuseEffect::Allocate { event: 84 },
|
| 299 |
-
DefuseEffect::
|
| 300 |
-
DefuseEffect::
|
| 301 |
]
|
| 302 |
));
|
| 303 |
}
|
|
@@ -683,7 +687,7 @@ mod replay_tests {
|
|
| 683 |
assert_eq!(
|
| 684 |
f.iter()
|
| 685 |
.flat_map(|f| &f.outcome.effects)
|
| 686 |
-
.filter(|e| matches!(e, DefuseEffect::
|
| 687 |
.count(),
|
| 688 |
1
|
| 689 |
);
|
|
|
|
| 23 |
Allocate {
|
| 24 |
event: u32,
|
| 25 |
},
|
| 26 |
+
/// QVM 193620.
|
| 27 |
+
TeamRadio {
|
| 28 |
slot: i32,
|
| 29 |
+
code: u32,
|
| 30 |
},
|
| 31 |
Log {
|
| 32 |
format: Vec<u8>,
|
| 33 |
slot: i32,
|
| 34 |
},
|
| 35 |
+
/// QVM 205260.
|
| 36 |
+
AddScore {
|
| 37 |
slot: i32,
|
| 38 |
+
delta: i32,
|
| 39 |
},
|
| 40 |
+
/// QVM 283463.
|
| 41 |
+
IncrementCounter {
|
| 42 |
slot: i32,
|
| 43 |
+
index: u32,
|
| 44 |
},
|
| 45 |
}
|
| 46 |
fn validate(input: DefuseInput) -> Result<(), Error> {
|
|
|
|
| 68 |
state.event[1] |= 32;
|
| 69 |
Ok(vec![
|
| 70 |
DefuseEffect::Allocate { event: 83 },
|
| 71 |
+
DefuseEffect::TeamRadio {
|
| 72 |
slot: input.slot,
|
| 73 |
+
code: 7,
|
| 74 |
},
|
| 75 |
])
|
| 76 |
}
|
|
|
|
| 110 |
&e[..],
|
| 111 |
[
|
| 112 |
DefuseEffect::Allocate { event: 83 },
|
| 113 |
+
DefuseEffect::TeamRadio { code: 7, .. }
|
| 114 |
]
|
| 115 |
));
|
| 116 |
let mut s = state();
|
|
|
|
| 254 |
slot: input.slot,
|
| 255 |
},
|
| 256 |
DefuseEffect::Allocate { event: 84 },
|
| 257 |
+
DefuseEffect::AddScore {
|
|
|
|
| 258 |
slot: input.slot,
|
| 259 |
+
delta: 1,
|
| 260 |
+
},
|
| 261 |
+
DefuseEffect::IncrementCounter {
|
| 262 |
+
slot: input.slot,
|
| 263 |
+
index: 5,
|
| 264 |
},
|
| 265 |
])
|
| 266 |
}
|
|
|
|
| 300 |
[
|
| 301 |
DefuseEffect::Log { .. },
|
| 302 |
DefuseEffect::Allocate { event: 84 },
|
| 303 |
+
DefuseEffect::AddScore { delta: 1, .. },
|
| 304 |
+
DefuseEffect::IncrementCounter { index: 5, .. }
|
| 305 |
]
|
| 306 |
));
|
| 307 |
}
|
|
|
|
| 687 |
assert_eq!(
|
| 688 |
f.iter()
|
| 689 |
.flat_map(|f| &f.outcome.effects)
|
| 690 |
+
.filter(|e| matches!(e, DefuseEffect::IncrementCounter { .. }))
|
| 691 |
.count(),
|
| 692 |
1
|
| 693 |
);
|
crates/urt-gameplay/src/effect_feedback.rs
CHANGED
|
@@ -267,29 +267,26 @@ fn resolve_effects(
|
|
| 267 |
out.effects.push(ResolvedEffect::Link);
|
| 268 |
}
|
| 269 |
}
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
out.effects.push(ResolvedEffect::Score { delta: 1 });
|
| 273 |
let (score, rank) =
|
| 274 |
-
crate::score::add(true, context.paused, 8, false, 1,
|
| 275 |
.map_err(|_| Error::InvalidInput)?;
|
| 276 |
feedback.score = score;
|
| 277 |
if rank {
|
| 278 |
out.effects.push(ResolvedEffect::Rank);
|
| 279 |
}
|
| 280 |
}
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
increment_objective_counter(&mut feedback.counters,
|
| 284 |
-
out.effects.push(ResolvedEffect::Counter {
|
| 285 |
-
index: value as usize,
|
| 286 |
-
});
|
| 287 |
}
|
| 288 |
-
DefuseEffect::
|
| 289 |
-
out.effects.push(ResolvedEffect::Radio { code
|
| 290 |
let mut input = context.radio.clone();
|
| 291 |
input.slot = slot;
|
| 292 |
-
input.code =
|
| 293 |
out.radio
|
| 294 |
.push(team_radio(&mut feedback.marker, &context.clients, &input)?);
|
| 295 |
}
|
|
|
|
| 267 |
out.effects.push(ResolvedEffect::Link);
|
| 268 |
}
|
| 269 |
}
|
| 270 |
+
DefuseEffect::AddScore { delta, .. } => {
|
| 271 |
+
out.effects.push(ResolvedEffect::Score { delta });
|
|
|
|
| 272 |
let (score, rank) =
|
| 273 |
+
crate::score::add(true, context.paused, 8, false, 1, delta, feedback.score)
|
| 274 |
.map_err(|_| Error::InvalidInput)?;
|
| 275 |
feedback.score = score;
|
| 276 |
if rank {
|
| 277 |
out.effects.push(ResolvedEffect::Rank);
|
| 278 |
}
|
| 279 |
}
|
| 280 |
+
DefuseEffect::IncrementCounter { index, .. } => {
|
| 281 |
+
let index = index as usize;
|
| 282 |
+
increment_objective_counter(&mut feedback.counters, index)?;
|
| 283 |
+
out.effects.push(ResolvedEffect::Counter { index });
|
|
|
|
|
|
|
| 284 |
}
|
| 285 |
+
DefuseEffect::TeamRadio { slot, code } => {
|
| 286 |
+
out.effects.push(ResolvedEffect::Radio { code });
|
| 287 |
let mut input = context.radio.clone();
|
| 288 |
input.slot = slot;
|
| 289 |
+
input.code = code;
|
| 290 |
out.radio
|
| 291 |
.push(team_radio(&mut feedback.marker, &context.clients, &input)?);
|
| 292 |
}
|
crates/urt-gameplay/src/location_feedback.rs
CHANGED
|
@@ -754,7 +754,7 @@ pub fn process_located_defuse(
|
|
| 754 |
level_start,
|
| 755 |
origin,
|
| 756 |
|mut outcome| {
|
| 757 |
-
let radio = if let [DefuseEffect::
|
| 758 |
outcome.after_allocation.as_slice()
|
| 759 |
{
|
| 760 |
let actor = actor.ok_or(Error::InvalidIndex)?;
|
|
@@ -769,7 +769,7 @@ pub fn process_located_defuse(
|
|
| 769 |
mode: context.mode,
|
| 770 |
count: input.count,
|
| 771 |
tick: base.tick,
|
| 772 |
-
code: *
|
| 773 |
success: false,
|
| 774 |
payload: Vec::new(),
|
| 775 |
};
|
|
@@ -784,7 +784,7 @@ pub fn process_located_defuse(
|
|
| 784 |
)?;
|
| 785 |
let plan = DefuseRadioPlan {
|
| 786 |
slot: *slot,
|
| 787 |
-
code: *
|
| 788 |
output,
|
| 789 |
};
|
| 790 |
outcome.after_allocation.clear();
|
|
|
|
| 754 |
level_start,
|
| 755 |
origin,
|
| 756 |
|mut outcome| {
|
| 757 |
+
let radio = if let [DefuseEffect::TeamRadio { slot, code }] =
|
| 758 |
outcome.after_allocation.as_slice()
|
| 759 |
{
|
| 760 |
let actor = actor.ok_or(Error::InvalidIndex)?;
|
|
|
|
| 769 |
mode: context.mode,
|
| 770 |
count: input.count,
|
| 771 |
tick: base.tick,
|
| 772 |
+
code: *code,
|
| 773 |
success: false,
|
| 774 |
payload: Vec::new(),
|
| 775 |
};
|
|
|
|
| 784 |
)?;
|
| 785 |
let plan = DefuseRadioPlan {
|
| 786 |
slot: *slot,
|
| 787 |
+
code: *code,
|
| 788 |
output,
|
| 789 |
};
|
| 790 |
outcome.after_allocation.clear();
|
docs/FINDINGS.md
CHANGED
|
@@ -2053,3 +2053,5 @@ RE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 det
|
|
| 2053 |
- On the held defuse sequence, moving restart from free age 999 to 1000 changes the selected slot from a new record to the original freed slot. [Shared-pool lifecycle trace](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
|
| 2054 |
|
| 2055 |
- The Rust expiry and allocated defuse APIs agree with source slot reuse, free timestamps and request ordering across both replay schedules. [Rust lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
|
|
|
|
|
|
|
|
|
| 2053 |
- On the held defuse sequence, moving restart from free age 999 to 1000 changes the selected slot from a new record to the original freed slot. [Shared-pool lifecycle trace](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
|
| 2054 |
|
| 2055 |
- The Rust expiry and allocated defuse APIs agree with source slot reuse, free timestamps and request ordering across both replay schedules. [Rust lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
|
| 2056 |
+
|
| 2057 |
+
- Rust defuse callers now receive typed team radio, score and counter actions. [Defuse feedback action names](research/RUST_DEFUSE_EFFECT_NAMES.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -2115,3 +2115,5 @@ RE-974–983 completed routing, command rewrite, inactivity, movement-parameter
|
|
| 2115 |
- [x] RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool ([evidence](research/QVM_DEFUSE_EVENT_LIFECYCLE.md)).
|
| 2116 |
|
| 2117 |
- [x] RE-1054 Verify Rust shared-pool defuse event lifecycle parity ([evidence](research/RUST_DEFUSE_EVENT_LIFECYCLE.md)).
|
|
|
|
|
|
|
|
|
| 2115 |
- [x] RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool ([evidence](research/QVM_DEFUSE_EVENT_LIFECYCLE.md)).
|
| 2116 |
|
| 2117 |
- [x] RE-1054 Verify Rust shared-pool defuse event lifecycle parity ([evidence](research/RUST_DEFUSE_EVENT_LIFECYCLE.md)).
|
| 2118 |
+
|
| 2119 |
+
- [x] RE-1055 Name Rust defuse feedback actions by their recovered meaning ([evidence](research/RUST_DEFUSE_EFFECT_NAMES.md)).
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -2891,3 +2891,7 @@ Two seven-frame sequences verify actual start, cancel, restart and completion wi
|
|
| 2891 |
## 2026-11-25 — RE-1054 Verify Rust shared-pool defuse event lifecycle parity
|
| 2892 |
|
| 2893 |
The allocated callback and per-entity expiry gate match both seven-frame source sequences when driven against one Rust pool. See [lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2891 |
## 2026-11-25 — RE-1054 Verify Rust shared-pool defuse event lifecycle parity
|
| 2892 |
|
| 2893 |
The allocated callback and per-entity expiry gate match both seven-frame source sequences when driven against one Rust pool. See [lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
|
| 2894 |
+
|
| 2895 |
+
## 2026-11-25 — RE-1055 Name Rust defuse feedback actions by their recovered meaning
|
| 2896 |
+
|
| 2897 |
+
Defuse exposes team radio, score addition and counter increments as typed Rust actions. Historical evidence tags remain available through the probe serializer. See [typed defuse feedback](research/RUST_DEFUSE_EFFECT_NAMES.md).
|
docs/research/QVM_LOCATION_ALLOCATION_BATCH.md
CHANGED
|
@@ -89,3 +89,5 @@ RE-1052 matches the 30 traced frame cases in [the Rust expiry gate](RUST_ENTITY_
|
|
| 89 |
RE-1053 traces [defuse allocation, expiry and reuse across seven frames](QVM_DEFUSE_EVENT_LIFECYCLE.md). At restart, a one-tick difference changes the selected slot and registration count.
|
| 90 |
|
| 91 |
RE-1054 verifies [the Rust shared-pool replay](RUST_DEFUSE_EVENT_LIFECYCLE.md) against both seven-frame schedules. The fixture explicitly initializes the temporary slots with no client pointer or pending client event.
|
|
|
|
|
|
|
|
|
| 89 |
RE-1053 traces [defuse allocation, expiry and reuse across seven frames](QVM_DEFUSE_EVENT_LIFECYCLE.md). At restart, a one-tick difference changes the selected slot and registration count.
|
| 90 |
|
| 91 |
RE-1054 verifies [the Rust shared-pool replay](RUST_DEFUSE_EVENT_LIFECYCLE.md) against both seven-frame schedules. The fixture explicitly initializes the temporary slots with no client pointer or pending client event.
|
| 92 |
+
|
| 93 |
+
RE-1055 replaces the gameplay effect names with [typed radio, score and counter actions](RUST_DEFUSE_EFFECT_NAMES.md). The evidence serializer retains the historical report tags.
|
docs/research/README.md
CHANGED
|
@@ -1681,3 +1681,5 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 1681 |
- [Defuse event allocation and expiry on one pool](QVM_DEFUSE_EVENT_LIFECYCLE.md)
|
| 1682 |
|
| 1683 |
- [Defuse temporary-event lifecycle in Rust](RUST_DEFUSE_EVENT_LIFECYCLE.md)
|
|
|
|
|
|
|
|
|
| 1681 |
- [Defuse event allocation and expiry on one pool](QVM_DEFUSE_EVENT_LIFECYCLE.md)
|
| 1682 |
|
| 1683 |
- [Defuse temporary-event lifecycle in Rust](RUST_DEFUSE_EVENT_LIFECYCLE.md)
|
| 1684 |
+
|
| 1685 |
+
- [Typed defuse feedback actions](RUST_DEFUSE_EFFECT_NAMES.md)
|
docs/research/RUST_DEFUSE_EFFECT_NAMES.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Typed defuse feedback actions
|
| 2 |
+
|
| 3 |
+
The Rust defuse callback exposes `TeamRadio { slot, code }` for QVM 193620, `AddScore { slot, delta }` for 205260, and `IncrementCounter { slot, index }` for 283463. The callback emits radio code 7 on start. After successful completion it emits a score delta of one and a counter update at index 5.
|
| 4 |
+
|
| 5 |
+
The located callback consumes `TeamRadio` and returns its resolved command plan. The other feedback resolver uses the explicit score delta and counter index. The evidence CLI encodes the original `sound`, `teleport` and `award` tags so earlier source and Rust reports retain a common format. The focused group compares start, completion, located radio and the lifecycle replay.
|
xtask/checks.tsv
CHANGED
|
@@ -4836,3 +4836,8 @@ edge crates/urt-gameplay/src/defuse.rs scripts/analyze_rust_defuse_event_lifecyc
|
|
| 4836 |
edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4837 |
edge crates/urt-gameplay/src/bin/urt-defuse.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4838 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4836 |
edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4837 |
edge crates/urt-gameplay/src/bin/urt-defuse.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4838 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4839 |
+
group rust-defuse-effect-names scripts/analyze_rust_defuse_begin.py
|
| 4840 |
+
group rust-defuse-effect-names scripts/analyze_rust_defuse_finish.py
|
| 4841 |
+
group rust-defuse-effect-names scripts/analyze_rust_effect_defuse_complete.py
|
| 4842 |
+
group rust-defuse-effect-names scripts/analyze_rust_defuse_event_lifecycle.py
|
| 4843 |
+
group rust-defuse-effect-names scripts/analyze_rust_defuse_located_callback.py
|