Commit Graph

2325 Commits

Author SHA1 Message Date
Maurice 8349c5066b fix(dawarich): name stays never read before reading unnamed ones again
Unnamed stays are now read again at the end of a run, from the budget the others left and at most 20 per window, so new stays get their names and a Dawarich without a geocoder is not asked about every stay on each run.
2026-11-23 15:45:28 +01:00
Maurice 5e8cc0b90a fix(mail-ingest): read a transfer booking with a numeric code instead of filing it as a forwarding confirmation
Outside Gmail and Outlook senders, only a subject naming mail forwarding counts, so a bare 'transfert' in a shuttle or airport transfer confirmation no longer hides the booking.
2026-11-23 15:45:27 +01:00
Maurice 950942f7b9 fix(backup): refuse a Postgres restore of another schema or past the size limit with a 400
The admin restore now writes and checks the restore script while it verifies the archive, so a dump without TREK's tables in the target schema or one expanding past BACKUP_MAX_DECOMPRESSED_MB is refused before a pre-restore copy is kept, and the restore runs the checked script.
2026-11-23 15:45:27 +01:00
Maurice ac5c91bcaf fix(plugins): bind a Buffer a plugin passes to its own database as bytes
A Buffer crosses the plugin IPC as its JSON form, so db.query, db.exec and db.tx now turn that form back into the bytes before binding, as the plugin docs promise.
2026-11-23 15:45:27 +01:00
Maurice 10f0cb7d04 fix(flight-live): keep a late earlier sector from reading as this flight departing
Until a leg has departed, an aircraft in the air that is no nearer the destination than the origin is now stays the earlier sector's after the scheduled departure too, unless it is climbing out near the origin.
2026-11-23 15:45:27 +01:00
Maurice 08f3a8fe0b fix(flight-live): tell each booking of a flight its own delay once it is late
Bookings sharing a tracked flight can hold different departure times, so the delay notice now goes to each booking when its own delay crosses the line instead of being spent on the first one.
2026-11-23 15:45:27 +01:00
Maurice a0c41bce0a fix(notifications): list the wanderer hints for users whose trip switched Tours on
The user's matrix decides that row by the same per-user Tours rule the wanderer watch sends by, so a user who gets the hints can see and switch them.
2026-11-23 15:45:25 +01:00
Maurice 1a6639eb74 fix(trips): end a plugin-added member's MCP sessions where the trip opened an addon
trips.addMember now calls reattachJoinedMember like the REST, MCP and invite joins, so the new member's session lists the trip's addon tools.
2026-11-23 15:45:25 +01:00
Maurice 807c6a16b4 fix(plugins): handle a failed addon read while an earlier trip event still waits
The addon read of a queued plugin event now settles to off on its own, so a rejection that comes before the earlier event's turn can no longer go unhandled and stop the server.
2026-11-23 15:45:25 +01:00
Maurice 5d7d6072f7 fix(mail-ingest): refresh MCP sessions when an admin switches the mail import
The mail import tools are listed only while the import is on, so a save that changes mail_ingest_enabled now ends the live MCP sessions, as the addon switches do.
2026-11-23 15:45:25 +01:00
Maurice 4cd3f3d650 fix(files): serve a plugin the files a trip keeps while Documents is off
The plugin file surface follows the REST rule: the list and reads keep booking, place, expense, note and message files, a write on a loose file goes through when it attaches it, and uploads and deletes stay open.
2026-11-23 15:45:25 +01:00
Maurice a0d66eb898 fix(files): attach a loose file while the trip has Documents off
update and link go through when the request itself attaches the file to a booking, place, stop or expense, on REST and MCP alike, and upload_trip_file takes budget_item_id like the REST upload.
2026-11-23 15:45:24 +01:00
Maurice 8a2045c619 fix(mail-ingest): attach a booking's documents while the trip has Documents off
A booking's files belong to the booking, so the mail's documents now reach it whatever the Documents switch says; a mail filed without a booking still needs Documents.
2026-11-23 15:17:02 +01:00
Maurice 34d5fba437 fix(plugins): deliver a trip's core events to plugins in emission order
The addon check in front of the event sink made each family event wait for
its own read, so on Postgres a later snapshot could overtake an earlier one,
and a trip event could arrive before the budget event emitted ahead of it.
The reads still run side by side, but a trip's events now leave in order.
2026-11-23 15:15:37 +01:00
Maurice 8b9de04960 fix(wanderer): offer the connection and run the watch where a trip switched Tours on
With Tours off for the instance, a trip that switched it on opened the wanderer
import, but Settings hid the connection and the watch cron never ran. The addon
feed now tells each user whether wanderer applies to them, and the watch looks
for every user who has Tours on somewhere; the others only take their turn.
2026-11-23 15:15:36 +01:00
Maurice c289541c43 fix(notifications): list the paddle region request for admins while any trip has Tours on
The admin matrix decided a trip addon by the admin's own trips, so with Tours
off for the instance and on for a member's trip the paddle region request still
reached admins but had no row to switch it. Admin-scoped rows now follow the
addon being on for the instance or any trip.
2026-11-23 15:15:36 +01:00
Maurice 146f46c5e3 fix(addons): give a member who joins a trip with an opened addon a new MCP session
A trip that switched on an addon the instance has off ended the MCP sessions
of the members it had then, but somebody added later, or joining through the
invite link, kept a session without that addon's tools. Joining now ends it too.
2026-11-23 15:15:36 +01:00
Maurice 8709f67ff4 fix(trip-members): leave expenses out of a guest deletion while Costs is off
Deleting a guest re-sent every expense that named them as budget:updated,
even on a trip with Costs switched off, so each member's offline cache took
rows the bundle keeps out. The re-split expenses now go out only while the
trip has Costs on.
2026-11-23 15:15:36 +01:00
Maurice 48e54d5a62 fix(files): keep booking, place and expense files reachable with Documents off
The Documents addon now gates only the file manager: the list leaves out loose
files, and the trash, starring and loose files answer 404, while uploads, deletes
and every file a booking, place, expense, note or message carries stay reachable
over REST, the download route, MCP and the offline bundle.
2026-11-23 15:15:36 +01:00
Maurice 8fb720ea49 fix(mcp): validate a tool or prompt field again once NUL stripping changed it
The SDK validates the arguments before the input mapper drops NUL characters, so a field the mapper changes is now checked against its own schema again and a name of nothing but NUL is refused over MCP as it is over REST.
2026-11-23 15:11:39 +01:00
Maurice 1fb1b102e8 fix(dawarich): name an unnamed stay once Dawarich has geocoded its points
A stay stored as 'Unnamed stay' because none of its points was geocoded yet is now read again on the next sync, so a slow background geocoder or a stay from before the upgrade gets its town once Dawarich knows it.
2026-11-23 15:11:39 +01:00
Maurice a604f84899 fix(memories): send share link viewers the Immich preview instead of the original file
A public view of an Immich image now asks for the preview rendition, which Immich re-encodes without the stored metadata, so photo locations no longer go out with share links; owners still get the fullsize original.
2026-11-23 15:11:39 +01:00
Maurice e7e3592d97 fix(flight-live): tell a delay only to the bookings it is late for
Bookings that share one flight state can hold different scheduled times, so the delay notice now goes only to the legs whose own departure is at least fifteen minutes late instead of telling the others it is delayed by 0 minutes.
2026-11-23 15:11:39 +01:00
Maurice 8e51410251 fix(flight-live): do not read an earlier sector's aircraft as this flight having departed
Before the scheduled departure, an aircraft in the air that is no nearer the destination than the origin is now stays unpicked, so booking only the later sector of a through flight no longer sends the departure notice hours early.
2026-11-23 15:11:39 +01:00
Maurice 22c3381044 fix(tags): keep a trip's tags when the member who created them deletes their account
The trip tags a deleted user created now pass to each trip's owner before the user row goes, so the tag and its place assignments no longer cascade away for everyone else on the trip.
2026-11-23 15:11:38 +01:00
Maurice 9d4e52ddfc perf(db): let Postgres serve ORDER BY id from the primary key
A Kysely ORDER BY on the id of a table the statement reads in its FROM no longer gets SQLite's NULL position, which no primary key row needs and which kept Postgres from reading paged latest-first lists such as the audit log off the index.
2026-11-23 15:11:34 +01:00
Maurice 52a6fbbc92 fix(scripts): read the server's .env in the admin reset and the key rotation
Both scripts now load server/.env as the server does, so an install whose TREK_DB_URL lives there resets the admin and rotates the key in its Postgres database instead of in a SQLite file left behind by the move.
2026-11-23 15:11:33 +01:00
Maurice de1c3b8ea6 fix(scripts): rotate the SQLite file TREK_DB_FILE names
The key rotation now opens the database the server runs on when TREK_DB_FILE is set, writes the new key to the key file the server reads, and refuses DB_PATH and TREK_DB_FILE naming different files.
2026-11-23 15:11:33 +01:00
Maurice 60885627b1 fix(scripts): rotate the wanderer token with the encryption key
The key rotation now re-encrypts wanderer_connections.token, so a wanderer connection keeps working after the key changes instead of calling out without its token.
2026-11-23 15:11:33 +01:00
Maurice 9c454a04e1 fix(db): keep plugin index names when moving plugin data to Postgres
The move now creates each index a plugin named under that name, so a later plugin migration that drops or alters it by name finds it on a moved install as on a fresh one.
2026-11-23 15:11:33 +01:00
Maurice 6a6c403860 fix(db): keep booking to stay links of old installs when moving to Postgres
An install from before April 2026 stores reservations.accommodation_id as an INTEGER, so the move now writes such a stay id as the '<id>.0' text TREK compares it as, instead of '14', which no longer matched the stay on Postgres.
2026-11-23 15:11:33 +01:00
Maurice e51902a03b fix(reservations): drop a stay id from another trip when a booking is created
Create now checks that the linked stay belongs to the trip, as update already does, instead of storing a link to a stay that does not exist there.
2026-11-23 15:11:33 +01:00
Maurice 3a2645a3e4 fix(db): match a booking to its stay on Postgres without failing on odd ids
The Postgres stay match now casts the leading digits of the stored text as bigint, the way SQLite reads it, so a non-numeric or oversized accommodation_id no longer fails the calendar, share and stay reads for every trip.
2026-11-23 15:11:32 +01:00
Maurice bf8677a28c fix(backup): name the client tool when pg_restore cannot read a Postgres dump
A missing pg_restore, or one older than the pg_dump that wrote the archive, was reported as an invalid dump. The refusal now says which tool to install or point TREK_DB_PG_BIN_DIR at.
2026-11-23 15:11:32 +01:00
Maurice 89da19e535 fix(backup): refuse a Postgres restore the role or tools cannot run before anything is copied
The admin restore now answers a privileged role, old client tools or an unreachable server with a 400 naming the reason, before it keeps a pre-restore dump. RESTORE_FROM_BACKUP checks the same before it unpacks the archive, and removes the unpacked copy when the load fails.
2026-11-23 15:11:32 +01:00
Maurice e630e92183 fix(backup): clear a Postgres schema holding views or functions over TREK's tables
A table dropped with CASCADE takes its views and functions along, and the clear then rendered their stale oids as bare numbers and failed the restore. Rows whose object is already gone are now skipped.
2026-11-23 15:11:32 +01:00
Maurice bb2b4a1f5a fix(backup): restore Postgres backups into PostgreSQL 14, 15 and 16
pg_restore 17 and later write SET transaction_timeout at the top of every script, which older servers refuse under ON_ERROR_STOP. The restore now leaves settings the target server does not know out of the script while it streams.
2026-11-23 15:11:32 +01:00
Maurice 626e19c534 fix(mail-ingest): keep bookings the data names that the AI left out
When the AI returned fewer bookings than the machine-readable data, the others were dropped without an entry.
2026-11-23 15:11:31 +01:00
Maurice 8f5988ee33 fix(mail-ingest): match each AI leg to the data leg it agrees with
Under one booking reference every leg after the first was compared with the first and went to the inbox as a disagreement.
2026-11-23 15:11:31 +01:00
Maurice 4cef885e12 fix(mail-ingest): never queue a mail again for a failure after its commit
An error in the announcements, documents or notices after a mail was written sent it back to the queue, which duplicated its entries or marked it failed.
2026-11-23 15:11:31 +01:00
Maurice 303d161ecf fix(mail-ingest): keep a booking that fails the item shape in the inbox
Such a booking made the whole mail fail and retry instead of waiting to be filled in by hand. A reference read as a number is now read as its text.
2026-11-23 15:11:31 +01:00
Maurice eaa557343e fix(mail-ingest): compare look-alike bookings at their wall time on any server zone
The window around a booking's start went through the host time zone, so on a server outside UTC it missed a booking at the same local time and added it twice.
2026-11-23 15:11:31 +01:00
Maurice dea903f011 fix(booking-import): treat a booking a forwarded mail added as already imported
The file and assistant import only looked for bookings the file import wrote, so the same booking arrived twice when it had come in by mail first.
2026-11-23 15:11:30 +01:00
Maurice 91edf0c565 fix(mail-ingest): announce a place a mail created with its whole row
The open planners of the trip received only the new place's id and kept a nameless place without coordinates until a reload. The broadcast now carries the row the place routes send.
2026-11-23 15:11:30 +01:00
Maurice 403b7d2f93 fix(mail-ingest): make the own address once when two views ask for it together
The first look at the settings made the address outside a transaction and always revoked the live one, so two requests at once could leave a view showing a revoked address. It is now checked and made in one transaction and never replaces an address it finds.
2026-11-23 15:11:30 +01:00
Maurice 5d4cfec3b6 fix(mail-ingest): list the mail import tools only while the import is on
Every mail tool answered 'Mail import is not available' on installs that never switched the import on, which is the default, so they are now gated like the addon tools.
2026-11-23 15:11:30 +01:00
Maurice b9608bf684 fix(mail-ingest): keep the webhook open for real deliveries while bodies trickle in
The webhook now limits the memory the bodies being read hold instead of the number of open requests, and gives up on a body still arriving after a minute, so a few slow requests no longer turn every delivery away.
2026-11-23 15:11:29 +01:00
Maurice 3b65da7626 fix(mail-ingest): read transfer bookings instead of filing them as forwarding confirmations
A forwarding subject now counts only from Gmail or Microsoft or together with a code in the body, so 'Votre transfert est confirmé' is read as a booking. The subject and From header are also matched in linear time.
2026-11-23 15:11:29 +01:00
Maurice 327539df14 fix(mail-ingest): read forwarded attributions and HTML tags in linear time
A long line of reply verbs, or HTML with line break, script or style tags that never close, made the mail walk backtrack once per word and block the server. Attribution lines past 500 characters are no longer tested.
2026-11-23 15:11:29 +01:00
Maurice c0f6551cf4 test(server): send the API key requests without awaiting in a loop
Server lint counted one no-await-in-loop warning over the tests baseline, from the loop in the new API key test.
2026-11-22 18:24:15 +01:00