Kgothatso NgakoandClaude Opus 5 5623df530c test: execute the nostr filter query against real sqlite
NostrEventFilterQueryTest pins the SQL string the builder produces. It never
runs that string, and the gap between "the SQL reads correctly" and "sqlite
returns the right rows" is where this query's expensive mistakes live. Four
classes of bug survive a string assertion intact, and all four are covered
here.

SQL that is well-formed but not accepted. The clause emitted for a
present-but-empty list is the bare literal `0`. Whether sqlite takes that as a
false boolean expression rather than rejecting it is not something the builder
test can answer; ids, authors, kinds and tags are each asserted to match
nothing when handed an empty list.

Binding indices. The limit is bound after every tag pattern, so its placeholder
is the last in the statement. A drift in that order produces a byte-identical
SQL string and different rows, so it is covered by a filter that carries
authors, kinds, since, until, search, a tag and a limit at once.

LIKE semantics against the column as actually written. The tag pattern is a
fragment of the encoded tag -- `["p","<hex>"` -- and only real stored JSON can
show that it anchors on the tag name (a pubkey in an `e` tag is not a `p`
match, which is exactly the regression the substring scan `tags LIKE
'%<pubkey>%'` caused), that it tolerates the relay hint and marker that follow
a real tag value, and that escapeLike keeps a `%` in a tag value literal
instead of widening the match.

Timestamp units. This is a cross-file invariant nothing enforces:
NostrEventFilterQuery binds since/until as epochSeconds, and
MantraConverters.instantToTimestamp writes the createdAt column as
epochSeconds. They agree today. Move either to milliseconds and both files
still read correctly on their own while the filter silently selects nothing or
everything, so the agreement is now asserted directly.

Also covered: the NIP-01 inclusive bounds on both ends, using events stamped
exactly on since and on until -- the case that tells an inclusive bound from
the strict `createdAt > :since` this replaced; tags ORing values within a name
and ANDing across names, against tagsAll which ANDs within a name too;
newest-first ordering with the `id DESC` tiebreak, and a limit keeping the
newest rather than the oldest window the per-shape queries used to return.

Three of these were checked by mutation rather than assumed. Reverting the tag
pattern to the naive `%value%` substring fails `a tag value is matched in its
own position`; relaxing `createdAt >= ?` back to `>` fails both the inclusive
bounds test and the units test. The mutations were reverted; no production
source is touched by this commit.

14 tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 02:50:14 +02:00
2026-07-05 23:21:02 +02:00
2026-07-28 09:10:20 +02:00
2026-03-24 04:47:19 +02:00
2026-03-23 01:41:39 +02:00
2026-03-23 01:41:39 +02:00
2026-03-23 01:41:39 +02:00

This is a Kotlin Multiplatform project targeting Android, iOS, Desktop (JVM).

  • /composeApp is for code that will be shared across your Compose Multiplatform applications. It contains several subfolders:

    • commonMain is for code that’s common for all targets.
    • Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, the iosMain folder would be the right place for such calls. Similarly, if you want to edit the Desktop (JVM) specific part, the jvmMain folder is the appropriate location.
  • /iosApp contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.

Build and Run Android Application

To build and run the development version of the Android app, use the run configuration from the run widget in your IDE’s toolbar or build it directly from the terminal:

  • on macOS/Linux
    ./gradlew :composeApp:assembleDebug
    
  • on Windows
    .\gradlew.bat :composeApp:assembleDebug
    

Build and Run Desktop (JVM) Application

To build and run the development version of the desktop app, use the run configuration from the run widget in your IDE’s toolbar or run it directly from the terminal:

  • on macOS/Linux
    ./gradlew :composeApp:run
    
  • on Windows
    .\gradlew.bat :composeApp:run
    

Build and Run iOS Application

To build and run the development version of the iOS app, use the run configuration from the run widget in your IDE’s toolbar or open the /iosApp directory in Xcode and run it from there.


Learn more about Kotlin Multiplatform…

S
Description
Mantra as a kotlin multiplatform project
https://mantra.press
Readme
13 MiB
0 Stars 1 Watchers 0 Forks
Languages
Kotlin 100%