Repository navigation
Avoid N+1 queries when rendering llms-full.txt - #491
Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The regression test should verify that page body content is rendered, not only the query count.
Review effort: Lite
Findings: None
What changed in this PR
Updates /llms-full.txt to avoid per-page body queries while preserving existing llms.txt behavior.
Changes:
- Loads full page content eagerly.
- Adds regression coverage for query counts and multiple pages.
| File | Summary |
|---|---|
apps/llms_txt/views.py |
Uses eager StreamField loading for full output. |
apps/llms_txt/tests/test_views.py |
Tests query behavior across multiple pages; should also assert rendered body content. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3a15801 to
f2d1166
Compare
|
Thanks this is addressed now |
|
Hi @thibaudcolas, this is ready for review whenever you have time. It handles the "reduce overfetching" part of #481 for |
Reconcile defer_streamfields page loading with skill_name template context added on main, and keep the query-count regression test. Assisted-by: Cursor <cursoragent@cursor.com>
f2d1166 to
153fa86
Compare
Refs #481
Description
/llms-full.txtwas running an extra query for every ContentPage just to load itsbodyThe pages come from
Sitemap.items()which callsdefer_streamfields()That's fine for
llms.txtbutllms-full.txtrenders every page body so each one was fetched on its ownBoth views now get their pages from one shared helper and only
llms.txtdefers StreamFieldsSo
llms-full.txtloads all the bodies in one goWith the fixture data of 24 content pages the request went from 75 queries to 50 and body queries dropped from 24 to 1
The output is exactly the same
I added a regression test that creates four ContentPages and checks that the bodies come from a single query and all show up in the response
It fails on
mainwith 4 body queriesI ran the
llms_txttests plusruff checkandruff format --checklocallyAI usage
None