Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ui): don't treat every journal-quality 503 as a missing reference database (#7718)

HPH Protoncae510cf7352
diff --git a/changelog.d/7686.bugfix.md b/changelog.d/7686.bugfix.md
new file mode 100644
index 0000000000..f1377635d4
--- /dev/null
+++ b/changelog.d/7686.bugfix.md
@@ -0,0 +1 @@
+The Journal Quality page no longer treats a temporary database outage as a missing reference database. A retryable HTTP 503 shows the server's message (and Retry-After, when the server sends one) instead of the first-install download prompt, and a failed download no longer displays "Error: undefined".
diff --git a/src/local_deep_research/web/templates/pages/journal_quality.html b/src/local_deep_research/web/templates/pages/journal_quality.html
index 6ca0babe2e..95ea7a5b91 100644
--- a/src/local_deep_research/web/templates/pages/journal_quality.html
+++ b/src/local_deep_research/web/templates/pages/journal_quality.html
@@ -732,9 +732,51 @@ function renderSourcesBanner(sources) {
}).join('');
}
+function _journalPayloadText(payload) {
+ if (!payload || typeof payload !== 'object') return '';
+ for (const value of [payload.message, payload.error, payload.detail]) {
+ if (typeof value === 'string' && value.trim()) return value.trim();
+ }
+ return '';
+}
+
+function _appendRetryAfter(text, resp) {
+ const raw = String(resp.headers.get('Retry-After') ?? '').trim();
+ if (!raw) return text;
+ const hint = /^\d+$/.test(raw)
+ ? `${raw} ${raw === '1' ? 'second' : 'seconds'}`
+ : raw;
+ return `${text} Retry after ${hint}.`;
+}
+
+function _journal503Text(payload, resp) {
+ const JOURNAL_DATA_TEMPORARILY_UNAVAILABLE =
+ 'Journal data is temporarily unavailable. Please try again in a moment.';
+ return `${_appendRetryAfter(
+ _journalPayloadText(payload) || JOURNAL_DATA_TEMPORARILY_UNAVAILABLE,
+ resp,
+ )} Reload the page to retry.`;
+}
+
async function checkDataStatus(generation = _ldrProgressGeneration) {
try {
const resp = await fetch('/metrics/api/journal-data/status');
+ // A rekey 503 has no `available` flag. Do not treat it as "not installed".
+ if (resp.status === 503) {
+ const payload = await resp.json().catch(() => null);
+ if (
+ generation !== _ldrProgressGeneration ||
+ _ldrProgressTimer !== null
+ ) return true;
+ const banner = document.getElementById('ldr-data-banner');
+ const text = document.getElementById('ldr-data-banner-text');
+ const btn = document.getElementById('ldr-data-download-btn');
+ banner.style.display = 'block';
+ text.textContent = _journal503Text(payload, resp);
+ btn.disabled = true;
+ btn.textContent = 'Temporarily unavailable';
+ return false;
+ }
const status = await resp.json();
if (
generation !== _ldrProgressGeneration ||
@@ -929,7 +971,9 @@ async function downloadJournalData() {
if (completedGeneration === _ldrProgressGeneration) location.reload();
}, 1500);
} else {
- progressText.textContent = 'Error: ' + result.message;
+ let errorText = _journalPayloadText(result) || 'Download failed';
+ if (resp.status === 503) errorText = _appendRetryAfter(errorText, resp);
+ progressText.textContent = 'Error: ' + errorText;
btn.disabled = false;
btn.textContent = 'Retry Download';
}
@@ -1082,6 +1126,12 @@ function buildApiUrl(page, includeSummary) {
let summaryLoaded = false;
let journalPageRequestId = 0;
+function _isMissingReferenceDb(payload) {
+ if (typeof payload?.message !== 'string') return false;
+ const message = payload.message.toLowerCase();
+ return message.includes('reference database') && message.includes('not available');
+}
+
async function loadJournalPage(page, includeSummary) {
const error = document.getElementById('ldr-error');
const requestId = ++journalPageRequestId;
@@ -1090,13 +1140,19 @@ async function loadJournalPage(page, includeSummary) {
try {
const resp = await fetch(url);
if (requestId !== journalPageRequestId) return;
- // 503 with "reference database not available" is the expected
- // first-install state, not an error — the data-banner above
- // carries the install CTA. Suppress the red error box so the
- // user's eye goes to the CTA instead of a scary message.
+ // Only a message that the reference database is not available is
+ // first-install. The data banner carries that CTA. Any other 503
+ // stays visible. A detail-only envelope is a retryable outage.
if (resp.status === 503) {
- error.style.display = 'none';
+ const payload = await resp.json().catch(() => null);
+ if (requestId !== journalPageRequestId) return;
document.getElementById('ldr-loading')?.style.setProperty('display', 'none');
+ if (_isMissingReferenceDb(payload)) {
+ error.style.display = 'none';
+ return;
+ }
+ error.textContent = _journal503Text(payload, resp);
+ error.style.display = 'block';
return;
}
const result = await resp.json();
diff --git a/tests/js/pages/journal-quality-download-runtime.test.js b/tests/js/pages/journal-quality-download-runtime.test.js
index 02dc19ec2e..112c4f9bdb 100644
--- a/tests/js/pages/journal-quality-download-runtime.test.js
+++ b/tests/js/pages/journal-quality-download-runtime.test.js
@@ -12,6 +12,12 @@ const TEMPLATE_PATH = resolve(
'../../../src/local_deep_research/web/templates/pages/journal_quality.html',
);
+const JOURNAL_PAYLOAD_HELPERS = [
+ '_journalPayloadText',
+ '_appendRetryAfter',
+ '_journal503Text',
+];
+
function extractFunction(source, name) {
const signature = new RegExp(`(?:async\\s+)?function\\s+${name}\\s*\\(`);
const match = signature.exec(source);
@@ -29,6 +35,13 @@ function extractFunction(source, name) {
throw new Error(`Function ${name} has an unterminated body`);
}
+function journalPayloadHelperSource(template) {
+ return JOURNAL_PAYLOAD_HELPERS
+ .filter(name => template.includes(`function ${name}(`))
+ .map(name => extractFunction(template, name))
+ .join('\n');
+}
+
function extractAsyncListener(source, target, eventName) {
const signature = `${target}.addEventListener('${eventName}', async () => {`;
const start = source.indexOf(signature);
@@ -62,7 +75,10 @@ function deferred() {
function loadDownloadHandler({ renderProgress, pollDownloadProgress }) {
const template = readFileSync(TEMPLATE_PATH, 'utf8');
- const source = extractFunction(template, 'downloadJournalData');
+ const source = [
+ journalPayloadHelperSource(template),
+ extractFunction(template, 'downloadJournalData'),
+ ].filter(Boolean).join('\n');
// Repository-owned production source only; no user-controlled input.
return new Function( // eslint-disable-line no-new-func
'_renderProgress',
@@ -82,6 +98,7 @@ function loadDownloadRuntime(renderProgress) {
const template = readFileSync(TEMPLATE_PATH, 'utf8');
const pollSource = extractFunction(template, '_pollDownloadProgress');
const downloadSource = extractFunction(template, 'downloadJournalData');
+ const helperSource = journalPayloadHelperSource(template);
// Repository-owned production source only; no user-controlled input.
return new Function( // eslint-disable-line no-new-func
'_renderProgress', `
@@ -89,6 +106,7 @@ function loadDownloadRuntime(renderProgress) {
let _ldrProgressGeneration = 0;
let _ldrProgressRequestId = 0;
let _ldrLatestAppliedProgressRequestId = 0;
+ ${helperSource}
${pollSource}
${downloadSource}
return {
@@ -102,12 +120,13 @@ function loadDownloadRuntime(renderProgress) {
function loadPageOwnershipRuntime({ renderProgress, renderSourcesBanner }) {
const template = readFileSync(TEMPLATE_PATH, 'utf8');
const productionSource = [
+ journalPayloadHelperSource(template),
extractFunction(template, 'checkDataStatus'),
extractFunction(template, '_pollDownloadProgress'),
extractFunction(template, 'downloadJournalData'),
extractAsyncListener(template, 'document', 'DOMContentLoaded'),
extractAsyncListener(template, 'window', 'load'),
- ].join('\n');
+ ].filter(Boolean).join('\n');
let domReadyHandler;
let windowLoadHandler;
const pageDocument = {
@@ -241,6 +260,101 @@ it('restores the action and uses the real progress element on API rejection', as
expect(button.textContent).toBe('Retry Download');
});
+const DATABASE_UNAVAILABLE_DETAIL = 'Your database is temporarily unavailable. Please try again in a moment.';
+
+function downloadResponse(body, { status = 503, retryAfter = null } = {}) {
+ const headers = { 'Content-Type': 'application/json' };
+ if (retryAfter != null) headers['Retry-After'] = String(retryAfter);
+ return new Response(JSON.stringify(body), { status, headers });
+}
+
+it('renders a 503 detail envelope without the word undefined', async () => {
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(downloadResponse(
+ { detail: DATABASE_UNAVAILABLE_DETAIL },
+ { retryAfter: '5' },
+ )));
+ const downloadJournalData = loadDownloadHandler({
+ renderProgress: vi.fn(),
+ pollDownloadProgress: vi.fn(),
+ });
+
+ await downloadJournalData();
+
+ const progress = document.getElementById('ldr-data-progress-intro');
+ expect.soft(progress.textContent).toBe(
+ `Error: ${DATABASE_UNAVAILABLE_DETAIL} Retry after 5 seconds.`,
+ );
+ expect.soft(progress.textContent).not.toContain('undefined');
+ expect.soft(progress.innerHTML).not.toContain('<');
+ const button = document.getElementById('ldr-data-download-btn');
+ expect(button.disabled).toBe(false);
+ expect(button.textContent).toBe('Retry Download');
+});
+
+it.each([
+ {
+ envelope: 'error string',
+ body: { error: 'Reference rebuild is busy' },
+ expectedText: 'Error: Reference rebuild is busy',
+ },
+ {
+ envelope: 'empty message falling through to detail',
+ body: { message: '', detail: DATABASE_UNAVAILABLE_DETAIL },
+ expectedText: `Error: ${DATABASE_UNAVAILABLE_DETAIL}`,
+ },
+ {
+ envelope: 'message preferred over detail',
+ body: {
+ message: 'OpenAlex download failed',
+ detail: DATABASE_UNAVAILABLE_DETAIL,
+ },
+ expectedText: 'Error: OpenAlex download failed',
+ },
+ {
+ envelope: 'non-string detail',
+ body: { detail: [{ msg: 'nope' }] },
+ expectedText: 'Error: Download failed',
+ },
+ {
+ envelope: 'HTTP-date Retry-After',
+ body: { detail: DATABASE_UNAVAILABLE_DETAIL },
+ retryAfter: 'Wed, 21 Oct 2026 07:28:00 GMT',
+ expectedText: `Error: ${DATABASE_UNAVAILABLE_DETAIL} Retry after Wed, 21 Oct 2026 07:28:00 GMT.`,
+ },
+ {
+ envelope: 'one-second Retry-After',
+ body: { detail: DATABASE_UNAVAILABLE_DETAIL },
+ retryAfter: '1',
+ expectedText: `Error: ${DATABASE_UNAVAILABLE_DETAIL} Retry after 1 second.`,
+ },
+ {
+ envelope: 'markup detail',
+ body: { detail: '<b>retry</b>' },
+ expectedText: 'Error: <b>retry</b>',
+ },
+])('does not render undefined for a 503 $envelope envelope', async ({
+ body,
+ retryAfter = null,
+ expectedText,
+}) => {
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(
+ downloadResponse(body, { retryAfter }),
+ ));
+ const downloadJournalData = loadDownloadHandler({
+ renderProgress: vi.fn(),
+ pollDownloadProgress: vi.fn(),
+ });
+
+ await downloadJournalData();
+
+ const progress = document.getElementById('ldr-data-progress-intro');
+ expect.soft(progress.textContent).not.toContain('undefined');
+ expect.soft(progress.textContent).toBe(expectedText);
+ if (body.detail === '<b>retry</b>') {
+ expect(progress.innerHTML).not.toContain('<b>');
+ }
+});
+
it.each([
{
terminalState: 'completion',
diff --git a/tests/js/pages/journal-quality-runtime.test.js b/tests/js/pages/journal-quality-runtime.test.js
index 9e4d8cc865..d98f089f61 100644
--- a/tests/js/pages/journal-quality-runtime.test.js
+++ b/tests/js/pages/journal-quality-runtime.test.js
@@ -1,5 +1,6 @@
/** Runtime FastAPI contracts for journal_quality.html. */
+import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { compileTemplateHarness } from '../helpers/template-harness.js';
@@ -8,6 +9,33 @@ const TEMPLATE_PATH = resolve(
'../../../src/local_deep_research/web/templates/pages/journal_quality.html',
);
+const JOURNAL_REFERENCE_DB_UNAVAILABLE = 'Journal reference database not available.';
+const DATABASE_UNAVAILABLE_DETAIL = 'Your database is temporarily unavailable. Please try again in a moment.';
+
+const JOURNAL_PAYLOAD_HELPERS = [
+ '_journalPayloadText',
+ '_appendRetryAfter',
+ '_journal503Text',
+ '_isMissingReferenceDb',
+];
+const RETRY_RELOAD = ' Reload the page to retry.';
+
+function withJournalPayloadHelpers(functionNames) {
+ const source = readFileSync(TEMPLATE_PATH, 'utf8');
+ const present = JOURNAL_PAYLOAD_HELPERS.filter(name =>
+ source.includes(`function ${name}(`),
+ );
+ return [...present, ...functionNames];
+}
+
+function journalListResponse(body, { status = 503, retryAfter } = {}) {
+ const headers = {};
+ if (retryAfter != null) headers['Retry-After'] = String(retryAfter);
+ if (body === undefined) return new Response(null, { status, headers });
+ headers['Content-Type'] = 'application/json';
+ return new Response(JSON.stringify(body), { status, headers });
+}
+
function deferred() {
let resolvePromise;
let rejectPromise;
@@ -44,7 +72,10 @@ function renderJournalFixture() {
function compileJournalPageRuntime(dependencies) {
return compileTemplateHarness({
templatePath: TEMPLATE_PATH,
- functionNames: ['buildApiUrl', 'loadJournalPage'],
+ functionNames: withJournalPayloadHelpers([
+ 'buildApiUrl',
+ 'loadJournalPage',
+ ]),
dependencies,
preamble: `
const PAGE_SIZE = 50;
@@ -262,7 +293,7 @@ it('renders journal-data update status from the migrated status endpoint', async
const renderSourcesBanner = vi.fn();
const harness = compileTemplateHarness({
templatePath: TEMPLATE_PATH,
- functionNames: ['checkDataStatus'],
+ functionNames: withJournalPayloadHelpers(['checkDataStatus']),
dependencies: { renderSourcesBanner },
preamble: `
let _ldrProgressGeneration = 0;
@@ -283,6 +314,47 @@ it('renders journal-data update status from the migrated status endpoint', async
.toBe('Update Data');
});
+it('does not show the first-install download CTA for a generic 503 status', async () => {
+ document.body.innerHTML = `
+ <div id="ldr-data-banner" style="display: none"></div>
+ <span id="ldr-data-banner-text"></span>
+ <button id="ldr-data-download-btn"></button>
+ <div id="ldr-sources-grid"></div>
+ `;
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(journalListResponse(
+ { detail: DATABASE_UNAVAILABLE_DETAIL },
+ { retryAfter: '5' },
+ )));
+ const renderSourcesBanner = vi.fn();
+ const harness = compileTemplateHarness({
+ templatePath: TEMPLATE_PATH,
+ functionNames: withJournalPayloadHelpers(['checkDataStatus']),
+ dependencies: { renderSourcesBanner },
+ preamble: `
+ let _ldrProgressGeneration = 0;
+ let _ldrProgressTimer = null;
+ `,
+ returnExpression: '({ checkDataStatus })',
+ });
+
+ const available = await harness.checkDataStatus();
+
+ const bannerText = document.getElementById('ldr-data-banner-text').textContent;
+ const button = document.getElementById('ldr-data-download-btn');
+ expect.soft(available).toBe(false);
+ expect.soft(document.getElementById('ldr-data-banner').style.display)
+ .toBe('block');
+ expect.soft(bannerText).toBe(
+ `${DATABASE_UNAVAILABLE_DETAIL} Retry after 5 seconds.${RETRY_RELOAD}`,
+ );
+ expect.soft(bannerText).not.toContain('not installed');
+ expect.soft(bannerText).not.toContain('undefined');
+ expect.soft(button.textContent).toBe('Temporarily unavailable');
+ expect.soft(button.textContent).not.toBe('Download Data');
+ expect.soft(button.disabled).toBe(true);
+ expect.soft(renderSourcesBanner).not.toHaveBeenCalled();
+});
+
it('polls running journal downloads with an explicit JSON response contract', async () => {
const snapshot = {
state: 'running',
@@ -440,39 +512,156 @@ it('builds the journal list URL from the active filters and summary flag', () =>
});
});
-it('treats a 503 journal list as the expected first-install state', async () => {
+function loadJournalListPage(response) {
renderJournalFixture();
- vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ status: 503 }));
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(response));
const renderTable = vi.fn();
- const harness = compileTemplateHarness({
- templatePath: TEMPLATE_PATH,
- functionNames: ['buildApiUrl', 'loadJournalPage'],
- dependencies: {
- renderTable,
- renderPagination: vi.fn(),
- updateQualityDistChart: vi.fn(),
- updateScoreSourceChart: vi.fn(),
- },
- preamble: `
- const PAGE_SIZE = 50;
- let sortField = 'quality';
- let sortDir = 'desc';
- let currentPage = 1;
- let totalPages = 1;
- let totalCount = 0;
- let summaryLoaded = false;
- let journalPageRequestId = 0;
- `,
- returnExpression: '({ loadJournalPage })',
+ const harness = compileJournalPageRuntime({
+ renderTable,
+ renderPagination: vi.fn(),
+ updateQualityDistChart: vi.fn(),
+ updateScoreSourceChart: vi.fn(),
});
+ return harness.loadJournalPage(1, true).then(() => renderTable);
+}
- await harness.loadJournalPage(1, true);
+it('treats a 503 journal list as the expected first-install state', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse({
+ status: 'error',
+ message: JOURNAL_REFERENCE_DB_UNAVAILABLE,
+ }));
+ const error = document.getElementById('ldr-error');
- expect(document.getElementById('ldr-error').style.display).toBe('none');
+ expect(error.style.display).toBe('none');
+ expect(error.textContent).toBe('');
+ expect(document.getElementById('ldr-loading').style.display).toBe('none');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('hides the list error when a reworded message says the reference database is not available', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse({
+ status: 'error',
+ message: 'The journal reference database is not available yet',
+ }));
+ const error = document.getElementById('ldr-error');
+
+ expect(error.style.display).toBe('none');
+ expect(error.textContent).toBe('');
+ expect(document.getElementById('ldr-loading').style.display).toBe('none');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('hides the list error when that message uses a different case', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse({
+ status: 'error',
+ message: 'JOURNAL REFERENCE DATABASE NOT AVAILABLE.',
+ }));
+ const error = document.getElementById('ldr-error');
+
+ expect(error.style.display).toBe('none');
+ expect(error.textContent).toBe('');
expect(document.getElementById('ldr-loading').style.display).toBe('none');
expect(renderTable).not.toHaveBeenCalled();
});
+it('shows a retryable banner when only detail says the reference database is not available', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse({
+ detail: 'Journal reference database not available.',
+ }));
+ const error = document.getElementById('ldr-error');
+
+ expect(error.style.display).toBe('block');
+ expect(error.textContent).toContain('Journal reference database not available.');
+ expect(error.textContent).toContain('Reload the page to retry.');
+ expect(error.textContent).not.toContain('undefined');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('shows a retryable banner when the message does not say the reference database is missing', async () => {
+ const message = 'The reference database finished downloading.';
+ const renderTable = await loadJournalListPage(journalListResponse({
+ status: 'error',
+ message,
+ }));
+ const error = document.getElementById('ldr-error');
+
+ expect(error.style.display).toBe('block');
+ expect(error.textContent).toBe(`${message}${RETRY_RELOAD}`);
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('shows a retryable banner for a generic 503 instead of the first-install state', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse(
+ { detail: DATABASE_UNAVAILABLE_DETAIL },
+ { retryAfter: '5' },
+ ));
+ const error = document.getElementById('ldr-error');
+
+ expect.soft(error.style.display).toBe('block');
+ expect.soft(error.textContent).toBe(
+ `${DATABASE_UNAVAILABLE_DETAIL} Retry after 5 seconds.${RETRY_RELOAD}`,
+ );
+ expect.soft(error.textContent).not.toContain('undefined');
+ expect.soft(error.textContent).not.toContain(JOURNAL_REFERENCE_DB_UNAVAILABLE);
+ expect.soft(error.textContent).not.toContain('not installed');
+ expect.soft(document.getElementById('ldr-loading').style.display).toBe('none');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('does not treat a bodyless 503 as the first-install state', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse());
+ const error = document.getElementById('ldr-error');
+
+ expect.soft(error.style.display).toBe('block');
+ expect.soft(error.textContent).toBe(
+ `Journal data is temporarily unavailable. Please try again in a moment.${RETRY_RELOAD}`,
+ );
+ expect.soft(error.textContent).not.toContain('undefined');
+ expect.soft(error.textContent).not.toContain(JOURNAL_REFERENCE_DB_UNAVAILABLE);
+ expect.soft(document.getElementById('ldr-loading').style.display).toBe('none');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('shows a non-sentinel 503 message instead of the first-install state', async () => {
+ const renderTable = await loadJournalListPage(journalListResponse({
+ status: 'error',
+ message: 'Service temporarily overloaded.',
+ }));
+ const error = document.getElementById('ldr-error');
+
+ expect.soft(error.style.display).toBe('block');
+ expect.soft(error.textContent).toBe(
+ `Service temporarily overloaded.${RETRY_RELOAD}`,
+ );
+ expect.soft(error.textContent).not.toContain('undefined');
+ expect.soft(error.textContent).not.toContain(JOURNAL_REFERENCE_DB_UNAVAILABLE);
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('renders a generic 503 detail as text rather than HTML', async () => {
+ const detail = '<img src=x onerror=alert(1)>';
+ const renderTable = await loadJournalListPage(journalListResponse({ detail }));
+ const error = document.getElementById('ldr-error');
+
+ expect.soft(error.style.display).toBe('block');
+ expect.soft(error.textContent).toContain(detail);
+ expect.soft(error.innerHTML).not.toContain('<img');
+ expect.soft(error.textContent).not.toContain('undefined');
+ expect(renderTable).not.toHaveBeenCalled();
+});
+
+it('keeps the journal-list missing-database wording aligned with the metrics route', () => {
+ const metrics = readFileSync(resolve(
+ __dirname,
+ '../../../src/local_deep_research/web/routers/metrics.py',
+ ), 'utf8');
+ const messages = [...metrics.matchAll(/"message":\s*"([^"]*)"/g)]
+ .map(match => match[1].toLowerCase());
+ expect(messages.some(message =>
+ message.includes('reference database') && message.includes('not available'),
+ )).toBe(true);
+});
+
it('renders journal rows, pagination, and summary from the success envelope', async () => {
renderJournalFixture();
const journals = [{ id: 'issn-1', name: 'Journal A' }];
@@ -499,7 +688,10 @@ it('renders journal rows, pagination, and summary from the success envelope', as
const updateScoreSourceChart = vi.fn();
const harness = compileTemplateHarness({
templatePath: TEMPLATE_PATH,
- functionNames: ['buildApiUrl', 'loadJournalPage'],
+ functionNames: withJournalPayloadHelpers([
+ 'buildApiUrl',
+ 'loadJournalPage',
+ ]),
dependencies: {
renderTable,
renderPagination,
diff --git a/tests/theme_tests/test_accent_ink_contrast.py b/tests/theme_tests/test_accent_ink_contrast.py
index 6b762131ec..7dbd76b0a8 100644
--- a/tests/theme_tests/test_accent_ink_contrast.py
+++ b/tests/theme_tests/test_accent_ink_contrast.py
@@ -1016,20 +1016,20 @@ DYNAMIC_INLINE_STYLES = {
("var(--text-on-success)", "var(--text-on-error)"),
"pill",
),
- # journal_quality.html L772 ``function _stateColor(state)``: four
+ # journal_quality.html L814 ``function _stateColor(state)``: four
# ``return`` literals (success, error, running, pending). L821-825
# sets ``width`` to 0, 100, a number ``row.percent`` or 5.
- ("templates/pages/journal_quality.html", 828, "color"): (
+ ("templates/pages/journal_quality.html", 870, "color"): (
"_stateColor(row.state)",
_STATE_COLORS,
None,
),
- ("templates/pages/journal_quality.html", 831, "background"): (
+ ("templates/pages/journal_quality.html", 873, "background"): (
"_stateColor(row.state)",
_STATE_COLORS,
None,
),
- ("templates/pages/journal_quality.html", 831, "width"): (
+ ("templates/pages/journal_quality.html", 873, "width"): (
"width",
(NUMBER,),
None,
@@ -1345,7 +1345,7 @@ def test_inline_style_scan_finds_the_known_expressions():
sheets, _, found = _inline_scan()
assert {
("templates/pages/journal_quality.html", 723, "background"),
- ("templates/pages/journal_quality.html", 831, "background"),
+ ("templates/pages/journal_quality.html", 873, "background"),
("static/js/components/context-overflow.js", 585, "background"),
("static/js/components/details.js", 712, "color"),
("templates/pages/metrics.html", 989, "color"),
@@ -1358,7 +1358,7 @@ def test_inline_style_scan_finds_the_known_expressions():
}
assert {
("templates/pages/journal_quality.html", "style@L723"),
- ("templates/pages/journal_quality.html", "style@L831"),
+ ("templates/pages/journal_quality.html", "style@L873"),
("static/js/components/context-overflow.js", "style@L585"),
} <= expanded, sorted(expanded)
@@ -1403,7 +1403,7 @@ NON_TEXT_ACCENT_FILLS = {
("static/js/collection_upload.js", "style@L588"): _BAR,
("static/js/collection_upload.js", "style@L658"): _BAR,
# _stateColor(): success, error, accent or the track colour.
- ("templates/pages/journal_quality.html", "style@L831"): _BAR,
+ ("templates/pages/journal_quality.html", "style@L873"): _BAR,
("collection_details.css", ".ldr-stat-card::before"): _STRIPE,
("collection_details.css", ".ldr-document-item::before"): _STRIPE,
("news-enhanced.css", ".ldr-news-item::before"): _STRIPE,
@@ -1662,7 +1662,7 @@ NON_TEXT_STATUS_FILLS = {
("templates/auth/register.html", ".ldr-strength-strong"): _STRENGTH,
# The utilColor and _stateColor() bars; their figures sit beside them.
("static/js/components/context-overflow.js", "style@L585"): _BAR,
- ("templates/pages/journal_quality.html", "style@L831"): _BAR,
+ ("templates/pages/journal_quality.html", "style@L873"): _BAR,
}
# Pre-existing gaps on status fills: (sheet, selector) -> (worst palette,