Commit Graph

65 Commits

Author SHA1 Message Date
jubnl 21ade19d44 refactor(db): TrekRepository base — every repository path validates the request context and reads bypass the identity map by default 2026-09-22 22:37:49 +02:00
jubnl 8ba55bda30 fix(db): generator emits the referenced column for non-PK foreign keys; OAuth client joins through the relation; FK parity un-skipped 2026-09-22 21:53:34 +02:00
jubnl 80a0fdc4d9 fix(auth): non-numeric passkey and invite ids answer the legacy 404, never NaN; invite join type pinned 2026-09-22 21:31:46 +02:00
jubnl d82395d0ae refactor(oauth): OAuth server tables through repositories
OauthClientsRepository/OauthTokensRepository/OauthConsentsRepository
replace OauthService's raw SQL (OA1-OA33). revokeChain's recursive CTE
and the oauth_clients join (its FK actually targets client_id, not the
row id the generated relation assumes) go through em.getKysely();
OA19's chain revoke is one nativeUpdate($in); OA12's consent grant is
em.upsert on the (client, user) unique key. revokeAllForUser built now
for Task 5. Every row-out read is disableIdentityMap: true; inserts go
through em.insert.
2026-09-22 21:18:08 +02:00
jubnl 44cf31c958 fix(server): non-numeric route ids answer the legacy not-found, never NaN (tokens, categories, tags); mint path back to two statements; identity-map regression pinned 2026-09-22 21:08:06 +02:00
jubnl 8d0dddf385 fix(db): row-out repository reads bypass the identity map — stale write-back over nativeUpdate at flush; insertUser via em.insert; settings round-trip pinned 2026-09-22 20:32:35 +02:00
jubnl e9d0cb60e0 refactor(auth): passkeys and registration invites through repositories 2026-09-22 20:25:50 +02:00
jubnl daef15be70 refactor(tokens): MCP and API tokens through McpTokensRepository 2026-09-22 20:23:11 +02:00
jubnl 57f4e29b9a refactor(auth): users table through UsersRepository; JWT and MFA lookups repository-backed 2026-09-22 19:39:01 +02:00
jubnl 7453c7dafa feat(server): pre-init photo route and WS handshake run in a request context; InviteTokensRepository 2026-09-22 18:48:24 +02:00
jubnl 66703efeb7 feat(db): generated entities declare their repository type; test casts dropped 2026-09-22 18:01:45 +02:00
jubnl 761cd14b2b fix(server): plan 3a review follow-ups — fail closed without an ORM at every choke point; seam and D5 ratchet tests; dead method and DDL copies removed 2026-09-22 16:54:45 +02:00
jubnl 570a6ede85 fix(db): generator names relation properties in captured UNIQUE constraints 2026-09-22 15:46:46 +02:00
jubnl 6763648c45 refactor(settings): user and instance settings through repositories
SettingsRepository (getForUser/upsertForUser/getOne/deleteForUser) replaces
the per-user settings table's raw SQL; SettingsService drops DatabaseService
entirely. instance-api-keys.ts's readInstanceApiKey/writeInstanceApiKey/
resolveApiKey take an explicit AppSettingsRepository/UsersRepository instead
of a raw connection.

An earlier version resolved those two repositories itself from the active
MikroORM request context, so none of its six callers needed to change. That
worked in production and e2e (always inside a real request) but broke
service construction in plain unit tests across every calling domain
(addons, auth x2, maps, transit, unsplash - 185 failures on a full run),
since none of them wrap a request context. Each of those six services now
injects its own AppSettingsRepository/UsersRepository and passes them
through explicitly, matching how every other converted repository in this
migration is consumed; their own SQL is untouched (outside Plan 3a).
2026-09-22 15:08:49 +02:00
jubnl 09a0a929b4 fix(db): PK lookups inside patch refresh past the identity map; corrected identity-map notes 2026-09-22 14:26:29 +02:00
jubnl 310a3b0ad3 fix(db): generator captures inline UNIQUE constraints
SqliteSchemaHelper.getIndexes() drops every unnamed sqlite_autoindex_
entry before entity-generator ever sees it, so a table-level
UNIQUE(...) constraint with no separate named CREATE UNIQUE INDEX
(settings' UNIQUE(user_id, key) among ~40 others) never reached the
generated entity's uniques: metadata. Adds a general
RULE9_addImplicitUniqueConstraints (skips a column set identical to
the table's own primary key — AppSettings.key/Addons.id noise) fed by
a PRAGMA index_list/index_info scan, and regenerates every entity.
2026-09-22 14:13:09 +02:00
jubnl 6db91c8bf3 refactor(addons): addon catalog and photo providers through repositories 2026-09-22 14:06:57 +02:00
jubnl aa1067035f refactor(categories, tags): repositories replace raw SQL 2026-09-22 13:54:13 +02:00
jubnl 86c558cdd6 fix(audit): audit rows are native inserts, not a unit-of-work flush; closed test ORMs 2026-09-22 12:56:03 +02:00
jubnl b0905f9867 docs(db): owned-lookup call-site convention; refresh side effect; e2e ORM module spread notes 2026-09-22 12:53:47 +02:00
jubnl 4209343328 fix(db): PK reads refresh past the identity map; typed owned-lookup generics; e2e ORM module mirrors production config 2026-09-22 12:38:59 +02:00
jubnl c2da9d62f7 refactor(audit): audit log writes through AuditLogRepository 2026-09-22 12:34:49 +02:00
jubnl f460ae4fcb feat(db): AppSettings and Users repositories; forFeature wiring pattern 2026-09-22 12:06:13 +02:00
jubnl 47e1801908 chore(db): entity --check reports stray files; class-field census is a ratchet; migrate-encryption typechecked 2026-09-22 11:57:50 +02:00
jubnl 11eeed46ee fix(db): no NaN class-field initialisers; entity generator --check gate in CI; parity normaliser keeps literal case 2026-09-22 11:42:48 +02:00
jubnl 60d6e1fcd1 refactor(db): every entity in the snake_case shape; document-sync entities added; one repository per entity 2026-09-22 11:01:36 +02:00
jubnl 7534c2f903 fix(db): generator keeps NOT NULL boolean defaults; fails if a JSON interface import survives 2026-09-22 10:39:07 +02:00
jubnl 257529b250 fix(db): generator guard rails — validation cannot mask hidden()/index loss; typed JSON; loud failures 2026-09-22 10:24:10 +02:00
jubnl 7f379cac85 feat(db): re-runnable entity generator encoding the snake_case/DbTimestampType rules 2026-09-22 09:26:28 +02:00
jubnl 1e52332208 test(db): numeric ids for the primary-relation spike 2026-09-22 08:43:20 +02:00
jubnl fc1c788e9a test(db): parity gate also holds declared pivot entities; per-field column types; missing-set ratchets both ways 2026-09-22 08:38:06 +02:00
jubnl 4a67be3f87 feat(db): primary-relation entities proven (BudgetCategoryOrder, VacayUserSettings) 2026-09-22 08:35:46 +02:00
jubnl 6d6b6932f4 test(db): entity metadata must match the migrated schema; fix the four drifts it found 2026-09-22 08:25:43 +02:00
jubnl ef184ec7c2 test(server): ORM suites open the schema snapshot; RESET_TABLES derived from the schema 2026-09-21 18:12:07 +02:00
jubnl f4fe27a3f8 fix(db): dialect helpers dispatch on the platform; lint gate for the repository layer 2026-09-21 18:12:07 +02:00
jubnl 443dc35c03 fix(db): repositories mirror the statement's column set and guard their row types 2026-09-21 09:54:15 +02:00
jubnl 229f4890df feat(db): snake_case entity shape and the first three repositories (Days, DayNotes, Trips) 2026-09-21 09:39:40 +02:00
jubnl 479e2cb0a5 test(db): dialect helper refuses malformed column references and day counts 2026-09-21 09:27:05 +02:00
jubnl 5691f966af feat(db): dialect helper is the one place SQL functions are spelled 2026-09-21 09:19:47 +02:00
jubnl 565f72740b test(db): createTestOrm binds an ORM to a suite's own SQLite handle 2026-09-21 09:17:17 +02:00
jubnl 9ca9ca9644 feat(db): discover entities from an explicit list instead of a glob 2026-09-21 08:50:56 +02:00
jubnl 4ba43d6cd5 feat(db): DbTimestampType keeps DATETIME columns as the CURRENT_TIMESTAMP text 2026-09-21 08:50:56 +02:00
jubnl 57decad494 Merge remote-tracking branch 'origin/dev' into feat/orm 2026-09-20 21:45:48 +02:00
jubnl 70e970453e migrations + seeders 2026-09-20 21:38:32 +02:00
Maurice be9a38e3b0 fix(accommodations): a second night on the day counts by its check-in
Two bookings on one day used to settle by whichever was seated last, because
the other night's stop carries no hour of its own. Its check-in counts now,
in the service and in the migration alike.
2026-09-20 18:48:26 +02:00
Maurice 417d0445b9 fix(roadtrip): seat the nights booked before this release where their check-in says
A booked night leads its day now, but the stops the bookings put on their
check-in day before this release sit last, and the backfill for older
bookings appended them too. Every trip planned before the change kept that
order until somebody edited the check-in.

A migration seats every night a booking owns by the same rule the service
applies: first, behind only a stop whose own clock is at or before the
check-in. The drawn roads follow the stops they were drawn after, by the
rules the service uses when it moves a night. Stops the traveller placed
themselves are not touched. Re-runnable.
2026-09-20 18:45:37 +02:00
Maurice ed18c37903 fix: the findings of the final 4.3.0 audit
Every file the release touches was read once more, and what survived an
independent check against the code is fixed here, with a test for each.

Data and credentials
- A document sync connection edited to a new address no longer carries the
  stored token along: a blank form under another origin is refused, the same
  rule the probe route already had. Dawarich and AirTrail testConnection send
  the stored key only to the host it was stored for.
- The key rotation script now covers document_connections.secrets and
  trip_document_links.webhook_secret, which it had skipped.
- Turning a booked night into a pause in the road trip popup asks first and
  says that the booking and its expense go with it. Deleting a place says the
  same when a night is booked there, on the desktop and on the phone.
- A moved version marker over unchanged bytes no longer replaces the TREK file
  and its attachments; a real revision carries the attachments over.

Planner
- A drop in the day plan names the row it lands ahead of in the full day, so a
  hidden hotel stop no longer shifts it one slot early; the store sorts before
  it splices. Via re-anchoring, the booked-night guard and the sidebar's day
  membership read the stored day, the index space the server uses.
- A hotel stop placed mid-day re-pins the road trip vias of that day, and the
  booking session receives the new stop order too. The Public API and the iCal
  feed list a booked hotel once. A plugin can no longer write a stay against
  another trip's day.

Road trip and map
- The route overview paces its requests to the public routers and retries a
  rate limit, and it says which legs it could not route instead of quietly
  reporting a shorter trip. A click on a via handle no longer drops a second
  via; handles hide when zooming out. Read-only members cannot edit the driving
  limits. The phone shows a way back when no day is picked and prints the night
  drive departure in the chosen clock format.

Integrations and search
- Google transit keeps conventional trains when the train chip is on.
  TREK_PLACES_ENABLED=false stops the details and enrichment calls too, and
  accepts the whole boolean family. A caller-supplied description no longer
  lands in the instance-wide enrichment cache. Nominatim searches carry a
  timeout. An OSM place id is checked for shape before it reaches Overpass.
- Dawarich puts a stay on the trip whose dates hold it, the Atlas hand-off
  knows what the Atlas already shows, and a host change with a new key clears
  the old instance's state.
- Document sync: a webhook address pasted by hand works on the token alone,
  deleting a connection unregisters its subscriptions, Nextcloud under a
  sub-path connects, Synology answers a name collision before uploading and
  verifies a move into the bin, Paperless titles are capped at 128 characters,
  a DNS failure reads as unreachable rather than as a policy verdict, videos
  from the store are accepted like uploads, and remote_missing has a way out.
  Conflict buttons only for the owner, a refused choice is reported, a refused
  credential gets a Reconnect button, disconnecting asks first on the desktop
  as it does on the phone, and the folder picker no longer spins forever.

Release
- The server holds the release notice back from a bundle that cannot draw it,
  so the previous shell served from the service worker cache after an update
  no longer shows bare keys and no longer lets a click use the notice up.
- Import into an existing list gets the same body limit as a new list. Chat
  images say when the limit is reached and the new controls are translated.
  The transit backend switch reports a failed save. The Helm chart carries the
  Amap credentials in its Secret; the shipped templates document the Places
  API and Amap variables and the Overpass default. The wiki follows.
2026-09-20 13:54:31 +02:00
Maurice 62cccf32f3 fix(db): give clipped trips their days back and let road-trip day numbers follow the trip limit
Two boot migrations. The first appends the missing dated days to a trip
the old 365-day cap clipped, only where the dated days still run unbroken
from the start date, so a trip that was re-dated by hand or lost a day in
the middle is left alone; dateless days that hold content stay behind the
dated ones as generateDays keeps them. The second rebuilds
roadtrip_day_boundaries without the CHECK that held day_number to 366,
which would have refused a boundary on a later day of a longer trip.

The road-trip contracts follow the same limit: the day boundary and
corridor schemas, the set_day_boundary tool and the day window's runaway
guard read MAX_TRIP_DAYS instead of their own 365 or 366, and the
tooLong message carries the number as a placeholder in all 23 locales.
2026-09-20 12:34:34 +02:00
Maurice a635e31bd4 test(db): pin the roadtrip preferences replay to its own schema version 2026-09-12 17:33:04 +02:00
Maurice b773faff70 feat(roadtrip): share trip preferences and improve service stops 2026-09-12 00:24:45 +02:00