Skip to content

Enforce the docs guards: rendered-site checks, inline blocks run by default, lambda and error-check lint in the suite #724

Closed

Description

@0x054

Parent

#698

What to build

With every page and docstring fixed, the opt-in checks become gates so the rot cannot return:

  • tests/test_docs_site.py fails on literal Sphinx roles, Returns:/Attributes: tables with sentence-fragment rows, dropped Args:/Attributes: sections, Markdown lists merged into paragraphs (a <p> containing a line that starts with - or 1. ), and unresolved cross-references.
  • Every inline Python block runs unless its fence says why it is compile-only.
  • tests._docs_checks runs over docs/pages, docs/examples and src/ferro as a test.
  • The four many-to-many tests skipped with a reason pointing at a page that no longer exists run or are deleted; tests/test_documentation_features.py keeps only what the docs harness does not cover.
  • # noqa comments are kept out of rendered examples by a ruff per-file ignore for docs/examples/*.
  • CI runs the docs tests in the docs job.

Acceptance criteria

  • Each defect class above has a test that fails on a seeded example of it.
  • No inline block is compile-only without a stated reason.
  • python -m tests._docs_checks docs/pages docs/examples src/ferro exits 0 and runs in the suite.
  • No test is skipped with a stale reason.

Files owned

  • Create: tests/test_docs_lint.py
  • Modify: tests/test_docs_examples.py, tests/test_docs_site.py, tests/test_documentation_features.py, tests/_docs_checks.py, .github/workflows/ci.yml, pyproject.toml, docs/pages/** (fence markers only), docs/examples/** (noqa comments only)

Interfaces

  • Consumes: everything the earlier tickets produce
  • Produces: nothing other tickets rely on

Test scenarios

  • Error path: seeding :class: into a docstring fails the site test.
  • Error path: seeding lambda t: t.id into a page fails tests/test_docs_lint.py.
  • Error path: a list without a blank line before it fails the site test.
  • Happy path: the whole docs suite passes in CI.

Verify

uv run --no-sync zensical build --clean --strict
uv run --no-sync pytest tests/test_docs_site.py -q --no-cov -p no:cacheprovider
uv run --no-sync pytest tests/test_docs_examples.py -q --no-cov -p no:cacheprovider -n 8
uv run --no-sync pytest tests/test_docstring_examples.py -q --no-cov -p no:cacheprovider
uv run --no-sync pytest tests/test_docs_migrations.py -q --no-cov -p no:cacheprovider -n 8
uv run --no-sync pytest tests/test_docs_lint.py tests/test_documentation_features.py -q --no-cov -p no:cacheprovider
uv run --no-sync python -m tests._docs_checks docs/pages docs/examples src/ferro

Blocked by

Audit findings

Rows from the docs audit this ticket covers (file, line, rule, fix)

Cross-cutting patterns

  1. I-8 one-letter lambda parameters in four embedded examples: 66 lambdas (aggregations 24, partial_selects 16, populated_relations 15, existence_tests 11), plus 6 in their twins' bodies and 57 lines in inline page blocks. predicates.py, traversal.py, relationships.py and quickstart.py show the correct form. Fix the four files and add a lint test (an AST check of docs/examples/*.py and inline blocks: a lambda passed to where/select/order_by/include/exists takes a parameter of at least two characters, ideally snake_case(Model)).
  2. Error checks that cannot fail: 12 try/except blocks assert only inside except, with no else (aggregations ×5, populated_relations ×3, partial_selects ×1, mutations ×3). The "loud limits" the pages advertise are untested. table_checks.py:38 shows the fix.
  3. Results hidden below the section marker in about 50 sections across 9 files. The reader sees a query, never its answer (rule 8). Only three snippets print anything, and no page shows printed output from an example.
  4. Placeholder data (rule 10) in 5 files: "a1"/"b1"/"o1"/"ledger-a"/"Pair left/right", with tied totals that make a top-N example nondeterministic. relationships.py, predicates.py and migrations_backfill.py show the real-looking alternative.
  5. No equivalent SQL beside any example (rule 13). Comments describe the SQL ("renders NOT EXISTS", "COUNT(column)") in 6 files, and the query pages show 5 SQL blocks for 101 Python blocks.
  6. 184 inline page blocks are compile-only (rule 9). The {test=run}/{lint=check} opt-ins exist and are used 0 times. Five pages hold 83 of them (models-and-fields 24, migrate-from-sqlalchemy 18, upgrade-guide 17, row-level-security 13, connections 11). tests/test_documentation_features.py tests hand copies, not the docs, and 4 of its tests are skipped with a stale reason.
  7. Running-example models the page never shows (rule 3) in 4 files: Customer (mutations), Account (transactions), Event (raw_sql), Metric (multiple_databases). The models sit outside any section, so the I-7 twin is also skipped.
  8. Two Annotated idioms across twins: Field(default=None, …) inside Annotated in 11 pairs, against FerroField(…)] = None in 7 pairs. Plus 18 # noqa: E711/E712 comments rendered on pages, avoidable with a ruff per-file ignore for docs/examples/*.

Activity

  1. added
    documentationImprovements or additions to documentation
    ready-for-agentUnblocked and fully specified; an agent may claim it
    size:MNeeds a plan; one or two local workers
    on Oct 19, 2026
  2. 5 remaining items

  3. self-assigned this
    on Oct 19, 2026
  4. 0x054 commented on Oct 19, 2026

    @0x054
    ContributorAuthor

    Status: verify-passed
    Worker: worker-724
    Branch: sdd/724-enforce-guards
    PR: #750
    Verify: passed ccc1616

    Review by reviewer-724: Spec PASS, Quality PASS, with no Critical or Important findings. The four seeded defects each failed their test (:class:, a merged list, lambda t: t.id, {compile-only=}). The full suite passed: 3514 passed, 338 skipped, 2 xfailed. Trial merge not run (base unchanged).
    Many-to-many clear() and reverse-side reads are tested on both backends: tests/test_auto_migrate.py:173,182,339,348 (backend_matrix). The PR body's claim that no such Postgres test exists is wrong (Minor).

  5. 0x054 commented on Oct 19, 2026

    @0x054
    ContributorAuthor

    Merged in #750 into feat/docs-rewrite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationready-for-agentUnblocked and fully specified; an agent may claim itsize:MNeeds a plan; one or two local workers

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions