Files
memos/store/test
johnnyjoygh 8b61d2e9d6 feat(memos)!: treat a comment as a memo with a parent
ListMemos returns comments; a feed narrows to top-level memos with the
filter `parent == null`. A comment is created by CreateMemo with
memo.parent, read through Memo.parent, and counted by the new
Memo.comment_count. ListMemoComments, CreateMemoComment and
MemoRelation.Type.COMMENT are removed, along with the two MCP comment
tools. Storage is unchanged: a comment is still one COMMENT row in
memo_relation.

The memo filter gains `parent` and `name`. User stats count comments
unless their filter excludes them. Memo.comment_count takes field 13 and
the fields after it move to 14 through 18.

Web: memo lists leave comments out unless "Include comments" is on. It
and Compact mode move from the Timeline view options to Settings >
Preferences > This device and apply to every memo list. A comment shown
in a list names its parent on a strip above its card, and the parents of
a page of comments are fetched with one request.
2026-11-22 12:42:06 +08:00
..
2026-09-17 23:28:19 +08:00

Store tests

Run from the repository root. Docker must be running for MySQL, MariaDB, PostgreSQL, and released-binary upgrade tests.

go test -v ./store/... # SQLite, MySQL, MariaDB, PostgreSQL; isolated databases per test
DRIVER=mysql go test -v ./store/test/... # MySQL 8.4
DRIVER=mysql MYSQL_VARIANT=mariadb go test -v ./store/test/... # MariaDB 11.4.13

MariaDB uses the application's mysql driver, dialect, and migrations. MYSQL_VARIANT is test-only; accepted values are mysql (the default) and mariadb. The aggregate run sets each target explicitly, regardless of an inherited variant. The MariaDB container enables ONLY_FULL_GROUP_BY alongside its strict SQL mode so shared queries are checked under strict grouping rules.

MariaDB 11.4.13 is the tested compatibility target. Deployments need InnoDB and utf8mb4. Other MariaDB versions, database conversion between MySQL and MariaDB, and replication between them are outside this coverage. Text ordering and regex behavior can differ; timestamp accessors use the database session timezone. Exact tag and content-guard comparisons retain explicit binary semantics.

Upgrade coverage

DRIVER=sqlite go test -v -count=1 -timeout 30m -run 'TestMigration|TestUpgrade|TestFreshInstall' ./store/test/...

Use DRIVER=mysql, DRIVER=mysql MYSQL_VARIANT=mariadb, or DRIVER=postgres for the other database targets. Upgrade Smoke runs this selection for all four targets before release. Both ordinary store tests and upgrade tests use the selected container, including the private-network connection from released Memos binaries.

  • Before v0.31.0: TestUpgradeThroughBaselineRelease initializes a database with released 0.30.0, verifies the current migrator refuses a direct upgrade without modifying data or settings, then upgrades through released 0.31.0 to current.
  • From v0.31.0: TestUpgradeFromBaselineRelease initializes a database with released 0.31.0, then checks preservation of the account, memo, saved View, and access mode, post-upgrade writes, and reopening the database after upgrade.
  • From CalVer: TestUpgradeFromCalendarRelease uses local store fixtures for month changes, point releases, RC promotion, and year changes. It checks the same preservation and restart behavior. These are fixtures, not published CalVer binaries; application versions advance while the database schema changes only with migrations.