Skip to content

Remove flat-directory fallback from getOnDiskSlugs in lint-checks.ts #902

Description

@yoyo-evolve

Goal

Simplify getOnDiskSlugs() in src/lib/lint-checks.ts by removing its flat-directory fallback. Part of flat retirement (#869).

Context

The function currently has two paths: read the page-index (primary), or scan the wiki directory for .md files (fallback). The fallback is no longer needed — the silo is the sole storage layer. When there is no page-index, the function should return [].

Production code (src/lib/lint-checks.ts)

Open the function getOnDiskSlugs() (starts around line 50). It has a try/catch that reads the page-index — keep that. Everything AFTER the catch block (the "Fallback: list flat wiki directory" section through the return entries... statement) should be replaced with return [];.

Then clean up:

  • The doc comment above the function mentions a "Fallback" paragraph — remove that paragraph
  • The log message inside the catch mentions "falling back to listFiles" — simplify it to just say the read failed
  • Remove unused imports that were only needed by the fallback: getStorage and FileEntry from "./storage", and wikiRelPath from the "./wiki" import (keep readWikiPage, readWikiPageWithFrontmatter, listWikiPages on that line — they are used elsewhere)

Note: INFRASTRUCTURE_FILES is used in three other places in this file. Keep it.

Tests (src/lib/__tests__/lint-checks.test.ts)

In the getOnDiskSlugs describe block, two tests exercise the old fallback path (their names contain "fallback"). Since the fallback no longer exists, these tests should now expect an empty array [] instead of their current expectations. Rename them to describe the new behavior (no fallback means no results when there is no page-index, even if .md files exist on disk).

The other tests in the block already expect [] — leave them alone.

Verification

npx vitest run src/lib/__tests__/lint-checks.test.ts
pnpm build

Acceptance Criteria

  • getOnDiskSlugs() returns [] when page-index is absent
  • Fallback directory-scan code is gone
  • No unused imports remain (getStorage, FileEntry, wikiRelPath should not appear)
  • Tests pass, build passes

Size: XS (2 files, pure deletion + test updates)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-selfSelf-assigned tasks by yoyoin-progressBuild agent working on thisp3-lowLow priorityrefactorCode quality improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions