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

Open
#202 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@SearheiParkhamchuk is already working on this.

Since Oct 21, 2026.

Assessment

This issue has not been assessed yet.

Description

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.

Dominant language
TypeScript
Stars
34
Forks
5
Avg merge
2d 4h
Merged PRs (30d)
41

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from focusreactive/payload-plugins

All issues in focusreactive/payload-plugins

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.