mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
fix(server): plan 3a re-review 2 follow-ups — absent-ORM boot branch pinned; airports boot hook never rejects; BOOT-SWEEP-001 asserts the seven routes; duplicate comment removed
This commit is contained in:
@@ -20,6 +20,17 @@ import { CronRegistrarService } from '../scheduling/cron-registrar.service';
|
||||
* `runOnBoot` has no `isEnabled()` gate (unlike `register()`), so — parity
|
||||
* with the pre-existing behavior — the backfill still runs in every test
|
||||
* harness that boots this service with a MikroORM, exactly as it did before.
|
||||
*
|
||||
* task-6-rereview2.md M3: the pre-change code could never reject —
|
||||
* `onApplicationBootstrap` awaited one `try`/`catch` around the whole thing.
|
||||
* Putting the `try`/`catch` only INSIDE the `runOnBoot` callback left a gap:
|
||||
* `runOnBoot` itself (its `RequestContext.create`/context machinery) has no
|
||||
* catch of its own, so anything it throws before the callback runs would
|
||||
* propagate out of `onApplicationBootstrap` and abort `app.init()` — a total
|
||||
* boot refusal where the old code swallowed everything. The outer
|
||||
* `try`/`catch` below restores that parity while the inner one stays for its
|
||||
* own reason: `backfillFlightEndpoints` failing must not surface as a
|
||||
* `runOnBoot`-level error.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AirportsService implements OnApplicationBootstrap {
|
||||
@@ -29,13 +40,17 @@ export class AirportsService implements OnApplicationBootstrap {
|
||||
) {}
|
||||
|
||||
async onApplicationBootstrap(): Promise<void> {
|
||||
await this.registrar.runOnBoot('airports-flight-endpoints-boot', async () => {
|
||||
try {
|
||||
await this.backfillFlightEndpoints();
|
||||
} catch (err) {
|
||||
console.error('[DB] Flight endpoint backfill failed:', err);
|
||||
}
|
||||
});
|
||||
try {
|
||||
await this.registrar.runOnBoot('airports-flight-endpoints-boot', async () => {
|
||||
try {
|
||||
await this.backfillFlightEndpoints();
|
||||
} catch (err) {
|
||||
console.error('[DB] Flight endpoint backfill failed:', err);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[DB] Flight endpoint backfill failed:', err);
|
||||
}
|
||||
}
|
||||
|
||||
search(query: string): Airport[] {
|
||||
|
||||
@@ -281,18 +281,6 @@ export class PluginRuntimeService implements OnApplicationBootstrap, OnModuleDes
|
||||
// the boot RULING (task-6-rereview.md §2) settled for CronRegistrarService.
|
||||
// runOnBoot: no ORM means skip loudly and never call activate — never abort
|
||||
// app.init() over a partially-wired test graph.
|
||||
// task-6-rereview.md I1: assertActivatable (inside activate) reads
|
||||
// AddonsService.isAddonEnabled — repository-backed — so this boot loop needs
|
||||
// the same request-context wrap every other D6 choke point got, or an
|
||||
// enabled plugin with a non-empty requiredAddons throws cannotUseGlobalContext
|
||||
// here, silently: the .catch below only reconciles PluginDependencyError /
|
||||
// DependencyCycleError, and the outer try/catch around this whole block eats
|
||||
// everything else.
|
||||
// `activate()` itself stays unwrapped (its HTTP callers already run inside a
|
||||
// request); only this boot-time call site needs it. Fail closed the same way
|
||||
// the boot RULING (task-6-rereview.md §2) settled for CronRegistrarService.
|
||||
// runOnBoot: no ORM means skip loudly and never call activate — never abort
|
||||
// app.init() over a partially-wired test graph.
|
||||
if (!this.orm) {
|
||||
if (order.length) {
|
||||
logError(`PluginRuntimeService.onApplicationBootstrap: no MikroORM available — plugin(s) not activated: ${order.join(', ')}`);
|
||||
|
||||
Reference in New Issue
Block a user