7e-2: Compiled page API endpoint — GET /notes/{slug}/compiled #112
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-api#112
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-02-26-tf-modularize-postgres→ Phase 7 (Block Content) → Phase 7e (Compiled Pages) → Phase 7e-2Repo
forgejo_admin/pal-e-docsUser Story
As a consumer of pal-e-docs (sprint frontend, agent tools),
I want a single API call that returns pre-rendered HTML + TOC + metadata for a note,
So that I don't need multiple calls to assemble a complete page view.
Context
The
compiled_pagestable already exists (Phase 7a) withhtml,toc_json,content_hash, andcompiled_at. The 7c backfill populated 274 compiled pages. The 7e-1 cutover (PR #110) ensures compiled_pages stay in sync on every note write. But there's no API endpoint to serve this data — consumers must useget_note()(no TOC) orget_note_toc()+ multipleget_section()calls.This phase adds the endpoint, then follow-on work adds the SDK method and MCP tool in pal-e-docs-sdk and pal-e-docs-mcp respectively.
File Targets
Files the agent should modify or create:
src/pal_e_docs/routes/blocks.py— addGET /{slug}/compiledendpoint to the existing blocks router. Returns compiled page data from thecompiled_pagestable.src/pal_e_docs/schemas.py— addCompiledPageOutresponse model with fields:html(str),toc_json(list),content_hash(str),block_count(int),compiled_at(datetime),slug(str),title(str).Files the agent should reference (read, don't modify):
src/pal_e_docs/models.py—CompiledPagemodel (hashtml,toc_json,content_hash,compiled_at,note_id)src/pal_e_docs/routes/blocks.py— existing block endpoints for pattern referenceFiles the agent should NOT touch:
src/pal_e_docs/routes/notes.py— note routes are unchangedsrc/pal_e_docs/blocks/sync.py— sync logic is unchangedAcceptance Criteria
GET /notes/{slug}/compiledreturns JSON:{slug, title, html, toc_json, content_hash, block_count, compiled_at}block_countis computed from the blocks table (count of blocks for that note)slugandtitlefor consumer convenienceTest Expectations
pytest tests/ -vConstraints
routes/blocks.pyrouter (prefix/notes, tags["blocks"])_get_note_or_404()helper, Pydantic response modelblock_countfield should be a live count query, not stored — avoids maintaining another fieldChecklist
Related
phase-postgres-7e-compiled-pages— phase note