7e-2: Add GET /notes/{slug}/compiled endpoint #113
No reviewers
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!113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "112-7e-2-compiled-page-api-endpoint-get-note"
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?
Summary
Changes
src/pal_e_docs/schemas.py: AddedCompiledPageOutPydantic model with fields: slug, title, html, toc_json, content_hash, block_count, compiled_atsrc/pal_e_docs/routes/blocks.py: AddedGET /{slug}/compiledendpoint that fetches the compiled page, computes live block_count, and returns all fields. Returns 404 for missing notes or missing compiled page entries.tests/test_compiled_page_api.py: 8 tests covering all acceptance criteria plus end-to-end integrationTest Plan
Review Checklist
Related
plan-2026-02-26-tf-modularize-postgres-- Phase 7e (Compiled Pages) -> 7e-2PR #113 Review
BLOCKERS
None.
NITS
toc_jsontype looseness in schema --CompiledPageOut.toc_jsonis typed aslist[dict] | None. The tests validate a specific structure (anchor_id,text,levelkeys). Consider usinglist[TocEntry] | Noneinstead oflist[dict]to get Pydantic validation on the response shape. This would catch schema drift early. Non-blocking sinceTocEntryalready exists in the same file (schemas.pyline 329).Test helper
_seed_note_with_compiled_pageuses raw DB session -- The helper creates its ownTestingSessionLocal()session outside the test transaction. This works because tests useTestingSessionLocaldirectly, but it means test data persists across tests within the same class if cleanup is not handled by the fixture. The existing test suite follows this pattern so this is consistent, but worth noting for future refactors.test_returns_all_fieldsandtest_slug_and_title_from_noteoverlap -- Both call_seed_note_with_compiled_page()with the same default slug"compiled-test"and assert the same slug/title values. The second test (test_slug_and_title_from_note) is a subset of the first. Minor redundancy.SOP COMPLIANCE
112-7e-2-compiled-page-api-endpoint-get-notereferences issue #112plan-2026-02-26-tf-modularize-postgresis referenced in RelatedCloses forgejo_admin/pal-e-docs #112CODE QUALITY
CompiledPagemodel columns (html,toc_json,content_hash,compiled_at) plus derived fields (slug,titlefrom Note,block_countfrom live COUNT query).block_countviasa_func.countis the right approach -- avoids stale cached counts.test_block_count_updates_after_addspecifically validates the live-query behavior by adding a block and re-fetching.recompile()path creates the compiled page entry.VERDICT: APPROVED