fix(modules): switch the inbound-documents module off in code

The inbound-documents surface is withdrawn from this release and returns
later with more depth. Park its module key (`inboundDocuments`) in a new
`CODE_DISABLED_MODULE_KEYS` list so it is hard-off for every account ahead
of both the operator-availability and the per-user opt-in layer.

The gate short-circuits a code-disabled key to disabled, so the resolved
module map reports it off everywhere: the nav entry stays born-gated and
hidden, the `/documents` page redirects, and every `/api/documents/inbound/*`
route returns the 403 module-disabled envelope. The Modules hub and the
operator-availability panel drop the row, and the per-user PATCH surface
refuses to write the key (a clean 422 instead of an inert preference).

The whole implementation stays intact — routes, the inbound-documents view,
the registry entry with its opt-in marker, the validation schemas, and the
migration are all preserved. Re-enabling the module is a one-line removal
from the list once the rebuild lands.

Regenerate the OpenAPI contract: the module-preferences PATCH body no
longer advertises the parked key.
This commit is contained in:
Marc-André Bombeck committed 2026-06-29 14:58:30 +02:00
1 parent 4266203d3a
commit 7e83af5701
8 files changed
+152 -73

No files matched your search

+10 -3
View File
@@ -25,14 +25,21 @@
*/
import { z } from "zod/v4";
import { MODULE_KEYS, moduleDelegatesTo } from "@/lib/modules/registry";
import {
MODULE_KEYS,
isCodeDisabledModule,
moduleDelegatesTo,
} from "@/lib/modules/registry";
/**
* The directly-owned (non-delegated) toggleable keys — the only keys this
* PATCH surface may write into `modulePreferencesJson`.
* PATCH surface may write into `modulePreferencesJson`. A module switched
* off in code (pending a rebuild) is also excluded, so a client trying to
* opt into it gets a clean 422 rather than persisting an inert `true` the
* gate would ignore anyway.
*/
const WRITABLE_MODULE_KEYS = MODULE_KEYS.filter(
(k) => moduleDelegatesTo(k) === undefined,
(k) => moduleDelegatesTo(k) === undefined && !isCodeDisabledModule(k),
);
/** Build `{ <writableKey>?: boolean }` from the directly-owned key list. */