refactor: rename internal promptId/PromptId to jobId/JobId (#8730)

## Summary

Rename all internal TypeScript usage of legacy `promptId`/`PromptId`
naming to `jobId`/`JobId` across ~38 files for consistency with the
domain model.

## Changes

- **What**: Renamed internal variable names, type aliases, function
names, class getters, interface fields, and comments from
`promptId`/`PromptId` to `jobId`/`JobId`. Wire-protocol field names
(`prompt_id` in Zod schemas and `e.detail.prompt_id` accesses) are
intentionally preserved since they match the backend API contract.

## Review Focus

- All changes are pure renames with no behavioral changes
- Wire-protocol fields (`prompt_id`) are deliberately unchanged to
maintain backend compatibility
- Test fixtures updated to use consistent `job-id` naming

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8730-refactor-rename-internal-promptId-PromptId-to-jobId-JobId-3016d73d3650813ca40ce337f7c5271a)
by [Unito](https://www.unito.io)
This commit is contained in:
Christian Byrne
2026-02-20 02:10:53 -08:00
committed by GitHub
parent 541ad387b9
commit 473713cf02
39 changed files with 455 additions and 402 deletions

View File

@@ -309,14 +309,14 @@ export class TaskItemImpl {
}
get key() {
return this.promptId + this.displayStatus
return this.jobId + this.displayStatus
}
get queueIndex() {
return this.job.priority
}
get promptId() {
get jobId() {
return this.job.id
}
@@ -405,7 +405,7 @@ export class TaskItemImpl {
if (!this.isHistory) {
return this
}
const jobDetail = await getJobDetail(this.promptId)
const jobDetail = await getJobDetail(this.jobId)
if (!jobDetail?.outputs) {
return this
@@ -421,7 +421,7 @@ export class TaskItemImpl {
}
// Single fetch for both workflow and outputs (with caching)
const jobDetail = await getJobDetail(this.promptId)
const jobDetail = await getJobDetail(this.jobId)
const workflowData = await extractWorkflow(jobDetail)
if (!workflowData) {
@@ -460,7 +460,7 @@ export class TaskItemImpl {
new TaskItemImpl(
{
...this.job,
id: `${this.promptId}-${i}`
id: `${this.jobId}-${i}`
},
{
[output.nodeId]: {
@@ -527,13 +527,10 @@ export const useQueueStore = defineStore('queue', () => {
const appearedTasks = [...pendingTasks.value, ...runningTasks.value]
const executionStore = useExecutionStore()
appearedTasks.forEach((task) => {
const promptIdString = String(task.promptId)
const jobIdString = String(task.jobId)
const workflowId = task.workflowId
if (workflowId && promptIdString) {
executionStore.registerPromptWorkflowIdMapping(
promptIdString,
workflowId
)
if (workflowId && jobIdString) {
executionStore.registerJobWorkflowIdMapping(jobIdString, workflowId)
}
})
@@ -546,7 +543,7 @@ export const useQueueStore = defineStore('queue', () => {
...queue.Running.map((j) => j.id),
...queue.Pending.map((j) => j.id)
])
executionStore.reconcileInitializingPrompts(activeJobIds)
executionStore.reconcileInitializingJobs(activeJobIds)
}
// Sort by create_time descending and limit to maxItems
@@ -556,12 +553,12 @@ export const useQueueStore = defineStore('queue', () => {
// Reuse existing TaskItemImpl instances or create new
// Must recreate if outputs_count changed (e.g., API started returning it)
const existingByPromptId = new Map(
currentHistory.map((impl) => [impl.promptId, impl])
const existingByJobId = new Map(
currentHistory.map((impl) => [impl.jobId, impl])
)
historyTasks.value = sortedHistory.map((job) => {
const existing = existingByPromptId.get(job.id)
const existing = existingByJobId.get(job.id)
if (!existing) return new TaskItemImpl(job)
// Recreate if outputs_count changed to ensure lazy loading works
if (existing.outputsCount !== (job.outputs_count ?? undefined)) {
@@ -590,7 +587,7 @@ export const useQueueStore = defineStore('queue', () => {
}
const deleteTask = async (task: TaskItemImpl) => {
await api.deleteItem(task.apiTaskType, task.promptId)
await api.deleteItem(task.apiTaskType, task.jobId)
await update()
}