Repository navigation
fix(authors): exclude unpublished/deleted tutorials from author pages, rail & byline - #1761
Merged
Merged
Conversation
#1732 author pages, the 'more from author' rail, and byline eligibility were surfacing tutorials that are unpublished (status=INACTIVE / soft-deleted in HANA) or deleted from the source repo (stale .tutorial-cache entries). Root cause: the author-index builder grouped the RAW GitHub discovery set (authorRows, pushed for every parsed tutorial in fetch-tutorials.ts) and never intersected it with the active/published catalog set that the main navigator/ browse already use (tutorialMetas = status='ACTIVE' or null, per srv/lib/build-catalog.js). Fix at the single source (buildAuthorIndex → author_index.json, which drives page + rail + byline): - buildAuthorIndex(rows, advocates, activeSlugs?): skip rows whose slug.toLowerCase() is not in the active set. Fail-open when the set is empty/undefined (degraded/ALLOW_EMPTY_CAP builds). Lowercase compare — row slugs are mixed-case source dirs, catalog slugs are lowercase-canonical. - writeAuthorPages: thread activeSlugs through (all-inactive authors then drop out of the index and their stale .md page is pruned). - fetch-tutorials.ts: pass new Set(tutorialMetas.map(m => m.slug.toLowerCase())). - tests: exclusion, case-insensitive match, all-inactive author dropped, fail-open (undefined/empty). All 15 author-index unit tests pass. Takes effect on the next content rebuild / fetch-tutorials run.
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
The #1732 author feature — author detail pages (
/authors/<login>/), the "more from author" rail on tutorial pages, and byline linking — surfaces tutorials that are unpublished (status='INACTIVE'/ soft-deleted in HANA) or deleted from the source repo. Reported on live PROD (e.g. an author page listing tutorials that are no longer published).Root cause
The author-index builder groups the raw GitHub discovery set and never intersects it with the active/published catalog:
scripts/fetch-tutorials.tspushes anauthorRowsentry for every parsed tutorial (~:1050-1060), with no publication/deletion filter.scripts/parsers/author-index.tsbuildAuthorIndexonly groups by login + dedupes — no status predicate.Tutorials.status), surfaced by the CAP catalog astutorialMetas(srv/lib/build-catalog.js:24-26→status = 'ACTIVE' or status is null). The navigator/browse already filter on it; the author builder never did..tutorial-cache/*.mdfor repo-deleted slugs (still processed in--regenerate), and (b)status='INACTIVE'soft-deletes.authors/single.html,more-from-author.html) renderauthor_index.jsonverbatim — so the fix belongs at the builder (one predicate fixes page + rail + byline consistently).Fix
buildAuthorIndex(rows, advocates, activeSlugs?)— skip rows whoseslug.toLowerCase()∉activeSlugs. Fail-open when the set is empty/undefined (degraded /ALLOW_EMPTY_CAPbuilds → no filtering, matching the existing browse-skip guard). Lowercase compare (row slugs = mixed-case source dirs; catalog slugs = lowercase-canonical).writeAuthorPagesthreadsactiveSlugsthrough; an author whose tutorials are all inactive drops out of the index and their stale.mdpage is pruned.fetch-tutorials.tspassesnew Set(tutorialMetas.map(m => m.slug.toLowerCase()))(already in scope at the call site).Verification
test/unit/author-index/build-author-index.test.ts): exclusion, case-insensitive match, all-inactive author dropped, fail-open (undefined/empty).npx vitest run --project unit test/unit/author-index/→ 15 passed.fetch-tutorialsrun (regeneratesauthor_index.json). No deploy performed.