Skip to content

docs: Docs/api pipeline improvements#611

Merged
planetf1 merged 3 commits intogenerative-computing:mainfrom
planetf1:docs/api-pipeline-improvements
Mar 13, 2026
Merged

docs: Docs/api pipeline improvements#611
planetf1 merged 3 commits intogenerative-computing:mainfrom
planetf1:docs/api-pipeline-improvements

Conversation

@planetf1
Copy link
Contributor

@planetf1 planetf1 commented Mar 10, 2026

API docs pipeline improvements

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Improves the tooling/docs-autogen/ pipeline (build.py, generate-ast.py, decorate_api_mdx.py, audit_coverage.py):

  • Fix 4 Mintlify parse errors — bare >>> doctest blocks in module docstrings were parsed as nested blockquotes by MDX; wrapped in fenced code blocks via wrap_doctest_blocks(). Unescaped {/} in prose (e.g. inline Python/JSON examples) caused acorn parse errors; now escaped outside code fences.
  • Fix GitHub source linksfix_source_links() now handles the HTML <a href="..."> format that mdxify actually emits. The old regex only matched Markdown [View source](...) format and never fired, leaving all links on blob/main/ instead of the versioned tag.
  • Richer landing pagegenerate_landing_page() now emits a prose bullet list with bold linked module names and descriptions, replacing the previous plain bullet list. Descriptions are extracted from the decorated MDX body (the full module preamble text) rather than the short frontmatter one-liner.
  • --source-dir supportbuild.py and audit_coverage.py now accept --source-dir to generate or audit docs for a different checkout without touching that repo. The docs.json navigation is updated in the source repo (bug fix: previously always wrote to mellea-d).
  • Docstring quality auditaudit_coverage.py --quality detects 8 categories of incomplete docstrings (missing, short, no Args/Returns/Raises sections, param name mismatches). Scoped to documented public symbols only — 322/322 documented (100% coverage).
  • Navigation orphan auditaudit_coverage.py --orphans finds MDX files that exist on disk but are absent from the docs.json navigation tree.
  • CI/pre-commit support--fail-on-quality flag exits 1 when quality issues are found, making the audit usable as a hard gate. When run in GitHub Actions (GITHUB_ACTIONS=true), each issue is also emitted as a ::error:: annotation so problems surface inline on the PR diff. Groundwork for ci: gate doc quality in CI and pre-commit to prevent future degradation #616.
  • *args/**kwargs forwarder exemption — functions that forward via *args/**kwargs (e.g. mify) are correctly exempt from no_args and param_mismatch checks. The tool uses Griffe's ParameterKind rather than a name-prefix heuristic, which was previously a no-op.

Generated API docs removed from the repo

docs/docs/api/ and docs/docs/api-reference.mdx are fully generated artefacts — they are now both added to .gitignore and removed from git tracking in this PR. The previous committed snapshot (28 MDX files) is deleted; going forward these files are generated on demand via uv run poe apidocs or by the docs-autogen-pr.yml CI workflow on each release tag. They should never be hand-edited or re-committed directly.

uv run poe commands for API docs

Command Description
uv run poe apidocs Generate + decorate API docs (version auto-read from pyproject.toml)
uv run poe apidocs-preview Generate fresh docs to /tmp/mellea-preview, then run full quality audit
uv run poe apidocs-quality Audit docstring quality for all documented public symbols including methods — reports missing docstrings, short docstrings, missing Args/Returns/Raises sections, and param name mismatches
uv run poe apidocs-orphans Find MDX files present on disk but missing from docs.json navigation
uv run poe apidocs-validate Validate generated docs: coverage ≥ 80%, MDX syntax, internal links
uv run poe apidocs-test Run docs tooling unit tests
uv run poe apidocs-clean Remove all generated API docs and build artefacts

Cross-repo usage (direct script invocation)

Generate and audit docs for a different checkout without touching that repo:

# Generate docs from mellea-b source, write to /tmp
uv run python tooling/docs-autogen/build.py \
    --source-dir ../mellea-b \
    --output-dir /tmp/mellea-b-preview/api

# Audit quality against the generated output
uv run python tooling/docs-autogen/audit_coverage.py \
    --quality \
    --docs-dir /tmp/mellea-b-preview/api \
    --source-dir ../mellea-b

# Fail if any quality issues found (for CI/pre-commit)
uv run python tooling/docs-autogen/audit_coverage.py \
    --quality --fail-on-quality \
    --docs-dir docs/docs/api

Related issues

Testing

  • Pipeline tested end-to-end against ../mellea-b with the docstring improvements from PR docs: improve docstrings for API reference (#612) #614 — audit reports 0 quality issues after those fixes
  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

@github-actions
Copy link
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@mergify
Copy link

mergify bot commented Mar 10, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

planetf1 added a commit to planetf1/mellea that referenced this pull request Mar 10, 2026
Adds `uv run poe apidocs-quality` as a short alias for the docstring quality
audit (--quality --no-methods against docs/docs/api). Updates README to lead
with the short command. Both issues generative-computing#612 and generative-computing#613 now reference this alias and
include a note that the tooling lands with PR generative-computing#611.
@planetf1 planetf1 marked this pull request as ready for review March 10, 2026 23:06
@planetf1 planetf1 requested review from a team, jakelorocco and nrfulton as code owners March 10, 2026 23:06
@planetf1 planetf1 requested a review from psschwei March 10, 2026 23:06
@planetf1
Copy link
Contributor Author

Note: Currently this removes the old generated files.
I propose if we want to regen the docs and checkin (deployment discussion) we do this in a new PR? (but it could be same if required)

planetf1 added a commit to planetf1/mellea that referenced this pull request Mar 11, 2026
Adds `uv run poe apidocs-quality` as a short alias for the docstring quality
audit (--quality --no-methods against docs/docs/api). Updates README to lead
with the short command. Both issues generative-computing#612 and generative-computing#613 now reference this alias and
include a note that the tooling lands with PR generative-computing#611.
@planetf1 planetf1 force-pushed the docs/api-pipeline-improvements branch from 5d52c89 to 3fcbf36 Compare March 11, 2026 09:04
Copy link
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks mostly good to me; I'm confused on the api doc update mechanism though. We have the api docs in our git ignore, but we are still pushing them to the github repo? I don't understand how that works with the automation.

@planetf1 planetf1 added the documentation Improvements or additions to documentation label Mar 11, 2026
Copy link
Member

@psschwei psschwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summarizing from discussions earlier today, this PR:

  • adds tooling to assist with building the API docs
  • removes the out of date API docs that were currently there
  • updates the action to generate the new API docs and push them to main

I think, based on discussions earlier, that instead of pushing to main the idea is to push to a dedicated docs branch that will be used for mintlify to grab the files from (@planetf1 keep me honest here)

In general, I'm good with that process (I think there's still a few minor things to clean up like some extra files / bob tags, so not officially approving).

planetf1 added a commit to planetf1/mellea that referenced this pull request Mar 12, 2026
- Fix MDX parse errors: wrap bare doctest blocks, escape {/} outside fences
- Fix GitHub source links to use versioned tag format
- Richer landing page with prose bullet list and module descriptions
- Add --source-dir support to build.py and audit_coverage.py
- Add --quality docstring audit (8 issue categories, 322/322 pass)
- Add --orphans nav audit for MDX files absent from docs.json
- Add --fail-on-quality flag for CI/pre-commit hard gate
- Emit GitHub Actions annotations when run in CI (GITHUB_ACTIONS=true)
- Fix *args/**kwargs forwarder exemption using Griffe ParameterKind
- Remove generated API docs from version control; add to .gitignore
- Add poethepoet dev tasks (apidocs, apidocs-quality, apidocs-preview, etc)
- Disable CI workflow pending branch strategy decision (see PR generative-computing#611)
- Remove stray watch_20260210-162335 and redundant requirements.txt

Fixes generative-computing#532
@planetf1 planetf1 force-pushed the docs/api-pipeline-improvements branch from be3161f to a077f87 Compare March 12, 2026 09:04
- Fix MDX parse errors: wrap bare doctest blocks, escape {/} outside fences
- Fix GitHub source links to use versioned tag format
- Richer landing page with prose bullet list and module descriptions
- Add --source-dir support to build.py and audit_coverage.py
- Add --quality docstring audit (8 issue categories, 322/322 pass)
- Add --orphans nav audit for MDX files absent from docs.json
- Add --fail-on-quality flag for CI/pre-commit hard gate
- Emit GitHub Actions annotations when run in CI (GITHUB_ACTIONS=true)
- Fix *args/**kwargs forwarder exemption using Griffe ParameterKind
- Remove generated API docs from version control; add to .gitignore
- Add poethepoet dev tasks (apidocs, apidocs-quality, apidocs-preview, etc)
- Disable CI workflow pending branch strategy decision (see PR generative-computing#611)
- Remove redundant files (requirements.txt, stray diagnostic output)

Fixes generative-computing#532
@planetf1 planetf1 force-pushed the docs/api-pipeline-improvements branch from a077f87 to d8f82d5 Compare March 12, 2026 09:05
@planetf1
Copy link
Contributor Author

  • Removed stray watch_20260210-162335 diagnostic file committed by accident
  • Removed tooling/docs-autogen/requirements.txt (deps now in pyproject.toml)
  • Removed # Made with Bob attribution comment from workflow file
  • Disabled CI auto-trigger on tag push pending branch strategy decision; added TODO comment referencing PR docs: Docs/api pipeline improvements #611
  • Updated cache-dependency-glob in workflow from deleted requirements.txt to uv.lock
  • Squashed 29 commits to 1 and rebased onto upstream/main

Now ready for re-review @HendrikStrobelt @psschwei @jakelorocco

@planetf1 planetf1 enabled auto-merge March 12, 2026 12:24
@jakelorocco
Copy link
Contributor

I think I'm still lost on where / when the docs will be, and how Mintlify will grab them. I don't see a concrete answer in this PR or the linked improvement issue. If that get's sorted out, I think this PR looks good.

@psschwei
Copy link
Member

I think I'm still lost on where / when the docs will be, and how Mintlify will grab them. I don't see a concrete answer in this PR or the linked improvement issue. If that get's sorted out, I think this PR looks good.

I believe the plan was a dedicated docs branch (can you confirm @planetf1 ?)

@planetf1
Copy link
Contributor Author

The intent of this PR is to create tools that can build docs from the source content (our source code) with validation checks to ensure we're creating a good quality API reference.

Yes. Intent is to publish to a dedicated docs branch (or rather two - one for each site). For example we'll write the full docs tree to docs/docs in that target branch. That will include both our 'written' conceptrual docs & the api reference. Mintlify will be pointed there so it publishes docs when they change

When we've merged this, and pr 601 (I'm implementing some of the review comments) I'll do that part which hopefully will become clearer.

Copy link
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our usual pytest commands won't catch these tests. I'm assuming it was intentional to keep them separate (which I'm fine with). We should think about if we need something to ensure they don't break.

@planetf1
Copy link
Contributor Author

Our usual pytest commands won't catch these tests. I'm assuming it was intentional to keep them separate (which I'm fine with). We should think about if we need something to ensure they don't break.

current plan is add to CI and potentially pre-commit.
Initially soft:warnings, but once another pass has been done in #645 we can probably make them hard failures -- this is the reason to add the checks, to keep the doc quality. Additionally i've opened #638 for harder code validation

…tooling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@planetf1
Copy link
Contributor Author

Removed all 7 # Made with Bob attribution comments from tooling/docs-autogen/ files (3 changed in this PR + 4 pre-existing on main): audit_coverage.py, validate.py, test_escape_mdx.py, test_cross_references.py, test_mintlify_anchors.py, test_validate.py, test_anchor_collisions.py.

Copy link
Member

@psschwei psschwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this locally to build the docs and preview against mintlify and everything seemed to work fine (I did not run the tests, just the basic uv run poe apidocs).

I think we're in a good spot to merge this and then iterate if there are small details we need to fix once its in action.

Copy link
Contributor

@jakelorocco jakelorocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; I'm fine if y'all want to iterate further in this PR. But I also think the remaining potential changes are small and can be handled in future PRs as we improve the process.

@planetf1 planetf1 added this pull request to the merge queue Mar 13, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged via the queue into generative-computing:main with commit 3d6755d Mar 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API Reference Documentation

4 participants