Skip to content

fix(authors): exclude unpublished/deleted tutorials from author pages, rail & byline - #1761

Merged
jung-thomas merged 1 commit into
DEVfrom
fix/author-index-exclude-unpublished
Aug 14, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
fix/author-index-exclude-unpublished

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

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.ts pushes an authorRows entry for every parsed tutorial (~:1050-1060), with no publication/deletion filter.
  • scripts/parsers/author-index.ts buildAuthorIndex only groups by login + dedupes — no status predicate.
  • The published/active signal lives in HANA (Tutorials.status), surfaced by the CAP catalog as tutorialMetas (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.
  • "Deleted" manifests two ways, both fixed by the same intersection: (a) stale .tutorial-cache/*.md for repo-deleted slugs (still processed in --regenerate), and (b) status='INACTIVE' soft-deletes.
  • The layouts (authors/single.html, more-from-author.html) render author_index.json verbatim — so the fix belongs at the builder (one predicate fixes page + rail + byline consistently).

Fix

  • buildAuthorIndex(rows, advocates, activeSlugs?) — skip rows whose slug.toLowerCase() ∉ activeSlugs. Fail-open when the set is empty/undefined (degraded / ALLOW_EMPTY_CAP builds → no filtering, matching the existing browse-skip guard). Lowercase compare (row slugs = mixed-case source dirs; catalog slugs = lowercase-canonical).
  • writeAuthorPages threads activeSlugs through; an author whose tutorials are all inactive drops out of the index and their stale .md page is pruned.
  • fetch-tutorials.ts passes new Set(tutorialMetas.map(m => m.slug.toLowerCase())) (already in scope at the call site).

Verification

  • Unit tests added + green (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.
  • Takes effect on the next content rebuild / fetch-tutorials run (regenerates author_index.json). No deploy performed.

#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.
@jung-thomas
jung-thomas merged commit 3441c25 into DEV Aug 14, 2026
3 checks passed
@jung-thomas
jung-thomas deleted the fix/author-index-exclude-unpublished branch August 14, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant