Clean up test seed Block objects with null anchor_ids #123
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
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-api#123
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
todo-test-seed-anchor-ids— QA nit from PR #120 (Epilogue item 9a)Repo
forgejo_admin/pal-e-docsUser Story
As a developer reading tests
I want test seed data to match production invariants
So that tests don't mask bugs by using invalid data shapes
Context
PR #120 established the invariant that all blocks must have non-null anchor_ids. But test seed helpers in
tests/test_blocks_api.pyandtests/test_compiled_page_api.pystill create Block objects withanchor_id=None. This works because SQLite treats NULLs as distinct for unique constraints, but is inconsistent with the application-level guarantee.File Targets
Files the agent should modify:
tests/test_blocks_api.py— update seed helpers to provide anchor_idstests/test_compiled_page_api.py— update seed helpers to provide anchor_idsFiles the agent should NOT touch:
src/— no production code changes neededAcceptance Criteria
{block_type}-{position}pattern for non-heading blocksrg "anchor_id=None" tests/returns zero results for Block creationTest Expectations
pytest tests/ -vpytest tests/ -vConstraints
Checklist
Related
todo-test-seed-anchor-ids— tracking TODOPR #125 Review
BLOCKERS
None.
NITS
None.
SOP COMPLIANCE
123-test-seed-anchor-idsreferences issue #123)todo-test-seed-anchor-ids) -- standalone cleanup, no plan slug neededtests/)VERIFICATION
All 5
anchor_id=Nonereplacements follow the{block_type}-{position}convention correctly:_seed_note_with_blocks()paragraph-1_seed_note_with_blocks()paragraph-3_seed_hierarchical_note()paragraph-2_seed_note_with_compiled_page()paragraph-1_seed_note_with_compiled_page()paragraph-3Post-change grep confirms:
rg "anchor_id=None" tests/returns zero results for Block creation.VERDICT: APPROVED