focusreactive / focusreactive/payload-plugins
translator: enqueue should return the job ids it created
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 0
- Avg merge
- 16h 54m
- Merged PRs (30d)
- 19
Description
Read against **0.10.1**.
## Problem
`enqueue` returns `{ success, queued: N }`. It does not return the ids of the jobs it created.
A host that wants to cancel a run later therefore has nothing to store. The only way to get an id is
`get-document-status` (`/translate/document/:slug/:id`), which returns the latest job per target
locale — so cancelling means an extra lookup at cancel time, on a shape that reflects "latest" rather
than "the job I created".
Combined with the absence of run context in callbacks (#110), it means a host cannot durably connect an editor's
action to a specific job at all.
## Why this matters
We store one row per document × target locale for editorial state and would naturally record the job
id on it at enqueue. We cannot, so cancel does a `findByCollection` lookup first — and that call has
its own scaling problem (#108: it loads every job unpaginated on every enqueue).
## Suggested shape
Return the created job ids, keyed by target locale:
```js
{ success: true, queued: 3, jobs: { fr: "…", de: "…", it: "…" } }
```
The ids exist at that point; they are just not returned.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the translator enqueue path and trace where the created job records are collected and where the current { success, queued } response is assembled. Compare it with get-document-status at /translate/document/:slug/:id, then verify that enqueue returns the created ids keyed by target locale while preserving success and queued.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100