fix: exclude non-let definitions from docs Functions index#6024
Open
prql-bot wants to merge 1 commit into
Open
fix: exclude non-let definitions from docs Functions index#6024prql-bot wants to merge 1 commit into
prql-bot wants to merge 1 commit into
Conversation
The `prqlc experimental doc` Functions index listed every `VarDef`, but the detail sections were only emitted for `VarDefKind::Let`. A `main` pipeline (or any `into` def) therefore produced an index entry linking to an anchor (`#fn-main` / `#main`) that no detail section ever generated — a dangling link. Consolidate the "is a documented function" predicate into a single helper used by both the index and detail loops so they can no longer drift, and add a regression test exercising a top-level pipeline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
prqlc experimental docbuilds a "Functions" index that links to per-function detail sections. The index listed everyVarDef, but the detail sections were only emitted forVarDefKind::Let. A top-level pipeline becomes amainvar-def (andintoproduces another non-letkind), so those appeared in the index linking to an anchor that no detail section ever generated — a dangling link.Reproduction (before this change):
The HTML output had the same issue with
#fn-main.Fix
The index loop and the detail loop each decided independently what counts as a documented function, and they had drifted. This consolidates that decision into a single
is_documented_functionhelper used by both loops in both the HTML and Markdown generators, so the index can never list an entry the detail loop skips. The redundantstmts.clone().into_iter()passes for these loops are replaced withstmts.iter().Test
Added
generate_docs_excludes_main_pipeline, which runsexperimental docon input containing a top-level pipeline and asserts themainentry no longer appears in the Functions index. Without the fix the index regains the dangling* [main](#main)line and the test fails.Found during the nightly code-quality survey.