Skip to content

Test against Obsidian's real cache; redraw bases opened before Tasklines loads - #76

Merged
rcasazza merged 3 commits into
mainfrom
test/real-cache-snapshots
Nov 25, 2026
Merged

rcasazza merged 3 commits into
mainfrom
test/real-cache-snapshots

Conversation

@rcasazza

@rcasazza rcasazza commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What changed

1. Extraction is tested against Obsidian's real metadata cache

  • Added ten sample notes in test-vault/Cache samples/: callouts, blockquotes, code fences and indented code, comments and frontmatter, setext headings, numbered lists, lists with blank lines between items, mixed tab and space indentation, odd checkbox markers, and Windows line endings. The folder is outside Projects/, so the test bases don't show these notes.
  • Added tests/fixtures/obsidian-cache.json, which holds the list items and headings Obsidian 1.15.1 reported for those notes.
  • Added tests/obsidian-cache.test.ts, which runs extractTasks against that data. Expected tasks, nesting and sections were checked by hand.
  • tests/fixtures/README.md and import-cache-snapshot.ts give the recapture steps. AGENTS.md now treats this fixture as the reference for note structure.

Why: tests/fake-vault.ts guesses the cache with a regex, and it differed from Obsidian on 9 of the 10 notes. The plugin was right in almost every case because it uses Obsidian's real data. The fake vault was wrong, so tests built on it couldn't catch structure bugs.

Bug found: a four-space subtask under a tab-indented task lost its nesting. extract.ts threw away the parent Obsidian reported, because of an indent check meant to handle a root parent of 0 for lists on line 0. Obsidian actually uses -1 there, so the check now only applies when the parent is line 0.

2. Bases opened before Tasklines loads now redraw

A base that opened before Tasklines registered its views kept showing "Unknown view type: tasklines" until it was reopened. This happens after installing or turning on the plugin with a base open, or after choosing "Trust author and enable plugins" when opening a vault for the first time. When the plugin loads after the layout is ready, reopenBasesShowingErrors reopens bases that show a visible error. Every base has a hidden, empty .bases-error element, so the check only counts a visible one with text. Normal startup is unchanged.

Testing

  • npm run build, npm run lint and npm test pass (1,602 tests).
  • Checked by hand in Obsidian 1.15.1:
    • Base open, Tasklines turned off, base reopened, Tasklines turned on: the base redraws. It stayed on the error before this change.
    • test-vault opened as a new vault, then "Trust author and enable plugins": the base shows its saved filters and sorting. It stayed on the error before.

Notes for review

  • Bases embedded in notes (code blocks, ![[x.base]] embeds) aren't redrawn; the note still needs reopening.
  • The redraw has no automated test because it depends on Obsidian's workspace. RELEASE.md's desktop step now includes it as a manual check.
  • No version bump. Releases are batched.

🤖 Generated with Claude Code

rcasazza and others added 3 commits November 25, 2026 06:56
The fake vault guesses Obsidian's list items with a regex, and it differed
from Obsidian on 9 of 10 sample notes (callouts, code, comments, loose
lists, setext headings and more). Capture what Obsidian 1.15.1 reports for
sample notes in test-vault/Cache samples/ and check extraction against it.

This found one bug: a four-space subtask under a tab-indented task lost its
nesting, because extract threw away the parent Obsidian reported. The indent
check guarded against a root parent of 0 for lists on line 0, but Obsidian
uses -1 there, so it now only applies when the parent is line 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A base that opened before Tasklines registered its views kept showing
"Unknown view type: tasklines" until reopened: after installing or turning
on the plugin, or after trusting a vault's plugins on first open. When the
plugin loads after the layout is ready, reopen bases that show a visible
error. Normal startup is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The redraw has no automated test because it depends on Obsidian's
workspace, so check it by hand on desktop before each release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rcasazza
rcasazza merged commit 7f04d7f into main Nov 25, 2026
2 checks passed
@rcasazza
rcasazza deleted the test/real-cache-snapshots branch November 25, 2026 11:58
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