Tidme icon indicating copy to clipboard operation
Tidme copied to clipboard

Tidme displays SRS footer on all Tiddlers

Open rdmolony opened this issue 2 months ago • 5 comments

Hey there!

If you're interested I've found a bug in the Tidme plugin when installed alongside TiddlyWiki Core at v5.3.5

Describe the bug For TiddlyWiki v5.3.5 when exactly two tiddlers in a Tidme deck have state: 1, the spaced repetition UI (Hard/Good/Easy buttons) incorrectly appears on every single tiddler in the wiki, not just the ones being reviewed.

This one was quite tough to narrow down -

I've attached two wikis (taken from the official Tidme example) illustrating this behaviour

  • A bugfree wiki at TiddlyWiki v5.3.3 -

Tidme Manual @core-5.3.3.html

  • A buggy wiki at TiddlyWiki v5.3.5

Tidme Manual @core-5.3.5.html

To Reproduce

  • Use TiddlyWiki 5.3.5 with Tidme plugin installed
  • Create two new tiddlers
  • Tag both tiddlers with any tag that makes them part of a Tidme deck (e.g., ? for Default deck)
  • Add field state with value 1 to BOTH tiddlers
  • Save both tiddlers
  • Observe: The Tidme review UI (Again/Hard/Good/Easy buttons) now appears on ALL tiddlers in the wiki

Expected behavior The spaced repetition UI should only appear on tiddlers that are actually part of the Tidme review system and currently being reviewed.

Desktop (please complete the following information):

  • OS: Linux (NixOS)
  • Browser: Chromium
  • Version: N/A

Smartphone (please complete the following information):

  • Device: iPhone 16
  • OS: N/A
  • Browser: Safari
  • Version: N/A

rdmolony avatar Oct 11 '25 12:10 rdmolony

Maybe a better place for this bug report is -

https://github.com/open-spaced-repetition/fsrs4tw

rdmolony avatar Oct 11 '25 12:10 rdmolony

I pointed Claude at https://github.com/open-spaced-repetition/fsrs4tw & it believes that the issue lies in the use of the cascade operator -

https://github.com/open-spaced-repetition/fsrs4tw/blob/26f8d109476626e6052c24e7e67f8be3c24ff5de/tiddlers/configs/filters/decktiddler.tid -

Looking through the Tidme source code you provided, I found the likely culprit! It's in the file tiddlers/configs/filters/cascade/card.tid:

title: $:/config/Tidme/StoryTiddlerTemplateFilters/card
tags: $:/tags/StoryTiddlerTemplateFilter

[subfilter{$:/config/Tidme/Filters/decktiddler}then[$:/plugins/tidme/fsrs4tw/ui/ViewTemplate/tiddler]]

This filter determines which tiddlers should display the Tidme spaced repetition UI. It uses a cascade mechanism that checks if a tiddler matches the filter in $:/config/Tidme/Filters/decktiddler.

Looking at $:/config/Tidme/Filters/decktiddler:

[<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TidmeFilter/DeckTiddler]!is[draft]get[text]] +[!is[blank]]

And the filters that use the state field are in:

  • $:/config/Tidme/Filters/decklearn: subfilter{!!state_learn}
  • $:/config/Tidme/Filters/deckdue: subfilter{!!state_due}
  • $:/config/Tidme/Filters/decknew: subfilter{!!state_new}

These filters check against the deck's configuration which includes:

state_learn: [state[1]] [state[3]] :filter[{!!due}compare:date:lt<now [UTC]YYYY0MM0DD0hh0mm0ss0XXX>]
state_due: [state[2]has[due]] -[!days:due[1]]
state_new: [!has[state]] [state[0]]

The Problem

The bug is likely in how TiddlyWiki 5.3.5 handles the cascade filter when exactly two tiddlers match [state[1]]. The cascade mechanism is supposed to stop at the first match, but with exactly two tiddlers having state: 1, it seems to be matching ALL tiddlers instead.

The Specific Bug Location

The issue is in the interaction between:

  1. The StoryTiddlerTemplateFilter cascade (which determines which template to use)
  2. The state_learn filter that checks [state[1]]
  3. How TiddlyWiki 5.3.5's filter engine evaluates this when exactly 2 tiddlers match

Likely Fix

The Tidme developer would need to adjust the filter logic in either:

  • The cascade filter in $:/config/Tidme/StoryTiddlerTemplateFilters/card
  • Or the state detection filters to be more explicit about their matching criteria

A potential workaround in the filter could be to add a more specific condition, like:

[<currentTiddler>subfilter{$:/config/Tidme/Filters/decktiddler}then[$:/plugins/tidme/fsrs4tw/ui/ViewTemplate/tiddler]]

This is definitely a compatibility issue between Tidme's filter expressions and changes in TiddlyWiki 5.3.5's filter evaluation engine.

rdmolony avatar Oct 11 '25 12:10 rdmolony

Thanks.

I haven't had the energy to focus on Tidme recently. I'll be able to modify the code once I have a significant block of free time.

oflg avatar Oct 27 '25 00:10 oflg

Thanks @oflg, I rolled out https://github.com/open-spaced-repetition/fsrs4tw/pull/3 & manually verified that this fixes this issue

(It by changes a few filters to use +title rather than match)

I included repro steps if you want to check it yourself too!

rdmolony avatar Oct 28 '25 16:10 rdmolony

My apologies, I've closed that PR. I was misled & didn't review the changes throughly enough - that change would have removed the reminder footer from all tiddlers

(The dangers of using LLMs without a good understanding...)

rdmolony avatar Oct 31 '25 15:10 rdmolony