Move the addon-gated domains onto the decorators

collab, journal, atlas, vacay and collections: 32 more methods, so the registry
owns 93 of 113. rpc-host.ts is at 565 lines, down from 1332, and the deps factory
at 384, down from 944.

These five are the risky group, because their addon gates lived inside the deps
factory's closure rather than in the router. A handler that calls its service
directly still works, just without the check, and neither the compiler nor the
router tests would notice. So addon-gates.rpc.test.ts walks all 37 gated methods as
one table and asserts two things for each: with the addon off it is refused with
that addon's message, and the service is never reached. The table length is pinned,
so a later method added without a row is a failure rather than a silent gap.

One ordering detail worth knowing: on the atlas writes the router evaluated its
params before the addon gate inside the closure, so a malformed country code still
reports BAD_PARAMS rather than the addon. The handlers keep that order.

The collections service reports refusals as status-tagged errors rather than typed
ones, so mapCollectionError came across with the handlers: 403 and 404 become
RESOURCE_FORBIDDEN, 400 and 409 become BAD_PARAMS, and anything untagged stays a
HOST_ERROR instead of being dressed up as a permission problem.
This commit is contained in:
Maurice
2026-08-09 15:49:51 +02:00
committed by Maurice
parent 7bca741f28
commit 294cfcd8d7
19 changed files with 1016 additions and 504 deletions
+10
View File
@@ -15,6 +15,11 @@ import { TripsRpc } from '../../src/nest/trips/trips.rpc';
import { CostsRpc } from '../../src/nest/budget/costs.rpc';
import { ReservationsRpc } from '../../src/nest/reservations/reservations.rpc';
import { AccommodationsRpc } from '../../src/nest/days/accommodations.rpc';
import { CollabRpc } from '../../src/nest/collab/collab.rpc';
import { AtlasRpc } from '../../src/nest/atlas/atlas.rpc';
import { VacayRpc } from '../../src/nest/vacay/vacay.rpc';
import { JournalRpc } from '../../src/nest/journey/journal.rpc';
import { CollectionsRpc } from '../../src/nest/collections/collections.rpc';
/**
* The stubbed HostDeps every plugin router test builds on. It used to live inside
@@ -204,5 +209,10 @@ export function allRpcControllers(): object[] {
new CostsRpc(anyService(), anyService(), anyService(), anyService()),
new ReservationsRpc(anyService(), anyService(), anyService()),
new AccommodationsRpc(anyService(), anyService(), anyService()),
new CollabRpc(anyService(), anyService(), anyService()),
new AtlasRpc(anyService(), anyService()),
new VacayRpc(anyService(), anyService()),
new JournalRpc(anyService(), anyService()),
new CollectionsRpc(anyService(), anyService()),
];
}