Repository navigation
ci: fail on components that are not built in, imported or defined - #2435
Open
benibauer3 wants to merge 1 commit into
Open
benibauer3 wants to merge 1 commit into
benibauer3 wants to merge 1 commit into
Conversation
mintlify validate fails on MDX syntax errors but passes a tag for a component that does not exist (<Notte>, <CardGrup>), which Mintlify then cannot render. Add scripts/check_components.py, run it in docs-validation, and cover it with tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
Author
|
@palango, could you review and approve this one? It adds a CI check for components that do not exist ( Two things I need from you, since this PR comes from a fork and my token cannot approve:
It applies cleanly on top of #2432 and #2421 (checked with |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hole, and the fix
mintlify validatefails on MDX syntax errors (an unclosed<Note>, a stray{) but passes a page that uses a component that does not exist, such as<Notte>or<CardGrup>.mintlify broken-links --check-redirectspasses it too. Mintlify has nothing to render for the tag, and nothing in CI notices. PR previews do not build for this repo (#2430), so no one sees it before merge either.This adds
scripts/check_components.py(standard library only, same shape ascheck_redirects.py) and runs it indocs-validation.yml. A component in a page must be a Mintlify built-in, imported by that page, or defined by that page. Tags in fenced code blocks, inline code and comments are ignored, and lowercase tags (HTML) are not checked.The built-in list is Mintlify's own:
allowedComponentsplus the components named incomponentIds.js, from@mintlify/common1.0.1164, which is whatmintlify@4.2.920(the CI pin) ships. The file carries the command to rebuild the list whenMINTLIFY_VERSIONis bumped. The trade-off: an allowlist can fail CI on a real component that Mintlify adds later, and the failure message says where to add it. The alternative, a deny-by-nothing check, would not catch anything.Also in the diff: one line in
AGENTS.md§1 (commands) and one in §6 (components), and an entry inscripts/README.md.What this does NOT do / residual risk
mint dev.Judgement calls
.md/.mdxexceptnode_modules,submodules,scriptsand hidden directories.snippets/*.mdxare included, because they render inside pages. Reversible: one constant,SKIPPED_DIRECTORIES.<Color.Row>,<NS.Thing>) are checked on the first part only, so<Color.Anything>passes. Lenient on purpose, to avoid a false red on a real nested component.Issues
Refs #2430. It does not close it: previews are still missing. This covers the one failure class
validatemisses, so reviewers needmint devless often.Stacking / conflicts
Branched off
main, independent. Touchesdocs-validation.yml,AGENTS.mdandscripts/README.md. I applied the diffs of the other open PRs that touch those files (#2432 and #2421) on top of this branch withgit apply --check: both apply cleanly.Verification evidence
All on this head (
cced26b), Node 24,mintlify@4.2.920.Green on the real docs: 235 files scanned, 638 component tags examined.
Red on a misspelled page. I appended
<Notte>and<CardGrup>blocks tobuild/agents/8004.mdx(then reverted). The existing Mintlify steps stay green; the new one fails:Mutations of the script, each run against the new tests:
export const/functionnode_modules/submodules/scriptsNotefrom built-insNot run here: the GitHub Actions run itself. This PR is from a fork, so the workflow may need approval before it runs.
Remaining ops steps
Checklist
mainmain()and the directory scan, not only the pure functionssnippets/and the root.mdfiles wanted? Say so and I will narrowSKIPPED_DIRECTORIES.🤖 Generated with Claude Code