Skip to content

feat!: ValidationResult is a list of issues, each with its severity - #217

Merged
mindsocket merged 3 commits into
mainfrom
claude/project-thread-plfu1w
Nov 10, 2026
Merged

mindsocket merged 3 commits into
mainfrom
claude/project-thread-plfu1w

Conversation

@mindsocket

Copy link
Copy Markdown
Owner

Requested by Rog · project thread

Closes #198.

Why

validateSpace returned one array per check (nodeErrors, refErrors, duplicateErrors, hierarchyViolations, ruleViolations, unresolvedContentLinks, parseIssues), and only some of them carried a severity. nodeIssues() then built a second shape, keyed by node and with severities, for validateFile and validate --json. Every consumer read that second shape. So there were two shapes, and an extra function and type to keep them in step.

What

  • ValidationResult.issues: ValidationIssue[] replaces the per-check arrays. Every issue has a kind, a key (stable within its node or file), a severity, a message, and its nodeId / source. Each kind adds its own fields as a discriminated union: a rule's ruleId/category/evidence, a duplicate's sources, a broken link's ref/reason, a gate's gatedBy, and so on. Nothing is flattened into the message any more.
  • Severity is decided once, in core, while the list is built (issuesOf, private).
  • validate --json prints the result as it is, plus space, valid and errorCount. validateFile returns one node's issues in the same shape.
  • Removed: nodeIssues, FileValidationIssue, the per-check arrays and nodeErrorCount. orphans is now { nodeId, title }[], so the result serialises without whole nodes. 'parse' is added to VALIDATION_ISSUE_KINDS.
  • Run-level fields don't change: validCount, coverageGates, contextTrimmed, skippedByDepth, depthLimit.

Consumers

  • Plugin hooks (state.ts) group the list by nodeId (or file for parse issues) and key by key. They still skip parse warnings (untyped notes), as before.
  • Mod contract and bridge: PaneValidation is now { issues }. The map pane has a small PROTOTYPE: adapter that converts the list for map-views 0.5's annotationsFrom. It goes away once a map-views release takes the list itself.
  • Next steps: map-views (annotationsFrom takes ValidationIssue[]), then Obsidian.

Checks

bun run typecheck, bun run lint, bun run test (902 pass), bun run test:hook (55 pass), bun run test:mod (12 pass), claude plugin validate plugin, plus the pre-push tree check.

Breaking for API consumers. Pre-1.0, so this should be a minor release (0.23.0).


Generated by Claude Code

validateSpace returned per-check arrays (nodeErrors, refErrors, duplicateErrors,
hierarchyViolations, ruleViolations, unresolvedContentLinks, parseIssues), and
only some carried a severity. nodeIssues() then derived a second, node-keyed
shape with severities for validateFile and validate --json, which every
consumer read instead.

ValidationResult now has one `issues` list. Each ValidationIssue has a kind,
key, severity and message, the node or file it is about, and its kind's own
fields (a rule's ruleId and category, a duplicate's sources, a broken link's
ref). Core decides severity once, as it builds the list. validate --json
prints the result as it is, plus space/valid/errorCount, and validateFile
returns one node's issues in the same shape.

Removed: nodeIssues, FileValidationIssue, ValidationResult's per-check arrays
and nodeErrorCount. `orphans` is now { nodeId, title }[]. 'parse' joins
VALIDATION_ISSUE_KINDS.

The map pane converts the list for structured-context-map-views 0.5's
annotationsFrom until a map-views release takes the list itself.

Closes #198

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Xphpde5yiQF1dWi3KfETS
@mindsocket mindsocket self-assigned this Nov 9, 2026
@claude

claude Bot commented Nov 9, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@mindsocket mindsocket left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small improvements needed

Comment thread docs/concepts.md Resolved
Comment thread docs/concepts.md Resolved
Comment thread docs/rules.md Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate --json: emit the validateSpace result shape, not a second derived one

2 participants