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

Aperta
#202 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@SearheiParkhamchuk ci sta già lavorando.

Dal 21/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
TypeScript
Stelle
34
Fork
5
Merge medio
2g 4h
PR unite (30g)
41

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di focusreactive/payload-plugins

Tutte le issue di focusreactive/payload-plugins

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.