fix(pipeline): migrate to nested topic URLs, fix page-path bugs, re-extract from real 2.12 - #6
fix(pipeline): migrate to nested topic URLs, fix page-path bugs, re-extract from real 2.12#6pfeerick wants to merge 5 commits into
Conversation
build's page-path functions (page_name_for_item, group_page_name, module_page_name, review_page_name_for_item) computed paths that never matched how the site is actually laid out on disk -- build appears to have only ever targeted the isolated docs-system/generated/site-preview/ scratch directory, never website/md-docs/ itself, so the code and the live content silently drifted apart. - group_page_name / module_page_name / review_page_name_for_item now match the flat scheme already live (api-reference/<slug>.md, api-reference/module-<name>.md, api-reference/review-<slug>.md). Removed the now-fully-redundant legacy_* variants. - page_name_for_item moves individual item pages to a nested api-reference/<topic-group>/<item>.md scheme, matching both the official EdgeTX/lua-reference-guide's existing convention and this pipeline's own original (never-actually-applied) intent. The nested item slug drops the internal-only "runtime" pseudo-module qualifier for bare functions (it isn't a real Lua namespace, just an extraction-time grouping label) while keeping real namespaces (model., lcd., lvgl., Bitmap.) intact. - page_href (used for the hub pages' raw-HTML <a> card links, which MkDocs does not auto-correct the way it does markdown-syntax links) didn't account for a flat page's own rendered URL being one directory level deeper than its file location under MkDocs' use_directory_urls default. Fixed and hand-verified against every from/to page-kind combination, then confirmed empirically against real built HTML output. - The review dashboard landing page and its internal links moved from a nested review/index.md (never actually reachable, and no longer matching mkdocs.yml's exclude_docs: api-reference/review.md pattern from the earlier public/dev config split) to flat review.md. Also fixes docs-system/api-groups.json group-taxonomy drift found while verifying the rebuild: the "hardware" group's slug didn't match its nav-expected "radio-hardware" name, and one merged "Variables" group still listed all 18 ids even though the live sources.md/ switches.md/variables.md pages had already been hand-split three ways (matching HANDOFF.md's "Sources, Switches, and Variables were separated properly"). Re-split to match the live 3-way split, renamed the hardware group's slug, and wired the "Inputs" (key-inputs) group into mkdocs.yml/mkdocs.dev.yml nav -- it had a real 5-item group defined but no nav entry at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
Previous local extraction was run against a dev branch (cpm-tlm-sim-fix), not an actual release branch, even though this site targets the 2.12 documentation set specifically. Re-ran against EdgeTX/edgetx branch 2.12 (commit 0e3b4115c3, which includes the luadoc annotation-style fix from EdgeTX/edgetx#7769). Diff: screenshot, model.getGlobalVariableDetails, and model.setGlobalVariableDetails now parse correctly (they use the @function style after #7769 landed, previously silently dropped). model.getSwitchWarning and model.setSwitchWarning are correctly absent -- they exist on main but not on real 2.12 firmware; the old baseline would have misrepresented them as 2.12 APIs. Net: 153 items (was 152). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
Regenerates all api-reference pages, hub cards, module dashboards, and review pages via the fixed pipeline (previous commit) against the corrected 2.12 extraction (commit before that): individual item pages move from flat api-reference/<name>.md to nested api-reference/<topic-group>/<item>.md (e.g. api-reference/runtime-flush-audio.md -> api-reference/audio-sound/flush-audio.md); hub pages, module dashboards, and review pages stay flat, matching what was already live. Explicitly removes two pages the pipeline has no way to clean up on its own: model-get-switch-warning.md and model-set-switch-warning.md (and their review-*.md counterparts) documented an API that doesn't exist in real 2.12 firmware at all (see the extraction commit) -- build's stale-page cleanup only knows about paths for items still present in the current model, not items removed entirely. Fixes every inbound link across the site that pointed at an individual function page by its old flat path -- narrative content under api-overview/ and programming/ (6 files, confirmed complete via a clean `mkdocs build --strict` with zero warnings on both the public and dev configs, which would have caught anything missed). Also re-fixes a set of broken markdown-style links inside assets/luals/lcd.d.lua and runtime.d.lua (a mangled GitBook artifact reference, dead appendix/units.html and part_vii_-_appendix/fonts.md references) that a prior pass (PR #2) had already fixed in the generated output -- rebuilding from the still-unfixed raw upstream `/*luadoc*/` comments regenerated the LuaLS files from scratch and silently reintroduced the same broken links. See docs-system/REAL-EXTRACTION-NOTES.md for why this will keep recurring until the upstream firmware comments themselves are fixed. Verified: `mkdocs build --strict` passes with zero warnings on both mkdocs.yml and mkdocs.dev.yml. Confirmed end-to-end against real built HTML output that nested URLs resolve correctly (e.g. site/api-reference/audio-sound/flush-audio/index.html exists and hub card links resolve to it). Confirmed overlay content (docs-system/overlays/*.md) survived the rebuild. Confirmed api-reference/lvgl-*.md (handled by the separate open PR #5) are untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
1. Critical: build_outputs() unconditionally regenerated every group's
hub page from the model, including "display-lvgl" (zero extracted
items, since LVGL firmware has no luadoc annotations at all) --
this silently clobbered the hand-authored display-lvgl.md with the
generic empty-group stub. Fixed build_outputs so a zero-item
group's existing page is never overwritten (or deleted by the
stale-page cleanup pass, which ran before the per-group write loop
and would have unlinked it regardless of any check placed after)
unless that existing content already matches the stub text.
Verified no other hub page was affected: exactly two groups
("constants", "display-lvgl") currently have zero items, and only
display-lvgl.md held real content.
Per updated direction: display-lvgl.md is not restored to its full
hand-ported content, since a separate in-progress firmware PR will
add real /*luadoc*/ annotations for every LVGL function directly to
api_colorlcd_lvgl.cpp, after which this page should be regenerated
from source like every other page rather than hand-maintained.
Replaced with an honest placeholder explaining the LVGL page and
its ~30 function pages are pending that firmware work, rather than
the misleading "no APIs assigned" stub or a soon-to-be-replaced
full copy.
2. Investigated the LuaLS type-annotation regression from re-extracting
against the real 2.12 branch: found 28 items where a param/return
type dropped to "unknown". For 26 of them, the raw upstream
/*luadoc*/ comment text genuinely differs between branches -- real
2.12 firmware lacks an explicit type token (e.g. "(integer)") that
the old cpm-tlm-sim-fix dev-branch snapshot had. That's an accurate
reflection of real 2.12 being less precisely annotated, not a
pipeline bug, and is not something to silently "fix" by reverting
to the wrong-branch data.
The other 2 (lcd.drawText, lcd.drawNumber) initially looked like a
parser regression (identical raw_luadoc between old/new models) but
traced to a real quirk in merge_item(): these symbols are
documented in two source files (api_stdlcd.cpp without an
inversColor parameter, api_colorlcd.cpp with one), and merge_item
keeps whichever raw_luadoc text is longer for display while merging
parameter lists from whichever block has more parameters -- so the
displayed raw_luadoc didn't reflect the block that actually
determines inversColor's type. Checked api_colorlcd.cpp on real
2.12 directly: `@param inversColor (optional with the INVERS flag)
...` has no type token either. Same root cause as the other 26,
just obscured by which merged block happens to get shown. No parser
fix needed.
3. Added a conservative, report-only stale-page sweep (`build
--report-unowned`) rather than an automatic delete: after building,
lists any .md file under --docs-output not accounted for by the
current model (not an index/review/module/group page, not an item
page, not a preserved zero-item group page), for manual review.
Never deletes anything -- some listed files may be legitimate
hand-authored content with no model backing (confirmed: currently
only the 45 known lvgl-*.md pages show up), some may be genuine
orphans from a prior run under a different naming scheme or group
assignment, and telling those apart automatically isn't safe to do
with full confidence yet.
4. Removed the "constants" group from api-groups.json entirely (zero
items, confirmed nothing references its page) -- this PR's rebuild
had regenerated api-reference/constants.md, undoing its deliberate
deletion in #3. Removing the group definition (rather than just
deleting the page again) means a future rebuild can't resurrect it.
Also re-fixes the same recurring assets/luals/*.d.lua broken-link
regression documented in the previous commit -- repeated build runs
while investigating these findings regenerated the LuaLS files from
the still-unfixed raw upstream comments again.
Verified: `mkdocs build --strict` passes with zero warnings on both
mkdocs.yml and mkdocs.dev.yml. Confirmed all 45 lvgl-*.md pages still
exist on disk (just not linked from the temporary display-lvgl.md
placeholder). Confirmed zero uncategorized items after removing the
constants group.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
Update: addressed code review findingsPushed a follow-up commit ( 1. Critical — Per updated direction from the user: rather than restoring the full hand-ported LVGL content, 2. Investigated the ~87 unknown-type regression. Traced 28 affected items: 26 have raw 3. Added a conservative, report-only stale-page sweep ( 4. Removed the "constants" group from Also re-fixed the same recurring Both 🤖 Generated with Claude Code |
The committed api-model.local.json was extracted from 2.12@0e3b4115c3, one commit before EdgeTX/edgetx#7770 (backported as 16713095a1) fixed 28 functions' worth of broken doc-site links directly in the firmware /*luadoc*/ comments. As a result, website/md-docs/assets/luals/lcd.d.lua and runtime.d.lua only had correct links because of a manual patch layered on top of a stale extraction -- confirmed by re-running build from the checked-in model, which silently reverted them back to the broken GitBook-artifact/appendix links. Re-extracted from 2.12@16713095a1 (current tip, includes the firmware fix) and rebuilt. Same 153 items, same review backlog/decision counts; diff is scoped to exactly the 28 previously-patched functions' pages (plus their review-*.md copies) and the two .d.lua files, now getting correct link text straight from source with no manual patch needed. Verified: no change to display-lvgl.md (LVGL placeholder) or api-groups.json (dead constants group removal) -- neither regressed. Both mkdocs build --strict configs still pass clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
|
Follow-up: re-extracted against the corrected The model committed in the previous fix ( Re-extracted from 🤖 Generated with Claude Code |
Summary
The site's current flat URLs (
api-reference/runtime-flush-audio/) leak an internal, non-Lua "runtime" grouping label and don't match either the official EdgeTX/lua-reference-guide's existing convention (lua-api-reference/system/rgb.md) or this pipeline's ownpage_name_for_itemcode, which was clearly written to produce nested topic URLs but never actually matched what's live --buildappears to have only ever targeted the isolateddocs-system/generated/site-preview/scratch directory, neverwebsite/md-docs/itself, so the code and the live content silently drifted apart over time.This PR fixes the pipeline properly and uses it to do a full, safe rebuild, landing three things together since they turned out to be entangled:
1. Page-path bugs fixed in
tools/docs_pipeline.py(see inline commit message for full detail):group_page_name/module_page_name/review_page_name_for_itemnow match the flat scheme already live. Removed the now-redundantlegacy_*variants.page_name_for_itemmoves individual item pages to nestedapi-reference/<topic-group>/<item>.md, dropping the internal-only "runtime" pseudo-module prefix from bare functions (kept for real namespaces:model.,lcd.,lvgl.,Bitmap.).page_href(used for hub-page raw-HTML<a>card links, which MkDocs does not auto-correct the way it does markdown-syntax links) had a real bug: it didn't account for a flat page's own rendered URL being one directory level deeper than its file location under MkDocs'use_directory_urlsdefault. Hand-verified against every from/to page-kind combination, then confirmed empirically against real built HTML.review/index.mdto flatreview.md, which also matters for correctness:mkdocs.yml'sexclude_docs: api-reference/review.mdpattern (from the earlier public/dev config split) wouldn't have matched the nested path, meaning the internal dashboard would have leaked into the public build.docs-system/api-groups.jsonwhile verifying the rebuild: a "hardware" slug that didn't match nav's "radio-hardware", and one merged "Variables" group still listing all 18 ids even though the livesources.md/switches.md/variables.mdpages were already hand-split three ways (matching HANDOFF.md's "Sources, Switches, and Variables were separated properly"). Re-split the config to match, and wired the "Inputs" (key-inputs) group into nav -- it had a real 5-item group defined but no nav entry at all.2. Re-extracted against the real
2.12firmware branch (was extracted from a dev branch,cpm-tlm-sim-fix, even though this site targets 2.12 specifically):screenshot,model.getGlobalVariableDetails,model.setGlobalVariableDetailsnow correctly appear (they use@functionstyle after EdgeTX/edgetx#7769 landed, previously silently dropped by the extractor);model.getSwitchWarning/setSwitchWarningare correctly absent (exist onmain, not real 2.12 firmware -- the old baseline would have misrepresented them as 2.12 APIs). Deleted their now-orphaned pages explicitly, sincebuild's stale-cleanup only knows about paths for items still present in the model, not items removed entirely.3. Full content rebuild + link fixes: regenerated all api-reference pages/hub-cards/module-dashboards/review-pages from the fixed pipeline; fixed every inbound link across the site (6 narrative files under
api-overview//programming/) that pointed at an individual function page by its old flat path; re-fixed a set of broken markdown links insideassets/luals/lcd.d.lua/runtime.d.luathat a prior pass (#2) had already fixed in generated output, but rebuilding from the still-unfixed raw upstream/*luadoc*/comments silently regenerated the same breakage (documented indocs-system/REAL-EXTRACTION-NOTES.mdas a recurring issue until a small upstream firmware PR fixes the actual comments, same pattern as #7769).api-reference/lvgl-*.md(handled by the separate open PR #5) are untouched -- confirmed viagit status.Update: code review fixes
A review pass found two real regressions and two minor issues, all addressed in a follow-up commit:
1. Critical --
display-lvgl.mdwas silently clobbered.build_outputs()unconditionally regenerates every group's hub page from the model, including zero-item groups -- and "display-lvgl" has zero extracted items (LVGL firmware has no luadoc annotations at all), so the rebuild overwrote the hand-authored hub page with the generic empty-group stub. Fixedbuild_outputsso a zero-item group's existing real content is never overwritten or deleted by the stale-page cleanup pass (which ran before the per-group write loop and would unlink it regardless of any check placed after it -- had to move the check earlier). Verified only two groups currently have zero items (constants,display-lvgl); onlydisplay-lvgl.mdheld real content.Per direction from the maintainer: rather than restoring the full hand-ported LVGL content,
display-lvgl.mdis now an honest placeholder instead. A separate in-progress firmware PR is adding real/*luadoc*/annotations for every LVGL function directly toapi_colorlcd_lvgl.cpp; once that lands, this page should be regenerated from source like every other page, not hand-maintained content that would need throwing away almost immediately. The placeholder explains this and that the ~30lvgl-*.mdfunction pages (still present on disk, untouched) aren't linked from here in the meantime.2. Investigated the reported ~87 unknown-type regression in the LuaLS output. Traced 28 affected items: 26 have raw
/*luadoc*/comment text that genuinely differs between the old dev-branch snapshot and real 2.12 -- the real firmware comments lack an explicit type token (e.g.(integer)) that the dev branch had. That's an accurate reflection of real 2.12 being less precisely annotated, not a pipeline bug, and isn't something to silently "fix" by reverting to the wrong-branch data. The other 2 (lcd.drawText,lcd.drawNumber) looked like a parser regression at first (identicalraw_luadocbetween old/new models) but traced to amerge_item()quirk: these symbols are documented in two source files (api_stdlcd.cppandapi_colorlcd.cpp), andmerge_itemdisplays whichever raw text is longer while merging parameters from whichever block has more of them -- so the displayedraw_luadocdidn't reflect the block that actually determines the regressed parameter's type. Checked that block directly on real 2.12: same root cause as the other 26 (no type token in the source), just obscured by which merged block happens to get shown. No parser fix needed either way.3. Added a conservative, report-only stale-page sweep (
build --report-unowned) rather than an automatic delete, given how easily #1 demonstrated the "what does the pipeline own" boundary can be gotten wrong. Lists any.mdfile not accounted for by the current model, for manual review -- never deletes anything. Currently only flags the 45 knownlvgl-*.mdpages, as expected.4. Removed the "constants" group from
api-groups.jsonentirely (confirmed zero items, nothing references its page) so a future rebuild can't resurrect the empty stub that PR #3 deliberately deleted -- this PR's original rebuild had inadvertently undone that.Both
mkdocs build --strict(public + dev configs) still pass clean, zero warnings, after these fixes.Test plan
mkdocs build --strict -f mkdocs.yml-- exit 0, zero warningsmkdocs build --strict -f mkdocs.dev.yml-- exit 0, zero warningssite/api-reference/audio-sound/flush-audio/index.htmlexists, hub card hrefs resolve correctlypage_hrefhand-verified against every from/to page-kind combination (hub<->item, item<->module-dashboard, index<->hub) before trusting the empirical build checkscreenshot)docs-system/overlays/*.md) survived the rebuildlvgl-*.mdpages still exist on disk, untouched (separate PR docs: port real LVGL function docs from the official guide #5)display-lvgl.mdno longer clobbered on rebuild; verified with a fresh restore-then-rebuild cyclebuild --report-unownedsweep verified against live content: only the 45 knownlvgl-*.mdfiles flagged, zero false positives🤖 Generated with Claude Code
https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD