Avoid repeated attachment table scans in memo lists and attachment filters.
Validate existing index definitions and allow MySQL startup retries after DDL commits. Keep unbounded PostgreSQL MIME types out of B-tree keys, document coordinated upgrades, and cover migrations and filters with regression tests.
Co-authored-by: b84330808 <b84330808@gmail.com>
Let people use any Unicode emoji through a searchable, virtualized
picker.
Keep reaction counts accurate and requests optimistic and idempotent.
Refresh demo content so signed-in visitors can participate.
BREAKING CHANGE: Remove the MEMO_RELATED instance setting and
memoRelatedSetting configuration value. Remove their declarations and
lifecycle references from configuration files; existing reactions are
preserved.
files
26.10.0 stopped reading the v0.31 deployment configuration files
(memos-idp-*.json, memos-instance-setting-*.json) without a migration,
so an
instance that kept them through the upgrade gave no sign of it beyond
the
settings that had silently reverted. Startup now logs one warning naming
any
such files still present under /etc/secrets, without reading them, and
points
at the configuration directory.
Startup is now migrate, apply the configuration, then seed in demo mode,
the order in which comparable systems bootstrap identity before content.
Seed leaves store.Migrate and becomes a method the server calls after
applyConfigurationAtStartup.
The seed holds content only. The public demo access token and the
MEMO_RELATED row are gone; the reaction list belongs to the configuration.
Users are inserted without fixed ids and only when missing, their profile
fields are filled only where empty, and every memo, membership, reaction,
and attachment references its creator by username. A declared
administrator therefore keeps its row, credentials, and display name, and
the seeded content attaches to it. A bare --demo start without a
configuration seeds the same four users as before.
The seed test covers both starts and asserts the seed writes no instance
or user settings. Two stale lines of copy are fixed.
A configuration file may now declare which identity-provider subject signs
in as a declared user, as a fourth resource kind:
"linkedIdentities": [
{ "name": "users/admin/linkedIdentities/sso", "externalUid": "subject" }
]
An administrator on an SSO-only instance otherwise has no way in before the
first sign-in, which provisions a new account because the sign-in path
matches a provider and subject and nothing else. Matching an email or
username claim was rejected: neither proves ownership on this instance. A
declared subject trusts no claim, and the sign-in path is unchanged.
Rules: the user must be declared in the same configuration, a subject is
declared once, the provider must exist after apply, and a subject already
linked to a different user fails the plan rather than being taken over. A
link made by signing in with the declared subject is adopted; a different
stored subject is replaced. Links are written after users in the apply
transaction. A declared user with a declared link may be created without a
password; it gets an unusable random one, as SSO provisioning does.
The API refuses to create or delete a managed link, and to delete a
provider a declared link names. The account page hides Unlink for a
declared link. LinkedIdentity.external_uid is no longer output only.
The MCP catalog survived the recent API changes because it is derived
from OpenAPI, but three things drifted around it, and fixing them
surfaced a fourth.
- mcp: the adapter built each in-process API request with httptest,
whose fixed peer address (192.0.2.1) overrode the caller's resolved
address on the client-address middleware's second pass. Every
anonymous MCP caller shared one rate-limit bucket. The adapter now
presents the address resolved for the /mcp request as the peer.
- mcp: the full SpaceService is curated as space_* tools. Space and
member updates drop path-bound fields and rely on the gateway's
update-mask inference; accepting and declining an invitation no
longer require an empty body for a body: "*" binding whose only
field comes from the path.
- mcp/evals: answers re-pinned to the current seed (four users,
22 top-level memos, 35 reactions, four spaces) and extended with
space questions.
- store/sqlite: transactions begin IMMEDIATE. Token authentication
records the token's last-used time asynchronously on every request,
and the space drivers read before they write in a deferred
transaction; when the background commit landed in between, SQLite
refused the upgrade with SQLITE_BUSY without consulting the busy
timeout. Roughly half of space creates over MCP failed. Taking the
write lock up front keeps the parent-delete serialization the design
relies on, so the SQLite stale-snapshot test now asserts that a
concurrent delete waits for the open transaction instead.
An active application ADMIN now passes every memo-local authorization
check on named operations: authorship, audience, Space membership and
participation, attachment and reaction ownership. Structural validity
still applies, an archived admin holds no privilege, and collection
listings keep the audience predicate so feeds never surface other users'
private memos.
- core/access: admin bypass in the read policy; CanManageMemo and
CanManageAttachment as the shared author-level predicates.
- store: drivers read the actor's role alongside its lifecycle state in
the mutation transaction; validators accept an admin where they
required the author or a member; shared attachment binding and
removal predicates.
- api: handlers use the shared predicates; admins may place memos in
any existing Space and see a memo's Space by name.
- web: one canManageMemo helper replaces the ad hoc creator checks.
- docs: multi-spaces design revised in place; share RPC comments
updated.
Drop the D1 store driver, its migrations, emulator, design doc, filter
dialect, and test-harness wiring. Memos supports SQLite, MySQL, and
PostgreSQL only.
layout
Review follow-up for the D1 driver.
- LATEST.sql kept two index statements in one paragraph; the bridge
sends a
paragraph as one prepared statement, which D1 refuses. Separate them,
and
join buffered scripts in the sql adapter with a blank line so several
migration files commit over the bridge.
- List lookups by id, uid, and username bound one parameter per value
and
failed above D1's 100-parameter limit for pages larger than 100 rows.
Bind
the whole list as one JSON array through json_each instead, which also
replaces the uid resolution threshold and the chunk-and-resort paths.
- Write-policy validation now returns the memo state it read, and every
policy-checked write guards on exactly that state: memo update, memo
mutation, share creation, and attachment creation, update, and
deletion,
including the expected memo content and attachment bindings. Memo,
user,
and space deletion guard their pre-read row sets on count plus highest
id
so a row swapped for a newer one is caught.
- A 429 is no longer retried; the API rate limit that produces it blocks
the
caller for minutes.
- The reference Worker defaults a null result set to an empty array, and
the
comments claiming a batch never reads its own writes are corrected.
The emulator now judges statement boundaries with sqlite3_complete: a
bridge
entry or a parameterized REST entry holding two statements is refused
with
D1's message, and a parameter-free REST entry runs as a script. New
tests
interpose on the transport to change the database between a method's
reads
and its batch, apply the real schema over both transports, pin the
one-statement rule, and list by 250-entry id lists on every driver.