[translator] Open the seam to hosts: export the module type and provenance()

Abierto
#202 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@SearheiParkhamchuk ya está trabajando en esto.

Desde el 21/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

enhancement low priority translator

Step 9 of the next major, and the last one. Not part of the next major. No caller passes a host-written module and nothing asks for one: apps/cms/src/lib/plugins/index.ts:403 passes [documentTranslation()], apps/dev/src/payload.config.ts:104 passes [documentTranslation(), fieldTranslation()], and apps/dev/src/integration/translator/bootTestPayload.ts:215 passes the same two. Both factories are already exported. Publishing TranslationModule would publish ModuleContext with it — access, the schema map, the translation provider and the right to add endpoints — which is a wide first promise to make for nobody. Same reasoning as #203.

The module seam becomes public: the module type and provenance() are exported, and the plugin accepts host modules. It comes last because the engine's extraction deliberately breaks the internal package's interface, and nothing is promised to hosts before that has settled. That condition is now met — the engine was separated and the address seam rebuilt — but it was never the only one. The missing one is a consumer.

Five questions are settled by writing a host module against the draft rather than by argument:

  • what a module failure before the save means, and whether provenance declares it skippable;
  • how provenance is switched on — keep the boolean flag, or move to a module list and deprecate the flag;
  • what the admin does when the staleness route is absent, given those routes register today even when provenance is off;
  • what the package entry exports, at minimum the module type and provenance();
  • whether a component may state the abilities it needs, turning a control that can never work into one message at startup.

Depends on: the traversal engine, and the provider port.

Part of #192.


What changed since this was written (2026-11-14)

A module failure before the save is already decided. src/server/modules/translation-run/runChain.ts:18-20 states the rule and its reason: a module is handed payload and may query it, so a failure it raises is assumed to have taken the caller's transaction; swallowOrThrow decides and the chain does not second-guess it, because adopting a module's failure as harmless would also demote one a module raised deliberately. Only the second half of that bullet is open, and it has moved to its own issue.

The staleness bullet rested on something that is no longer true. Those routes are registered inside the provenance module's own setup (src/server/modules/provenance/Provenance.module.ts:51-54), and that module enters the chain only when the flag is on (src/plugin.ts:243-247). Pinned by src/__tests__/plugin.test.ts:64 and :74. #198 closed on 23 October and is what made it false — two days after this issue was written.

The admin's side of that bullet is owned elsewhere. docs/plans/2026-11-13-admin-ui-1.0.research.md R8 and its state table already decide what the panel shows with provenance off. Deciding it here as well is how two answers happen.

There is no provenance() to export. The nearest thing, configureProvenance (src/server/modules/provenance/Provenance.wiring.ts:80), takes a fingerprinter built from the walk and the schema map — values a host does not hold. A host-facing factory would be new API design, not a re-export.

The abilities bullet is an extension, not an invention. RunnerCapabilities (src/server/modules/task-runner/RunnerCapabilities.ts) already does this for runners: declared at config time because routes are built before any payload exists, so a control that cannot work is never drawn, and assertTaskRunnerContract checks the declaration is honest. Extending it to admin components pays once a host writes one.

Research: packages/payload-plugin-translator/docs/plans/2026-11-14-open-the-module-seam.md.

Lenguaje dominante
TypeScript
Estrellas
34
Forks
5
Merge medio
2 d 4 h
PR fusionados (30 d)
41

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de focusreactive/payload-plugins

Todos los issues de focusreactive/payload-plugins

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.