Skip to content

Honor includeUnresolved for graph forward links#206

Merged
aaronsb merged 2 commits into
aaronsb:mainfrom
fa1k3:fix/forwardlinks-include-unresolved
May 25, 2026
Merged

Honor includeUnresolved for graph forward links#206
aaronsb merged 2 commits into
aaronsb:mainfrom
fa1k3:fix/forwardlinks-include-unresolved

Conversation

@fa1k3
Copy link
Copy Markdown
Contributor

@fa1k3 fa1k3 commented May 20, 2026

Summary

includeUnresolved is exposed as an option for graph operations, but graph.forwardlinks only returned resolved links.

This updates forward-links handling so:

  • default behavior stays unchanged (resolved links only)
  • includeUnresolved: true adds unresolved outgoing links as graph edges
  • unresolved targets do not create file nodes unless they resolve to an actual TFile
  • missing metadataCache.unresolvedLinks is handled defensively

Tests

  • npm run lint (passes with existing warnings)
  • npm run build
  • npm test -- tests/graph-search.test.ts --runInBand
  • npm test -- --runInBand --forceExit

@aaronsb aaronsb added the area:graph Graph operations (graph.*, link traversal, statistics) label May 25, 2026
… contract

PR aaronsb#207 (merged 2026-05-25) switched forwardlinks node titling from
`file.name.replace(/\.md$/, '')` to `getNodeTitle(file)`, which reads
`file.basename`. This PR was authored before that landed, so the test
mock set `name` but not `basename` and now produces `title: undefined`
on integration. Add `basename` to the mock to match the real TFile API.
@aaronsb aaronsb force-pushed the fix/forwardlinks-include-unresolved branch from 4bac854 to 943de66 Compare May 25, 2026 21:16
@aaronsb
Copy link
Copy Markdown
Owner

aaronsb commented May 25, 2026

Reviewed and merging — thanks for the contribution! Pushed one follow-up commit (943de66) to update the makeFile test mock: PR #207 (merged earlier today) switched forward-link titling from file.name.replace(/\.md$/, '') to getNodeTitle(file), which reads file.basename. Without the mock setting basename, the post-#207 integration produced title: undefined in your two test cases. The fix is mechanical (just match the real TFile API on the mock) and full suite is 312/312.

@aaronsb aaronsb merged commit 37d4a2e into aaronsb:main May 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:graph Graph operations (graph.*, link traversal, statistics)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants