Skip to content

validate --only records should parse and validate record files #65

@trakhimenok

Description

@trakhimenok

Problem

ingitdb validate --only records currently reports Markdown records as valid even when the record file cannot be parsed. This means invalid record files can pass validation but fail later when queried/read.

Repro

In trakhimenok/project-hub, the agent_logs collection uses Markdown record files with YAML frontmatter:

  • .ingitdb/root-collections.yaml registers agent_logs: agent-logs
  • agent-logs/.collection/definition.yaml uses record_file.format: markdown and content_field: summary
  • records live under agent-logs/$records/*.md

Create an intentionally malformed record, for example:

---
agent: Copilot CLI
timestamp: 2026-05-30T08:12:53+01:00
category: validation-test
status: invalid
links:
  broken: [unterminated
---

This record has malformed YAML frontmatter.

Then run:

ingitdb validate --path . --only records

Observed output:

inGitDB db path:  .
All 2 records are valid for collection: agent_logs

But reading the same collection fails as expected:

ingitdb select --path . --from agent_logs --format json

Observed error:

Query failed: failed to parse markdown file agent-logs/$records/invalid-missing-project.md: failed to parse markdown record: markdown: invalid YAML frontmatter: yaml: line 5: did not find expected '\ ,'\ or ']'\.\n```\n\n## Expected behavior\n\nWhen the CLI is asked to validate records, it should parse each record file and report invalid records. Invalid should include at least:\n\n- unparsable record files, such as malformed Markdown frontmatter or invalid JSON/YAML\n- records that do not match the collection schema\n- missing required fields\n- fields with wrong types or invalid values\n\n`validate --only records` should exit non-zero when any record is invalid and include the record path plus a useful parse/schema error.\n\n## Why this matters\n\n`validate --only records` is expected to be the safe preflight check for GitHub Actions, CI, and agent workflows. If it does not parse the files, broken records can be committed even though they fail when queried later.\n

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions