diff --git a/changelog.d/1190.fixed.md b/changelog.d/1190.fixed.md new file mode 100644 index 00000000..d674a32c --- /dev/null +++ b/changelog.d/1190.fixed.md @@ -0,0 +1 @@ +A job's model-and-role line now marks a claimed seat the instance never observed — "claimed, not observed" / “声称,未观察”, or "claimed, not verified" when the row predates the observation record — on both the job page's "Why this change" block and the console's job rows, including after the console's live stream updates them. The two surfaces and the stream now take the mark from one reconstruction of the record, so the job page, the change story and the console cannot disagree about whether a seat was seen; a claim is no longer printed as a fact in either place. diff --git a/docs/api.md b/docs/api.md index 6a054666..3c1a4b67 100644 --- a/docs/api.md +++ b/docs/api.md @@ -317,8 +317,11 @@ the browser. comment otherwise. The snapshot includes `bots` (with `tool`, `step`, `since`, `lastActivityAt`), `questions` (with `id`, `sessionId`, `question`, `detail`, `options`, `multiSelect`), `timeline` (active/ended role activity), `jobs` -(summary, status, issue/PR and attribution) and quota. Clients should fall back to the -5-second JSON poll if the stream drops. +(summary, status, issue/PR, `attribution` and the server-rendered +`attributionText`, which carries the claim marker in the request's language) and +quota. The 5-second JSON poll carries the same `attributionText` on its job +entries, so the answer does not change when the stream drops. Clients should fall +back to the 5-second JSON poll if the stream drops. `POST /api/repos/:id/team/answer` takes JSON: diff --git a/docs/architecture.md b/docs/architecture.md index 7f94c77e..e3e719e6 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -2381,11 +2381,15 @@ Team attribution is grounded in the DSH per-role call counts, which prove that a seat worked and never that it wrote a file. `jobs.attribution_json` holds what the job claimed; `jobs.attribution_ground_json` records the observation beside it, per attribution key, as `claimed` / `observed` / `state` (`grounded`, `unobserved`, -`no-observation`), so an observation never overwrites a claim. The job page and the -dashboard job row mark a claimed seat the instance did not see as -`claimed, not observed`, a claim nothing observed as `claimed, not verified`, and -leave a grounded seat unmarked; a seat only the instance saw is shown from the -observation. The PR automation comment uses the observed roles and falls back to +`no-observation`), so an observation never overwrites a claim. Every reader of the +claim marks it with the same vocabulary: the job page and the dashboard job row, +the job page's change-story `Model and role` row (the marker goes in the row's +note, because the model half is not what the claim is about), and the console's +live job rows, whose snapshot and 5-second fallback both carry the server-rendered +`attributionText` so a stream tick cannot replace a marked seat with the bare +claim. A claimed seat the instance did not see reads `claimed, not observed`, a +claim nothing observed reads `claimed, not verified`, and a grounded seat is +unmarked; a seat only the instance saw is shown from the observation. The PR automation comment uses the observed roles and falls back to the claim only when there was no observation. None of this blocks a merge: an instance exists only where one is configured, so the marker describes the record rather than gating it. A claimed role with zero calls still records a diff --git a/docs/images/1190/after-A-job-page-zh-1280.png b/docs/images/1190/after-A-job-page-zh-1280.png new file mode 100644 index 00000000..0058f9c5 Binary files /dev/null and b/docs/images/1190/after-A-job-page-zh-1280.png differ diff --git a/docs/images/1190/after-B-console-row-zh-1280.png b/docs/images/1190/after-B-console-row-zh-1280.png new file mode 100644 index 00000000..d6d2c3bb Binary files /dev/null and b/docs/images/1190/after-B-console-row-zh-1280.png differ diff --git a/docs/images/1190/before-A-job-page-zh-1280.png b/docs/images/1190/before-A-job-page-zh-1280.png new file mode 100644 index 00000000..88e7ecf1 Binary files /dev/null and b/docs/images/1190/before-A-job-page-zh-1280.png differ diff --git a/docs/images/1190/before-B-console-row-zh-1280.png b/docs/images/1190/before-B-console-row-zh-1280.png new file mode 100644 index 00000000..9268de59 Binary files /dev/null and b/docs/images/1190/before-B-console-row-zh-1280.png differ diff --git a/public/team.js b/public/team.js index 57821fc9..389723bf 100644 --- a/public/team.js +++ b/public/team.js @@ -178,7 +178,11 @@ } const attr = row.querySelector('[data-job-attribution]') if (attr) { - const text = attribution(job.attribution) + // #1190: the server-rendered string is authoritative when it is present — + // it already carries the claim marker, in this reader's language. The + // structured fallback stays for an older payload that has no text. + const rendered = typeof job.attributionText === 'string' ? job.attributionText : '' + const text = rendered !== '' ? rendered : attribution(job.attribution) if (text) attr.textContent = text } } diff --git a/src/app.ts b/src/app.ts index 53a6a96b..77d853d8 100644 --- a/src/app.ts +++ b/src/app.ts @@ -123,6 +123,7 @@ import { agentWorkspacePage, settingsPage, inboxSection, + jobAttribution, errorPage, type InboxQuestion, type ScheduledNext, @@ -1063,7 +1064,14 @@ export async function buildApp(options: BuildOptions): Promise { // #793: which model and role did the work is on the job row, so it is read // here rather than from the pull request body. The row can be read even when // GitHub cannot, which is why every branch below carries it. - const attribution = changeStoryAttribution({ modelJson: job.model_json, attributionJson: job.attribution_json }) + const attribution = changeStoryAttribution({ + modelJson: job.model_json, + attributionJson: job.attribution_json, + // #1190: the record decides whether the claim was observed, and the same + // reconstruction the job page uses keeps a pre-#1186 row honest. + groundJson: job.attribution_ground_json, + teamStatsJson: job.team_stats_json, + }) const parsed = parsePrUrl(repo, job.pr_url, config.github.apiBase) let story: ChangeStory let tip: PullTip | null = null @@ -3584,7 +3592,14 @@ export async function buildApp(options: BuildOptions): Promise { requireAdvanced(viewer) try { const state = await instances.teamState(repo.id, 15_000) - return { ...state, jobs: localizedJobs(store.listJobsForRepo(repo.id).slice(0, 5), request.locale ?? 'zh') } + const t = translator(request.locale ?? 'zh') + // #1190: the poll and the stream must agree about a marked claim, so both + // carry the same rendered `attributionText`. + return { + ...state, + jobs: localizedJobs(store.listJobsForRepo(repo.id).slice(0, 5), request.locale ?? 'zh') + .map((job) => ({ ...job, attributionText: jobAttribution(t, job) })), + } } catch (error) { return reply.code(503).send({ error: error instanceof Error ? error.message : String(error) }) } @@ -3854,19 +3869,27 @@ export async function buildApp(options: BuildOptions): Promise { remainingCny: quota.remainingCny, exhausted: quota.exhausted, }, - jobs: localizedJobs(store.listJobsForRepo(repo.id, 5), request.locale ?? 'zh').map((job) => ({ - id: job.id, - kind: job.kind, - status: job.status, - summary: job.summary, - error: job.error, - issueUrl: job.issue_url, - prUrl: job.pr_url, - reviewScore: job.review_score, - attribution: parseAttributionJson(job.attribution_json), - createdAt: job.created_at, - finishedAt: job.finished_at, - })), + jobs: (() => { + const t = translator(request.locale ?? 'zh') + return localizedJobs(store.listJobsForRepo(repo.id, 5), request.locale ?? 'zh').map((job) => ({ + id: job.id, + kind: job.kind, + status: job.status, + summary: job.summary, + error: job.error, + issueUrl: job.issue_url, + prUrl: job.pr_url, + reviewScore: job.review_score, + attribution: parseAttributionJson(job.attribution_json), + // #1190: the server-rendered text is what the console shows, so the + // first tick cannot replace a marked claim with the bare seat. The + // structured field keeps its type; the script contains no marker + // vocabulary of its own. + attributionText: jobAttribution(t, job), + createdAt: job.created_at, + finishedAt: job.finished_at, + })) + })(), } const text = JSON.stringify(snapshot) if (text !== last) { diff --git a/src/lib/attribution.ts b/src/lib/attribution.ts index 8e63dbf0..63b1929b 100644 --- a/src/lib/attribution.ts +++ b/src/lib/attribution.ts @@ -122,3 +122,53 @@ export function parseAttributionGroundJson(value: string | null): AttributionGro return null } } + +// #368/#1190: one reconstruction of the ground record, shared by every reader of +// the claim. A row written before `attribution_ground_json` exists carries the +// observation in `attribution_json` itself when team stats were recorded (the +// old writer overwrote the claim), and a claim nothing checked otherwise. The +// reconstruction is a rule, not a guess: a stored record always wins. +export function attributionGroundFor(input: { + groundJson: string | null + attributionJson: string | null + teamStatsJson: string | null +}): AttributionGround | null { + const stored = parseAttributionGroundJson(input.groundJson) + if (stored !== null) return stored + const recorded = parseAttributionJson(input.attributionJson) + if (recorded === null) return null + const observedOnly = input.teamStatsJson !== null + return { + steps: ATTRIBUTION_FIELDS + .filter((field) => recorded[field.key] !== undefined) + .map((field) => ({ + key: field.key, + claimed: observedOnly ? null : (recorded[field.key] as string), + observed: recorded[field.key] as string, + state: observedOnly ? 'grounded' as const : 'no-observation' as const, + })), + } +} + +const CLAIM_STATE_ORDER: Record = { grounded: 0, unobserved: 1, 'no-observation': 2 } + +/** + * How the record judges the seat's claim on `role`, or null when the role is not + * claimed at all (an observation-only seat). The worst state among the claiming + * steps speaks for the role, the same rule `jobAttribution` applies to one seat + * on several kinds of work: a seat seen on one kind of work and not on another + * is not a grounded seat. + */ +export function claimedRoleState( + ground: AttributionGround | null, + role: string | null, + keys: readonly AttributionKey[] = ['writtenBy', 'implementedBy'], +): AttributionGroundState | null { + if (ground === null || role === null || role === '') return null + let worst: AttributionGroundState | null = null + for (const step of ground.steps) { + if (step.claimed !== role || !keys.includes(step.key)) continue + if (worst === null || CLAIM_STATE_ORDER[step.state] > CLAIM_STATE_ORDER[worst]) worst = step.state + } + return worst +} diff --git a/src/lib/changeStory.ts b/src/lib/changeStory.ts index f8a8e65b..b7349241 100644 --- a/src/lib/changeStory.ts +++ b/src/lib/changeStory.ts @@ -5,7 +5,8 @@ // it parses the body the agent wrote and adds the diff totals. Pure, no model // call, no network. -import { parseAttributionJson } from './attribution.js' +import { attributionGroundFor, claimedRoleState, parseAttributionJson } from './attribution.js' +import type { AttributionGroundState } from './attribution.js' import { parseModelRun } from './modelRun.js' // #793: the body also carries what was considered instead, what remains @@ -45,9 +46,17 @@ export interface ChangeStorySection { // #793: which model answered and which role wrote the change, read from the job // row. `null` for a half means the row does not record it; it is never inferred // from the other half or from the body. +// +// #1190: `state` is how the ground record judges that claimed role, or null when +// the role is not claimed (an observation-only seat cannot be a false claim) or +// when the record says the claim was observed. The row's note uses it; the value +// never changes, because the model half is not what the claim is about. export interface ChangeStoryAttribution { model: string | null role: string | null + // Optional so a caller that has no record yet (an older fixture, a unit test of + // the pair alone) states "no judgement" rather than inventing `grounded`. + state?: AttributionGroundState | null } export type ChangeStoryDiffState = 'ok' | 'capped' | 'unreadable' @@ -71,6 +80,10 @@ export interface ChangeStoryLabels { capped?: string duplicate?: string files?: (count: number) => string + // #1190: the two marker words #1186 renders on the job page's team line. The + // change-story row uses the same vocabulary rather than inventing a second one. + claimedNotObserved?: string + claimedNotVerified?: string } export interface ChangeStoryFact { @@ -200,12 +213,21 @@ export function parseChangeStoryBody(body: string): ChangeStorySection[] { export function changeStoryAttribution(input: { modelJson: string | null attributionJson: string | null + groundJson?: string | null + teamStatsJson?: string | null }): ChangeStoryAttribution | null { const model = parseModelRun(input.modelJson)?.model?.label ?? null const attribution = parseAttributionJson(input.attributionJson) const role = attribution?.writtenBy ?? attribution?.implementedBy ?? null if (model === null && role === null) return null - return { model, role } + // #1190: the record, not the page, decides whether the claim was observed. A + // row that predates the ground column is reconstructed by the same rule. + const ground = attributionGroundFor({ + groundJson: input.groundJson ?? null, + attributionJson: input.attributionJson, + teamStatsJson: input.teamStatsJson ?? null, + }) + return { model, role, state: claimedRoleState(ground, role) } } // `totals` is the caller's sum (the reader owns the file walk and its cap); @@ -237,6 +259,8 @@ const DEFAULT_LABELS: Required = { capped: 'the file list exceeded the cap', duplicate: 'a repeated heading; the last one is shown', files: (count: number) => `${count} files`, + claimedNotObserved: 'claimed, not observed', + claimedNotVerified: 'claimed, not verified', } export function changeStoryFacts(story: ChangeStory, labels: ChangeStoryLabels = {}): ChangeStoryFact[] { @@ -254,6 +278,13 @@ export function changeStoryFacts(story: ChangeStory, labels: ChangeStoryLabels = // "not stated" (nothing recorded) rather than "not available" (nothing read). const recorded = [story.attribution?.model ?? null, story.attribution?.role ?? null] .filter((part): part is string => part !== null && part !== '') - facts.push({ key: 'attribution', value: recorded.length === 0 ? l.notStated : recorded.join(' · '), note: '' }) + // #1190: the row keeps `model · role` (the claim is about the role, not the + // model) and puts the claim's state in the note, so a seat nothing observed is + // not printed as a fact. + const state = story.attribution?.state ?? null + const claimNote = state === 'unobserved' + ? l.claimedNotObserved + : state === 'no-observation' ? l.claimedNotVerified : '' + facts.push({ key: 'attribution', value: recorded.length === 0 ? l.notStated : recorded.join(' · '), note: claimNote }) return facts } diff --git a/src/views/pages.ts b/src/views/pages.ts index bab421ee..331a1073 100644 --- a/src/views/pages.ts +++ b/src/views/pages.ts @@ -31,9 +31,8 @@ import { diffContextBundles, readContextBundle, verifyContextBundle } from '../l import type { AdherenceRecord, AdherenceStatus, ClauseStatus, ClauseResult } from '../lib/instructions.js' import { WORK_ITEM_STATES, WORK_ITEM_TRANSITIONS, workItemStateLabel, type WorkItemState } from '../lib/workItems.js' import { PAT_EXPIRY_CHOICES } from '../lib/tokens.js' -import { ATTRIBUTION_FIELDS, parseAttributionGroundJson, parseAttributionJson } from '../lib/attribution.js' +import { ATTRIBUTION_FIELDS, attributionGroundFor } from '../lib/attribution.js' import type { AttributionGround, AttributionGroundState, AttributionKey } from '../lib/attribution.js' -import { reconstructAttributionGround } from '../lib/teamStats.js' import { followUpLinks, summariseDeliveries, type DeliveryOutcomeRow } from '../lib/deliveryOutcome.js' import { parseEvidenceJson } from '../lib/evidence.js' import { planPacketHash } from '../lib/planDecision.js' @@ -527,19 +526,22 @@ function jobTeamStats(job: JobRow): Array<{ role: string; label: string; calls: } // #368: what the job claimed and what the instance observed are two facts, and the -// page must not print the first as the second. A stored ground record answers per -// attribution key; a row written before that column exists is reconstructed by the -// one rule in `reconstructAttributionGround`, which the dataset export also reads. +// page must not print the first as the second. The reconstruction of a row that +// predates the ground column lives in `attributionGroundFor` (#1190), shared with +// the change-story row and the console so the three cannot answer differently; +// the stored record still wins, which is the rule the dataset export reads too. const GROUND_STATE_ORDER: Record = { grounded: 0, unobserved: 1, 'no-observation': 2 } -function attributionGroundFor(job: JobRow): AttributionGround | null { - const stored = parseAttributionGroundJson(job.attribution_ground_json) - if (stored !== null) return stored - return reconstructAttributionGround(parseAttributionJson(job.attribution_json), job.team_stats_json !== null) +function groundOf(job: JobRow): AttributionGround | null { + return attributionGroundFor({ + groundJson: job.attribution_ground_json, + attributionJson: job.attribution_json, + teamStatsJson: job.team_stats_json, + }) } -function jobAttribution(t: Translate, job: JobRow): string { - const ground = attributionGroundFor(job) +export function jobAttribution(t: Translate, job: JobRow): string { + const ground = groundOf(job) if (ground === null) return '' const byRole = new Map() const add = (role: string, key: AttributionKey, state: AttributionGroundState): void => { @@ -4219,6 +4221,8 @@ export function jobPage(input: { capped: t('读不到:改动文件超过读取上限', 'not available: the file list exceeded the read cap'), duplicate: t('标题重复,显示最后一处', 'a repeated heading; the last one is shown'), files: (count) => t(`${count} 个文件`, `${count} files`), + claimedNotObserved: t('声称,未观察', 'claimed, not observed'), + claimedNotVerified: t('声称,未核实', 'claimed, not verified'), }).map((fact) => `
${escapeHtml(changeStoryLabel(t, fact.key))}${escapeHtml(fact.value)}${fact.note === '' ? '' : `${escapeHtml(fact.note)}`}
`).join('')} ` diff --git a/test/pages.test.ts b/test/pages.test.ts index a1a4ba24..cb3f2e6b 100644 --- a/test/pages.test.ts +++ b/test/pages.test.ts @@ -265,6 +265,65 @@ test('the anonymous landing page follows the saved language', async () => { } }) +// #1190: the change-story row printed the claimed seat as a fact while the +// team line directly above it marked the same claim as unobserved. The row keeps +// `model · role` and puts #1186's marker word in its note, so the page answers +// the same question the same way twice. +test('#1190: the change-story row marks a claimed role the record did not observe', async () => { + const config = testConfig() + const store = new Store(':memory:') + const built = await buildApp({ config, store, mailer: new MemoryMailer(), runner: new MockRunner(), startScheduler: false }) + try { + const user = makeUser(store, { login: 'ground-row-user', status: 'approved' }) + const repo = store.createRepo({ id: 'repo_ground_row', userId: user.id, owner: 'o', name: 'r', defaultBranch: 'main', tokenEnc: 'x', permission: 'admin', repoRole: 'maintainer', goal: '', autoIterate: false, intervalMinutes: 1440 }) + const { cookie } = sessionFor(built, user) + // One job per record: the page caches a change story per job for a minute, so + // a state change has to be a second row rather than a second read. + const seed = (id: string, ground: unknown, stats: unknown): string => { + const job = store.createJob({ id, repoId: repo.id, userId: user.id, trigger: 'manual', goal: '', callbackHash: 'cb', platformTokenHash: '', kind: 'iterate', baseBranch: 'main' }) + store.updateJob(job.id, { + status: 'succeeded', + pr_url: `https://github.com/o/r/pull/${id.replace(/\D/g, '')}`, + attribution_json: JSON.stringify({ writtenBy: 'Dev-1', claimedBy: 'Lead' }), + attribution_ground_json: JSON.stringify({ steps: ground }), + team_stats_json: stats === null ? null : JSON.stringify(stats), + }) + return job.id + } + const unobserved = seed('job_ground_unobserved', [ + { key: 'writtenBy', claimed: 'Dev-1', observed: 'Dev-2', state: 'unobserved' }, + { key: 'claimedBy', claimed: 'Lead', observed: 'Lead', state: 'grounded' }, + ], [{ role: 'dev2', calls: 2 }]) + // The marker also appears on the page's team line (#1186), so the assertions + // read the change-story block itself rather than the whole document. + const storyOf = (body: string): string => { + const start = body.indexOf('data-change-story') + assert.notEqual(start, -1, 'the job page renders the change-story block') + return body.slice(start, body.indexOf('', start)) + } + const zh = await built.app.inject({ method: 'GET', url: `/repos/${repo.id}/jobs/${unobserved}`, headers: { cookie } }) + assert.equal(zh.statusCode, 200) + assert.match(storyOf(zh.body), /Dev-1/, 'the row still shows the claimed seat; only the note changes') + assert.match(storyOf(zh.body), /声称,未观察/, 'the claim the instance did not see is marked, in the row note') + const en = await built.app.inject({ method: 'GET', url: `/repos/${repo.id}/jobs/${unobserved}`, headers: { cookie: `${cookie}; fledge_lang=en` } }) + assert.match(storyOf(en.body), /claimed, not observed/) + + // Nothing observed the job at all: the same row says "not verified". + const unverified = seed('job_ground_unverified', [{ key: 'writtenBy', claimed: 'Dev-1', observed: null, state: 'no-observation' }], null) + const unverifiedPage = await built.app.inject({ method: 'GET', url: `/repos/${repo.id}/jobs/${unverified}`, headers: { cookie } }) + assert.match(storyOf(unverifiedPage.body), /声称,未核实/) + + // A grounded claim carries no note; the marker is the record's, never assumed. + const grounded = seed('job_ground_grounded', [{ key: 'writtenBy', claimed: 'Dev-1', observed: 'Dev-1', state: 'grounded' }], [{ role: 'dev1', calls: 2 }]) + const groundedPage = await built.app.inject({ method: 'GET', url: `/repos/${repo.id}/jobs/${grounded}`, headers: { cookie } }) + assert.match(storyOf(groundedPage.body), /Dev-1/) + assert.doesNotMatch(storyOf(groundedPage.body), /声称,未观察/) + assert.doesNotMatch(storyOf(groundedPage.body), /声称,未核实/) + } finally { + await built.close() + } +}) + test('job detail shows evidence and can retry a failed job', async () => { const config = testConfig() const store = new Store(':memory:') diff --git a/test/team.test.ts b/test/team.test.ts index 6ff395a3..a2e1934e 100644 --- a/test/team.test.ts +++ b/test/team.test.ts @@ -249,6 +249,15 @@ test('team events stream pushes a live snapshot', async () => { bridge_token_enc: encryptSecret('bridge-token', config.tokenEncryptionKey), bridge_pid: null, log_pid: null, last_error: null, created_at: new Date().toISOString(), updated_at: new Date().toISOString(), last_health_at: null, }) + // #1190: the console's rows are seeded with a claim the record did not see, + // so both transports have to agree about the marker. + const job = store.createJob({ id: 'job_stream_ground', repoId: repo.id, userId: user.id, trigger: 'manual', goal: '', callbackHash: 'cb', platformTokenHash: '', kind: 'iterate', baseBranch: 'main' }) + store.updateJob(job.id, { + status: 'succeeded', + attribution_json: JSON.stringify({ writtenBy: 'Dev-1', claimedBy: 'Lead' }), + attribution_ground_json: JSON.stringify({ steps: [{ key: 'writtenBy', claimed: 'Dev-1', observed: 'Dev-2', state: 'unobserved' }] }), + team_stats_json: JSON.stringify([{ role: 'dev2', calls: 2 }]), + }) await built.app.listen({ port: 0, host: '127.0.0.1' }) const address = built.app.server.address() const port = typeof address === 'object' && address !== null ? address.port : 0 @@ -269,9 +278,20 @@ test('team events stream pushes a live snapshot', async () => { await reader.cancel().catch(() => {}) assert.match(text, /event: snapshot/) const line = text.split('\n').find((entry) => entry.startsWith('data: ')) - const snapshot = JSON.parse(line!.slice(6)) as { bots: Array<{ role: string; activity: string; calls: number }> } + const snapshot = JSON.parse(line!.slice(6)) as { bots: Array<{ role: string; activity: string; calls: number }>; jobs: Array<{ id: string; attributionText?: string; attribution?: unknown }> } assert.equal(snapshot.bots.find((bot) => bot.role === 'lead')?.activity, 'working') assert.equal(snapshot.bots.find((bot) => bot.role === 'lead')?.calls, 7) + // #1190: the stream carries the server-rendered string, marker included, so + // the first one-second tick cannot replace a marked claim with the bare seat. + assert.equal(snapshot.jobs.find((entry) => entry.id === job.id)?.attributionText, 'Dev-1 编写 · 声称,未观察 · Dev-2 编写', 'the claim is marked and the seat the instance did see is printed beside it') + assert.equal(typeof snapshot.jobs.find((entry) => entry.id === job.id)?.attribution, 'object', 'the structured field keeps its type') + + // The 5-second fallback must carry the same field: a fix to one transport is + // exactly how the console's answer used to change when the stream dropped. + const poll = await built.app.inject({ method: 'GET', url: `/api/repos/${repo.id}/team`, headers: { cookie } }) + assert.equal(poll.statusCode, 200) + const polled = poll.json() as { jobs: Array<{ id: string; attributionText?: string }> } + assert.equal(polled.jobs.find((entry) => entry.id === job.id)?.attributionText, 'Dev-1 编写 · 声称,未观察 · Dev-2 编写') } finally { await built.close() await bridge.close()