fix(accommodations): re-export the module, not the provider inside it

The container refused to boot: Nest will not export a provider that belongs to an
imported module, and the service moved into the domain module in the commit
before. Re-exporting that module gives every importer the same service it always
got, and the wiring test now asserts the shape that actually boots rather than
the one that only typechecks.

Neither tsc nor the unit tests could see this — the module metadata is only read
when a container is built. The e2e harness does build one, and that is what
catches it.
This commit is contained in:
Maurice
2026-09-13 15:50:58 +02:00
parent 46aa0c6b0a
commit 3f6d1e8ed7
2 changed files with 8 additions and 3 deletions
@@ -1,6 +1,5 @@
import { Module } from '@nestjs/common';
import { AccommodationsController } from './accommodations.controller';
import { AccommodationsService } from './accommodations.service';
import { AccommodationsRpc } from './accommodations.rpc';
import { AccommodationsMcp } from './accommodations.mcp';
import { PlacesModule } from '../places/places.module';
@@ -32,6 +31,9 @@ import { McpSharedModule } from '../mcp-shared/mcp-shared.module';
imports: [McpSharedModule, PermissionsModule, RealtimeModule, PluginGuardsModule, DatabaseModule, PlacesModule, AccommodationsDomainModule, AuthModule],
controllers: [AccommodationsController],
providers: [AccommodationsRpc, AccommodationsMcp],
exports: [AccommodationsService],
// The MODULE, not the provider: Nest refuses to export a provider that belongs to
// an imported module, and the service lives in the domain module now. Re-exporting
// the module gives every existing importer the same service it always got.
exports: [AccommodationsDomainModule],
})
export class AccommodationsModule {}
@@ -840,9 +840,12 @@ describe('AccommodationsService wiring', () => {
expectRegisteredProvider(AccommodationsDomainModule, AccommodationsService);
const imports = Reflect.getMetadata('imports', AccommodationsModule) as unknown[];
expect(imports).toEqual(expect.arrayContaining([AccommodationsDomainModule]));
// The MODULE is re-exported, not the provider: Nest refuses to export a provider
// belonging to an imported module, and a boot that fails on that only shows up when
// the container is actually built.
const exports = Reflect.getMetadata('exports', AccommodationsModule) as unknown[];
expect(Array.isArray(exports)).toBe(true);
expect(exports).toEqual(expect.arrayContaining([AccommodationsService]));
expect(exports).toEqual(expect.arrayContaining([AccommodationsDomainModule]));
});
it('ACC-001b: the domain module reaches neither places nor the surfaces', () => {