feat(ci): open a docs follow-up when loft-sh/plans changes affect sidebar labels#2340
feat(ci): open a docs follow-up when loft-sh/plans changes affect sidebar labels#2340Piotr1215 wants to merge 2 commits into
Conversation
…ebar labels The Feature Table already syncs plan tiers automatically, but the left-nav Enterprise/Free sidebar labels (sidebar_class_name: pro|free) and the ProAdmonition partial are maintained by hand. When loft-sh/plans moves a feature between Free and Enterprise, nothing prompts a review of those labels, so the docs silently drift. DOC-1513 (custom resources wrongly marked Enterprise) is the exact failure this leaves uncaught. Add a weekly workflow (plus workflow_dispatch and a repository_dispatch hook for loft-sh/plans) that detects plans activity, cross-checks each feature tier in products.yaml against the label on its docs page, and opens or updates a single review issue carrying the suspected mismatches and the full label inventory. An issue rather than an auto-PR because the plan-tier to page-label mapping needs human judgement (multi-feature pages, anchored docs_urls, editorial ProAdmonition placement); mechanical drift keeps its auto-PR path (check-eos-eol-labels). Logic lives in a unit-tested Node script so the workflow stays a single invocation. Closes DOC-1523
✅ Deploy Preview for vcluster-docs-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
djwfyi
left a comment
There was a problem hiding this comment.
A few suggested fixes:
scripts/check-plans-sidebar-labels.js -- silent failure in fetchPlansCommits
If the gh api call throws (e.g. token lacks read access to loft-sh/plans), commits = [] and on a non-forced run the script outputs drift=false -- indistinguishable from a genuine no-activity week. Track the failure separately:
let commits = [];
let fetchFailed = false;
try {
commits = fetchPlansCommits({ sinceDays: opts.sinceDays });
} catch (e) {
console.error(`Could not read ${PLANS_REPO} commits: ${e.message}`);
fetchFailed = true;
}
Then append plans_fetch_failed=true to GITHUB_OUTPUT so a failed fetch is visible to the caller and doesn't look like a clean no-op.
.github/workflows/check-plans-sidebar-labels.yml -- npm install → npm ci
npm ci is the right call in CI: faster, uses exact lock-file versions, and fails loudly if package-lock.json is out of sync.
scripts/check-plans-sidebar-labels.js -- PRODUCTS_PATH naming
PRODUCTS_YAML and PRODUCTS_PATH serve different purposes (absolute read path vs. prose display string) but are easy to conflate. PRODUCTS_DISPLAY_PATH would make the intent clear.
When the gh api read of loft-sh/plans throws (for example the token loses read access to the private repo), the sidebar-labels check swallowed the error and reported drift=false with zero commits, indistinguishable from a genuine quiet week. A broken token would then silently stop the review from ever firing. Track the failure separately and emit plans_fetch_failed=true so the caller can tell a failed fetch from real inactivity. Also from PR review: use npm ci in the workflow (exact lockfile versions, fails loudly on lockfile skew) and rename PRODUCTS_PATH to PRODUCTS_DISPLAY_PATH to distinguish the prose display string from the absolute read path PRODUCTS_YAML.
|
Thanks for the review. All three addressed in 5a21b47. 1. Silent failure in
|
Content Description
Adds a weekly CI workflow that opens (or updates) a docs follow-up issue whenever
loft-sh/planschanges, prompting a review of the left-nav Enterprise/Free sidebar labels and theProAdmonitionpartial.Summary
The Feature Table already syncs plan tiers into
src/data/products.yamlautomatically, but the sidebar labels (sidebar_class_name: pro|free, rendered as ENTERPRISE/FREE badges bysrc/css/sidebar.scss) and theProAdmonitionpartial are maintained by hand. Whenloft-sh/plansmoves a feature between Free and Enterprise, nothing prompts a review of those surfaces, so the docs drift. DOC-1513 (custom resources wrongly marked Enterprise) is the exact failure this leaves uncaught.This opens a review issue rather than an auto-PR. Unlike the mechanical EOS/EOL date drift (which keeps its auto-PR path in
check-eos-eol-labels), the plan-tier to page-label mapping needs human judgement: a page can document several features, adocs_urlcan point at a section anchor, and aProAdmonitionis placed editorially. The issue carries a best-effort suspect list plus the full label inventory, so the reviewer gets a concrete starting point instead of an empty checklist.Key Changes
scripts/check-plans-sidebar-labels.js: detects recentloft-sh/planscommits, cross-checks each feature tier inproducts.yamlagainst the label on its docs page (flags a Free feature whose page still carriespro/ProAdmonition, and an Enterprise-only feature whose page carriesfree), builds the full label inventory, and opens or updates a single deduped tracking issue..github/workflows/check-plans-sidebar-labels.yml: weekly schedule +workflow_dispatch+repository_dispatch(plans-updated, soloft-sh/planscan trigger on push). Single script invocation, pinned action SHAs,persist-credentials: false.tests/check-plans-sidebar-labels.test.js: 24 unit tests (Node built-in runner, no new dependencies) covering frontmatter parsing, the cross-check in both directions, the inventory, commit parsing, issue-body rendering, and the open-or-update logic with an injectedghexec.package.json: acheck-plans-sidebar-labelsscript for local dry-runs.Validated locally against real repo data: the cross-check surfaces a genuine suspect (
external-database-kerberosis Free in plans but its page carriessidebar_class_name: pro+ aProAdmonition).Preview Link
No documentation pages changed (CI tooling, script, and tests only), so there is no deploy preview for this PR.
Dependencies
None. Reuses the existing
GH_ACCESS_TOKENsecret, the same token the Feature Table sync uses to read the privateloft-sh/plansrepo.TODO
repository_dispatchsender inloft-sh/plansto trigger the review on push. The workflow already runs weekly without it.Internal Reference
Closes DOC-1523
References DOC-1513
AI review: mention
@claudein a comment to request a review or changes. See CONTRIBUTING.md for available commands.@netlify /docs