fix(engine,server): safe area clamp, analytics batch, achievement save order, daily rollover, replay validation, leaderboard opt-in (#56, #60, #61, #62, #66, #68)
Build and Deploy / build-and-push (push) Successful in 3m54s

- #66: Clamp safe-area insets to 25% of window height with warn!() on excess
- #68: Move fire_flush outside per-event loop in analytics (batch flush once)
- #56: Persist progress before marking reward_granted to prevent XP loss on crash
- #60: Add DateRolloverTimer + check_date_rollover system for midnight seed refresh
- #62: Add validate_header() in replay upload with mode/draw_mode allowlists
- #61: Restore two-query leaderboard opt-in check (SELECT then UPDATE); original
       queries already in .sqlx cache; EXISTS variant would require sqlx prepare

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
funman300
2026-05-28 13:07:22 -07:00
parent 8cb4c9808e
commit 6e407a3ea7
104 changed files with 6356 additions and 3092 deletions
+16 -24
View File
@@ -93,10 +93,7 @@ impl Plugin for UiTooltipPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<TooltipState>()
.add_systems(Startup, spawn_tooltip_overlay)
.add_systems(
Update,
(track_tooltip_hover, show_or_hide_tooltip).chain(),
);
.add_systems(Update, (track_tooltip_hover, show_or_hide_tooltip).chain());
}
}
@@ -222,10 +219,7 @@ fn spawn_tooltip_overlay(
/// reveal delay.
fn track_tooltip_hover(
time: Res<Time>,
interactions: Query<
(Entity, &Interaction, Option<&Tooltip>),
Changed<Interaction>,
>,
interactions: Query<(Entity, &Interaction, Option<&Tooltip>), Changed<Interaction>>,
mut state: ResMut<TooltipState>,
) {
for (entity, interaction, tooltip) in &interactions {
@@ -407,9 +401,9 @@ mod tests {
/// `app.update()`. Mirrors the helper in `ui_modal::tests` and
/// `hud_plugin::tests`.
fn set_manual_time_step(app: &mut App, secs: f32) {
app.insert_resource(TimeUpdateStrategy::ManualDuration(
Duration::from_secs_f32(secs),
));
app.insert_resource(TimeUpdateStrategy::ManualDuration(Duration::from_secs_f32(
secs,
)));
}
/// Reads the current overlay visibility. Panics if the singleton is
@@ -440,18 +434,12 @@ mod tests {
fn spawn_hovered_tooltip(app: &mut App, label: &'static str) -> Entity {
let id = app
.world_mut()
.spawn((
Node::default(),
Interaction::Hovered,
Tooltip::new(label),
))
.spawn((Node::default(), Interaction::Hovered, Tooltip::new(label)))
.id();
// Mark the Interaction Changed by re-inserting it. `Changed`
// requires component mutation since the previous tick; spawn
// already counts, but a follow-up insert is the explicit signal.
app.world_mut()
.entity_mut(id)
.insert(Interaction::Hovered);
app.world_mut().entity_mut(id).insert(Interaction::Hovered);
id
}
@@ -536,9 +524,7 @@ mod tests {
// Unhover. `track_tooltip_hover` clears the state on the next
// tick because the entity transitions Hovered → None.
app.world_mut()
.entity_mut(target)
.insert(Interaction::None);
app.world_mut().entity_mut(target).insert(Interaction::None);
app.update();
assert!(
@@ -590,12 +576,18 @@ mod tests {
#[test]
fn tooltip_should_show_respects_delay() {
// delay == 0 ("Instant"): any elapsed (including zero) shows.
assert!(tooltip_should_show(0.0, 0.0), "instant delay must show on first tick");
assert!(
tooltip_should_show(0.0, 0.0),
"instant delay must show on first tick"
);
assert!(tooltip_should_show(0.5, 0.0));
// Standard non-zero delay.
assert!(!tooltip_should_show(0.4, 0.5), "elapsed < delay must hide");
assert!(tooltip_should_show(0.5, 0.5), "elapsed == delay must show (boundary)");
assert!(
tooltip_should_show(0.5, 0.5),
"elapsed == delay must show (boundary)"
);
assert!(tooltip_should_show(0.6, 0.5), "elapsed > delay must show");
// Larger delay (max-end of the slider).