Skip to content

Use vault fallback while Datacore initializes - #1258

Open
NathanSkene wants to merge 1 commit into
DiscourseGraphs:mainfrom
NathanSkene:codex/datacore-readiness-fallback
Open

Use vault fallback while Datacore initializes#1258
NathanSkene wants to merge 1 commit into
DiscourseGraphs:mainfrom
NathanSkene:codex/datacore-readiness-fallback

Conversation

@NathanSkene

@NathanSkene NathanSkene commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • check Datacore's explicit api.core.initialized state before using its query index
  • use Obsidian's vault and metadata cache while Datacore is still initializing or when a query throws
  • trust empty Datacore results after initialization, avoiding duplicate full-vault scans for legitimate no-match queries
  • cover title search, compatible-node lookup, and node enumeration with focused regression tests

Reproduction

Datacore exposes its API during plugin loading, but initializes its index asynchronously on workspace.onLayoutReady. During a first install, reindex, or cache rebuild, Discourse Graph can therefore see a loaded Datacore API whose core.initialized flag is still false. Queries in that window can return an empty or partial universe even though matching discourse nodes are already available through Obsidian's metadata cache.

The previous distribution-repository PR described the index as potentially “empty or stale.” The reproduced case is narrower: Datacore is present but has not finished initialization. This change does not treat an empty result from an initialized index as stale.

Validation

  • pnpm --filter @discourse-graphs/obsidian test — 5 tests pass
  • pnpm --filter @discourse-graphs/obsidian check-types
  • targeted ESLint on the changed source and tests
  • Obsidian production build (tsx scripts/build.ts)
  • git diff --check

Replaces DiscourseGraphs/discourse-graph-obsidian#9, which targeted the generated distribution repository.


Open in Devin Review

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jul 28, 2026 9:41am

Request Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

1 participant