Skip to content

Commit d284546

Browse files
kckernclaude
andcommitted
perf(web): meta resolves references without loading text
meta.scripture.guide lists reference blocks only, but the lookup still read verse text, chapter rows, headings, the chapter heading and nav for every block. On bom that put meta at 1.38x live's p50 (50 vs 36 ms), outside the cutover gate's 1.25x. Return right after the reference resolves when the format is meta. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 66df52a commit d284546

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎apps/web/src/services/ScriptureLookupService.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export class ScriptureLookupService {
145145
reference = new Reference({ query: referenceString, normalized: '', verseIds: [] });
146146
}
147147

148-
if (reference.isEmpty) {
148+
// meta lists reference blocks only (MetaPresenter): no text, headings or navigation to load
149+
if (reference.isEmpty || config.outputFormat === 'meta') {
149150
return new ScriptureResult({ reference, verses: [], headings: [], config });
150151
}
151152

‎apps/web/test/unit/scriptureLookup.test.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,15 @@ describe('lookup: a range across a book end', async () => {
341341
expect(d.verses.map(v => v.book ?? d.book)).toEqual(['Malachi', 'Malachi', 'Matthew', 'Matthew']);
342342
});
343343
});
344+
345+
describe('lookup for meta', async () => {
346+
// meta lists reference blocks only (MetaPresenter): no verse text, headings or navigation
347+
const { Reference } = await import('../../src/domain/entities/Reference.js');
348+
const refs = { parse: () => new Reference({ query: 'john.3.16', normalized: 'John 3:16', verseIds: [26137], _book: 'John' }) };
349+
const untouched = new Proxy({}, { get: (_, name) => () => { throw new Error(`repository read: ${String(name)}`); } });
350+
test('resolves the reference without reading verses or headings', async () => {
351+
const r = await new ScriptureLookupService(refs, untouched, untouched).lookup('john.3.16', { outputFormat: 'meta' });
352+
expect(r.reference.verseIds).toEqual([26137]);
353+
expect(r.reference.book).toBe('John');
354+
});
355+
});

0 commit comments

Comments
 (0)