mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
fix(ci): repair map fixtures and keep renderer dependencies layered
Use the engine write lock for map defaults and clean the metadata-free test snapshot with Kysely. Model the Leaflet bridge option, keep the renderer failure state below the settings store, and make the tile tests independent of the transpiler quote style.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { resolveEngine } from '../engine';
|
||||
import { writeTransaction } from '../engine/write-transaction';
|
||||
import type { DB } from '../kysely/db';
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import { Seeder } from '@mikro-orm/seeder';
|
||||
@@ -10,7 +12,7 @@ const STYLE = 'default_user_setting_maplibre_style';
|
||||
/** Give a new installation a starting basemap before its first user is created. */
|
||||
export class MapDefaultsSeeder extends Seeder {
|
||||
async run(em: EntityManager): Promise<void> {
|
||||
await em.transactional(async (tx) => {
|
||||
await writeTransaction(em, resolveEngine(), async (tx) => {
|
||||
const db = (tx as SqlEntityManager).getKysely<Pick<DB, 'app_settings' | 'schema_version' | 'users'>>();
|
||||
// SchemaVersionSeeder writes this marker after the first bootstrap even on
|
||||
// SSO-only installations that are still waiting for their first account.
|
||||
|
||||
@@ -282,7 +282,6 @@ export class SettingsService {
|
||||
// null/undefined means "reset to built-in default" — delete the row
|
||||
if (value === null || value === undefined) {
|
||||
await this.appSettings.deleteValue(appKey);
|
||||
if (key === 'map_provider') await this.appSettings.deleteValue(MAP_PROVIDER_DEFAULT_CHOSEN_KEY);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -300,9 +299,11 @@ export class SettingsService {
|
||||
? (maybe_encrypt_api_key(String(value)) ?? String(value))
|
||||
: JSON.stringify(value);
|
||||
await this.appSettings.setValue(appKey, stored);
|
||||
// The admin page saves a field only when the admin sets it, so a stored
|
||||
// provider default is always a choice a managed install has to keep.
|
||||
if (key === 'map_provider') await this.appSettings.setValue(MAP_PROVIDER_DEFAULT_CHOSEN_KEY, 'true');
|
||||
}
|
||||
// An admin provider change and its marker are one transaction.
|
||||
if (Object.hasOwn(partial, 'map_provider')) {
|
||||
if (partial.map_provider == null) await this.appSettings.deleteValue(MAP_PROVIDER_DEFAULT_CHOSEN_KEY);
|
||||
else await this.appSettings.setValue(MAP_PROVIDER_DEFAULT_CHOSEN_KEY, 'true');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user