Skip to content

[BUG] schema_validate with no identifier or note_type defaults to validating type 'unknown' instead of all types #1013

Closed

Description

@phernandez

Summary

Calling schema_validate without identifier or note_type returns a "no notes found of type 'unknown'" hint instead of validating every typed note in the project.

Repro

schema_validate(project_id="...")

→ # No Notes Found of Type 'unknown'
  schema_validate found no notes with type 'unknown' in the project.

To actually get full-project coverage, the caller has to enumerate every note_type and call validate once per type — which means knowing the types up front.

Expected

When neither identifier nor note_type is provided, validate every note type that has a defined schema in the project, returning a per-type summary. Something like:

# Schema Validation: all types

person:  1 / 1 valid
ticket:  2 / 2 valid
runbook: no schema defined — skipped

This matches how a fresh agent or CI run would want to use it: "tell me if anything is wrong" without having to know the type list first.

Why it matters

For agents (and humans) running periodic graph health checks, the current default is a footgun — looks like you ran a no-op when really you ran the wrong thing.

Discovered while

Building a help-desk MSP playbook demo for basicmemory.com. Was looking for an "is everything valid?" call at the end of a workflow and got the unknown-type hint instead.

Activity

  1. claude commented on Jun 23, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 8m 12s —— View job


    Triage & Fix Complete

    Labels applied: bug

    Classification: Bug — Medium priority, Medium complexity


    Root Cause

    Two places combine to produce the misleading "type 'unknown'" output:

    1. schema_router.py:190 — the batch validation path was gated on note_type:

      entities = await _find_by_note_type(..., note_type) if note_type else []

      When neither note_type nor identifier is provided, this always returns an empty list → total_entities=0, note_type=None.

    2. mcp/tools/schema.py:287 — the guard then fell through to a string default:

      effective_type = note_type or result.note_type or "unknown"

      All three are None/falsy, so effective_type = "unknown" → "No Notes Found of Type 'unknown'".


    Fix (4 files)

    • Gather context and read the issue
    • Locate and understand root cause
    • Fix schema_router.py — add _find_covered_types() helper; when no args given, find all schema note entity types and gather entities across all of them
    • Fix mcp/tools/schema.py — detect all_types_mode, show "Nothing to Validate" guidance (not "type unknown") when empty, add "By Type" per-type summary in formatter
    • Add 5 new tests (3 MCP tool + 2 API router)
    • Run just fast-check — blocked: test runner requires permissions not available in this job
    • Push to remote — blocked: github-actions[bot] lacks write access to this repo

    The commit is ready locally (863afd9) but could not be pushed. Changes are in branch claude/issue-1013-20260623-1651.


    What the fix produces

    # Schema Validation: all types
    
    Notes: 3 | Valid: 3 | Warnings: 0 | Errors: 0
    
    ## By Type
    
    - **person**: 2 / 2 valid
    - **ticket**: 1 / 1 valid
    
    - **Alice** — valid
    - **Bob** — valid
    - **BUG-1** — valid
    

    No-schema-defined case now returns:

    # Nothing to Validate
    
    `schema_validate` found no notes for any schema-covered type.
    
    This means either no schema definitions exist, or no notes have been created for the defined types yet.
    ...
    
  2. added
    bug
    on Jun 23, 2026
  3. phernandez commented on Jul 15, 2026

    @phernandez
    MemberAuthor

    Status: still valid on main. The batch path in schema_router.py is gated on note_type (... if note_type else []), so the no-args call returns an empty batch that renders as the misleading "unknown" default in mcp/tools/schema.py. An automated fix was drafted back in June (commit 863afd9) but the branch was never pushed, so nothing landed.

    Plan: add a real all-types branch that enumerates schema-covered note types and returns a per-type summary (person: 1/1 valid style), with router- and tool-level tests for the no-args path.

  4. added this to the v0.23 milestone on Aug 11, 2026
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

    bug

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions