Skip to content

Validate flat-folder LLM output with Zod (match the concept-graph pattern) #117

Description

@bharatsachya

Type: refactor / consistency · Difficulty: medium

The active flat-folder ingestion casts LLM JSON with as T and hand-shapes fields, while the concept-graph path already validates with Zod (concept-graph/phases/enrich-one-file.ts:122 via perFileEnrichmentSchema.safeParse). CLAUDE.md Rule of LLM Provider requires LLM output validated against a schema before use.

Files: packages/llm/src/jsonClient.ts:24 (JSON.parse(...) as T), packages/ingest-github/src/adapters/llm-file-analyzer.ts:48, packages/ingest-github/src/strategies/flat-folder/repo-summary.ts:107.

Do: add Zod schemas for file-analysis and repo-summary outputs and safeParse them, mirroring concept-graph/enrichment-schema.ts.

Done when: both flat-folder LLM calls parse through a schema; malformed output is rejected/normalized, not cast.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions