(page)
| 416 | } |
| 417 | |
| 418 | async function k14(page) { |
| 419 | const mark = await galaxyWithJsonb(page); |
| 420 | await explanationDone(page); |
| 421 | const [request] = (await sentSince(page, mark)).filter((entry) => entry.profile === 'automatic-explanation'); |
| 422 | const text = promptText(request); |
| 423 | await page.locator('.cbm-chat-explanation .cbm-chat-response-source > summary').click(); |
| 424 | await wait(400); |
| 425 | const disclosure = await page.locator('.cbm-chat-explanation .cbm-chat-source-content').innerText().catch(() => ''); |
| 426 | await shot(page, 'K14', 'explanation-source', 'The JSONBAgg explanation with its Source disclosure open: the class source (lines 50-54) is there and "Source unavailable" is gone.'); |
| 427 | const card = await explanationText(page); |
| 428 | await save('K14', 'prompt-jsonbagg.txt', text); |
| 429 | // Automatic explanations off: a listed answer reads the source itself, and "Ask the model" sends it (review finding). |
| 430 | await open(page, PROJECT, 'galaxy'); |
| 431 | await galaxyReady(page); |
| 432 | await loadModel(page); |
| 433 | await setAutomatic(page, false); |
| 434 | await openChat(page); |
| 435 | await select(page, 'JSONBAgg'); |
| 436 | await scopeSettled(page); |
| 437 | const offMark = await markWorker(page); |
| 438 | await ask(page, 'Who calls JSONBAgg?'); |
| 439 | const automaticRuns = (await sentSince(page, offMark)).length; |
| 440 | const turn = page.locator('.cbm-chat-turn').last(); |
| 441 | await turn.locator('.cbm-chat-response-source > summary').click(); |
| 442 | await wait(500); |
| 443 | const listedSource = await turn.locator('.cbm-chat-source-content').innerText().catch(() => ''); |
| 444 | await shot(page, 'K14', 'listed-source-automatic-off', 'Automatic explanations off: the listed answer "Who calls JSONBAgg?" shows the class source in its Source disclosure, no "Source unavailable".'); |
| 445 | const askMark = await markWorker(page); |
| 446 | await turn.getByRole('button', { name: 'Ask the model' }).click(); |
| 447 | await page.waitForFunction(() => !document.querySelector('.cbm-chat-send[aria-label="Stop"]') && !/Thinking…/.test(document.querySelector('.cbm-chat-turn:last-of-type')?.textContent ?? ''), null, { timeout: 240000 }).catch(() => {}); |
| 448 | await wait(800); |
| 449 | const [asked] = await sentSince(page, askMark); |
| 450 | const askedText = promptText(asked); |
| 451 | const answer = await page.locator('.cbm-chat-turn').last().innerText().catch(() => ''); |
| 452 | await shot(page, 'K14', 'ask-model-with-source', 'After "Ask the model" on the listed answer: the model answered from a prompt that carries the class source.'); |
| 453 | await setAutomatic(page, true); |
| 454 | await save('K14', 'prompt-ask-model.txt', askedText); |
| 455 | check('K14', 'Galaxy explanation and a listed answer with automatic explanations off carry the selected symbol source; no "Source unavailable"', /class JSONBAgg\(OrderableAggMixin, Aggregate\)/.test(text) && /function = "JSONB_AGG"/.test(text) |
| 456 | && !/Source unavailable/.test(text + disclosure) && /class JSONBAgg\(OrderableAggMixin, Aggregate\)/.test(disclosure) |
| 457 | && automaticRuns === 0 && /class JSONBAgg\(OrderableAggMixin, Aggregate\)/.test(listedSource) && !/Source unavailable/.test(listedSource) |
| 458 | && /function = "JSONB_AGG"/.test(askedText) && !/Source unavailable/.test(askedText), |
| 459 | { sourceInPrompt: /class JSONBAgg/.test(text), sourceUnavailable: /Source unavailable/.test(text + disclosure), card, |
| 460 | automaticOff: { modelMessagesForListedAnswer: automaticRuns, listedSourceStart: listedSource.slice(0, 260), askPromptHasSource: /function = "JSONB_AGG"/.test(askedText), |
| 461 | askPromptSourceUnavailable: /Source unavailable/.test(askedText), answer: answer.replace(/\s+/g, ' ').slice(0, 260) } }); |
| 462 | } |
| 463 | |
| 464 | async function setTrace(page, direction, onlyType) { |
| 465 | await page.locator('select[aria-label="Trace direction"]').selectOption(direction); |
nothing calls this directly
no test coverage detected