Skip to content

Last driver of vehicles, previewed cleanup and database backup - #5

Merged
bzed merged 23 commits into
mainfrom
feature/vehicle-last-driver
Nov 4, 2026
Merged

bzed merged 23 commits into
mainfrom
feature/vehicle-last-driver

Conversation

@bzed

@bzed bzed commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • dzo-admin 0.8.0 remembers who last took the driver's seat of each car, motorbike and boat and reports it (hello feature driver); DayZ 1.29 guards are gone, 1.30 is the baseline.
  • dzo serve records one row per vehicle in dzo.sqlite (hidden when missing from a snapshot, forgotten after admin.vehicle_forget_days, default 7); records start only once the mod reports drivers.
  • API and web: last driver and last drive in the vehicle list, a map link per vehicle, and a previewed bulk cleanup of vehicles unused for N days (14/30/60 or 1..3650). Never uses force, skips occupied/covered vehicles, re-checks at confirm, max 500 per request, reports the mod's real answer, audited.
  • serve.db_backup_hours / serve.db_backup_keep: regular consistent VACUUM INTO copies of dzo.sqlite, passed to post_backup hooks as extra.db_backup.

Spec: docs/superpowers/specs/2026-11-01-vehicle-last-driver-design.md, plan: docs/superpowers/plans/2026-11-01-vehicle-last-driver.md.

Not yet verified

  • make test-client (stable and --exp) has not been run for the mod changes; only a --no-client boot. Needs a free DayZ client.
  • The servermods/dzo-admin submodule commit is on the vehicle-last-driver branch of bzed/dzo-admin.

Test plan

  • make fmt-check vet lint reuse test-race docs coverage-check (coverage 85.9%)
  • browser e2e incl. cleanup flow
  • make test-client and make test-client ARGS=--exp
  • CI

🤖 Generated with Claude Code

bzed and others added 12 commits November 1, 2026 14:05
…atabase backup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mod reports driver, driver_name and driven_ago per vehicle; the hub
validates them (Steam ID, finite age within 400 days), sets DrivenAt and
clips the name. Bad values drop the drive but keep the vehicle.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing snapshots

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ost_backup hooks

serve.db_backup_hours (default 24, 0 = off) and serve.db_backup_keep
(default 7) control VACUUM INTO copies in <paths.db>/backup; the newest is
passed to post_backup hooks as extra.db_backup. Documented in
configuration.rst, backups.rst and moderation.rst.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GET /instances/<i>/vehicles merges the vehicle records (last driver,
last drive, first seen) into the live vehicles; without a database the
list is the mod's, unchanged. The stream is not changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… for admin.vehicle_forget_days

A recorder per instance (internal/vehicles, like internal/presence) writes
each vehicle snapshot of the mod to the vehicle records and sweeps hourly
for records hidden longer than admin.vehicle_forget_days (default 7, at
least 1, per instance). No snapshot yet hides nothing; an empty one hides
the records without deleting them. serve starts it after the store opens,
updates it on reload and stops it before the store closes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rmed selection of them

GET /instances/<i>/vehicles/unused?days=N previews the vehicles without
crew, not covered, unused for more than N days; POST .../vehicles/cleanup
re-checks every id and deletes only those still unused (never force),
skipping the rest with a reason. Both refuse with 409 when the mod does
not report drivers. Audited per vehicle; apiclient methods added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
dzo-admin remembers, in RAM only, who last took the driver's seat of each
car, motorbike and boat (OnDriverEnter) and reports driver, driver_name and
driven_ago per vehicle, plus the hello feature "driver". Nothing is stored
on the vehicles. The submodule pointer and servermods.lock move to the new
commit (PBO rebuilt); test-client gets three checks (car has a driver, hello
feature, vehicle record keeps the last driver).

make test-client was NOT run in full (a DayZ client of the user was running);
only `--no-client` on stable and --exp, which boots the server with the new
PBO. The player checks and the "vehicle record" check (needs the API of the
Go record tasks) still have to be run after the merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e vehicle on the map

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… time, after a preview and a confirmation

The vehicle list gets a Clean up button for people who may delete vehicles.
The step offers 14, 30 and 60 days or a custom 1..3650, previews the
unused vehicles, and sends exactly the previewed ids after a browser
confirmation; the API re-checks each one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nup preview at 500; bound two day/hour settings

- vehicles: the recorder records nothing while the hub's hello lacks the driver feature, so a vehicle's age does not start before the mod can report drivers
- web: the cleanup preview lists the 500 longest unused vehicles and says how many match in all, so the confirm (max 500 ids) can proceed
- config: admin.vehicle_forget_days <= 3650 and serve.db_backup_hours <= 87600; larger values overflowed time.Duration

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.11986% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.42%. Comparing base (15a6738) to head (822f073).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/moderation/backup.go 75.34% 18 Missing ⚠️
internal/moderation/vehicles.go 83.54% 13 Missing ⚠️
internal/vehicles/vehicles.go 86.07% 11 Missing ⚠️
internal/api/cleanup.go 93.96% 7 Missing ⚠️
internal/web/cleanup.go 86.00% 7 Missing ⚠️
internal/serve/serve.go 78.57% 6 Missing ⚠️
internal/admin/hub.go 87.87% 4 Missing ⚠️
internal/moderation/service.go 76.47% 4 Missing ⚠️
internal/api/server.go 96.66% 1 Missing ⚠️
internal/apiclient/client.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main       #5    +/-   ##
========================================
  Coverage   86.42%   86.42%            
========================================
  Files         210      215     +5     
  Lines       20465    21016   +551     
========================================
+ Hits        17686    18163   +477     
- Misses       2769     2843    +74     
  Partials       10       10            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bzed and others added 9 commits November 1, 2026 21:26
DayZ 1.30 is the stable version, so dzo no longer supports 1.29 servers
with the mod. dzo-admin (submodule) drops every DAYZ_1_29 conditional and
uses the 1.30 code unconditionally: motorbikes, boats and the last-driver
tracking are no longer left out on 1.29.

Breaking: dzo-admin 0.8.0 does not compile on a DayZ 1.29 server; such a
server has to stay on dzo-admin 0.7.x (and the dzo that ships it).

- servermods.lock: the new submodule commit; the PBO is rebuilt and its
  checksum updated.
- docs/development.rst: a servermod targets 1.30 only; it is booted on the
  stable and the experimental server, no more #ifdef DAYZ_1_29.
- README.md, docs/admin-map.rst, scripts/test-client.sh: the 1.29 notes are
  gone; --exp is the next build, not 1.30.

make test-client was not run for this change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kup directory; forget the vehicle records of removed instances

The copy is created 0600 before VACUUM INTO fills it, an existing backup
directory is set to 0750. Records of instances no longer on the site are
hidden and forgotten after the default period.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ted request; fa-eraser; document the raw driver fields

The cleanup queues every vehicle_delete, waits for all answers under one
25 s deadline and lists a refused or unanswered vehicle as skipped with the
reason. Adds Hub.Wait. The unknown fa-broom icon becomes fa-eraser.
docs/api.rst lists driver, driver_name and driven_ago.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The registry only ever added hubs, so a removed instance stayed in
Registry.Names() until dzo serve restarted: its vehicle records were not
forgotten after 7 days as configuration.rst says, and its mod could still
connect. AddHubs now calls Registry.Retain with the instances of the site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hub.byID kept every command for the life of dzo serve, and a vehicle
cleanup adds up to 500 at once. A result is now readable for 10 minutes
after it arrived (or the command timed out), then dropped. Result tells an
unknown or forgotten id apart (ErrUnknownCommand), and
GET /instances/<i>/commands/<id> answers 404 for it instead of a 202
"pending" that never ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A vehicle_delete the mod did not answer within the 25 seconds of the
request was reported and audited as skipped ("no answer from the mod"),
although the command stays queued and the mod may still delete the
vehicle. The answer now has a "pending" list with the id and the command
id, the audit entry says "no answer yet, the mod may still delete it
(command <id>)", and the web page lists them apart and asks to reload the
vehicle list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The label held only the Expansion owner, so on vanilla it was the bare
class and the last driver never showed. It is now
"<class> (owner <owner>, last driver <driver>)", each part only when known;
a driver without a known name is named by the Steam ID. Owner and last
driver are different things, so both are shown even when they match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A boat cannot capsize in the game, so flipping one has no use. The hub
refuses vehicle_flip for a vehicle of kind boat (the mod's kind or
admin.vehicle_kinds) with "admin: boats cannot be flipped" (400), the web
panel of a boat has no flip button, and dzo-admin refuses it as well
(vanilla and Expansion boats). Repair, move and delete of boats are
unchanged. test-client.sh checks the refusal instead of a boat flip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since dzo-admin 0.8.0 the hello lists "driver" first, so the log line is
"features: driver expansion" and the check for "features: expansion"
failed although Expansion was reported (all Expansion message checks
passed). The check now looks for expansion anywhere in the feature list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bzed
bzed force-pushed the feature/vehicle-last-driver branch from cb01d5e to fd4900f Compare November 1, 2026 21:16
bzed and others added 2 commits November 4, 2026 00:04
… outside a pipe

Far out at sea (7000/300) the server removed the spawned boats within seconds,
so every boat check after the spawn failed. Both boats now spawn in the water
west of Chernogorsk (4298/1811). The refused flip exits 1, which under pipefail
failed `dzo ... | grep -q` even when the text matched; the output is now
matched outside the pipe.

make test-client ARGS='--no-client --expansion' passed (74 passed, 0 failed),
both boats included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flip works on boats: it lifts the boat by a metre and stands it level,
and the boat settles back on the water. The hub queues vehicle_flip for a
boat again, the web panel of a boat has the flip button again, and
dzo-admin flips vanilla and Expansion boats (servermods.lock back to the
PBO before the refusal). This reverts "admin: boats are not flipped"
(6a0d248). test-client.sh flips both boats and checks that they float
afterwards.

make test-client ARGS='--no-client --expansion' passed (76 passed,
0 failed): Boat_01_Orange and ExpansionZodiacBoat_Orange float after the
flip (DayZ 1.30 stable).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bzed
bzed merged commit ee3fa87 into main Nov 4, 2026
32 of 36 checks passed
@bzed
bzed deleted the feature/vehicle-last-driver branch November 4, 2026 16:03
@bzed bzed mentioned this pull request Nov 4, 2026
1 of 2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant