fix(cli): show the docs viewer the directories it could not read - #1131
Merged
Merged
Conversation
A docs/plans directory that would not list made the docs scan throw, so the viewer's data.json answered 500 and the page stayed empty or stale with no message, while guren_get_plans named the directory. buildDocsViewerData now catches that FileDiscoveryError (check --docs still throws), carries it as docsScanFailure, and carries the plan directories discoverPlanFiles could not list as unreadablePlanDirs. readViewerPlans takes the whole discovery, so the viewer and readPlanOverview share one composition, and relativeUnreadableDirs is the one rule check --plan, the viewer and guren_get_plans name such a directory by. The page lists both above the open plans.
3 tasks done
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.
Summary
guren_get_plans(#1126) reports plan directories that would not list, but the docs viewer dropped them. The gap was larger than the viewer showing fewer plans.discoverPlanFileswalks the app root anddocs/plans/**, and the docs scan (scanDocs→collectFiles) walks the samedocs/plansand throwsFileDiscoveryErrorthere. SobuildDocsViewerDatarejected,/_guren/docs/data.jsonanswered 500, and the page stayed empty or stale with no message, while the agent was told which directory failed.buildDocsViewerDatacatchesFileDiscoveryErrorfrom the docs graph only (anything else is rethrown) and carries it asdocsScanFailure. Plans never read the docs graph, so they are still served.guren check --docskeeps reporting it as a faileddiscovery:read.readViewerPlans(appRoot, discovery)takes the wholePlanDiscoveryand returnsunreadablebesideopenandhashes, including when no plan file was found.readPlanOverview()reuses it, so the viewer'sunreadablePlanDirsandguren_get_plans'unreadablecome from one composition.relativeUnreadableDirs()indiscovery.tsis the one waycheck --plan, the viewer andguren_get_plansname such a directory: app-relative,.for the app root, with the app root removed from the error's paths. Before this,guren_get_plansprinted the absolute path inreason, andcheck --plannamed the app root as an empty string.scanWarnings()in the page model), and hides the "No documents found" hint when the scan stopped rather than found nothing.web/scripts/prerender-docs-viewer.tsrefuses to publish when either is set, since catching the failure would otherwise let a partial viewer through.Not changed here:
load()on the page still returns quietly on a non-OK response, and the server caches a rejected payload for its TTL. Other failures still go silent through those two paths.Test plan
tests/docs-viewer-plans.test.ts: a synthetic discovery with no files and two unreadable directories; withdocs/plansat mode 000 (skipped as root),readPlanOverview().unreadableequals the payload'sunreadablePlanDirs, the root plan is still listed, anddocsScanFailurenamesdocs/plans. This case failed before the catch.tests/docs-viewer-page.test.ts:scanWarnings()text.tests/plan-check.test.ts:relativeUnreadableDirs(), including a sibling/tmp/app2path left alone.docs/plansat 000: both warnings render above the plan list, and the readable plan and its entities are still drawn.bun run build,bun run lint,tsc --noEmit,typecheck:build-configs,typecheck:scaffold-templates, the example and web typechecks,audit:prose,audit:docs,audit:core-first. The full test suite is left to CI.