supertag-cli icon indicating copy to clipboard operation
supertag-cli copied to clipboard

[BUG] tana_query field filtering fails on option fields with HTML formatting

Open evielync opened this issue 9 months ago • 2 comments

This is my first bug report... so I asked Cladue to describe what was happening.

When using tana_query with a where clause on option-type fields (like Task Status), the filter does an exact string match against the raw stored value — which includes HTML formatting (e.g. DONE).

This means natural queries like {"Task Status": "Done"} return zero results, even though the field is populated.

Reproduction:

// Returns 0 results ❌ { "find": "action", "where": { "Task Status": "Done" } }

// Returns 0 results ❌ { "find": "action", "where": { "Task Status": "DONE" } }

// Works ✅ (but requires knowing the internal format) { "find": "action", "where": { "Task Status": "DONE" } }

// Workaround using contains operator ✅ { "find": "action", "where": { "Task Status": "~DONE" } } Additional issue: Field values are not returned in tana_query results. The fields object comes back as {} even though tana_node and tana_field_values return them correctly.

Suggested fix:

Strip HTML tags from field values before comparison Case-insensitive matching by default (so done, Done, DONE all match) Return field values in tana_query results (hydrate the fields object) This would make option field queries work naturally without callers needing to know about Tana's internal HTML formatting.

Environment:

Supertag CLI v2.2.3 Tested with action supertag, Task Status field (options type)

evielync avatar Feb 21 '26 21:02 evielync

Thanks for the detailed bug report, @evielync! This has been fixed in PR #43 — the query engine now strips HTML tags from option field values before comparison and uses case-insensitive matching, so "Task Status": "Done" (or done, DONE, etc.) all work as expected. Field values are also now auto-hydrated in tana_query results. Appreciate you catching this!

jcfischer avatar Feb 22 '26 11:02 jcfischer

Thankyou @jcfischer! Saves me going and unformatting all my option fields!

evielync avatar Feb 22 '26 18:02 evielync