Files
pad/internal
xarmian be68292e03 fix(store): workspace list freshness reflects item activity (BUG-1481) (#559)
`pad workspace list` was showing `workspaces.updated_at`, which only
moves on workspace-row mutations (rename, settings, members). After
this fix the effective UpdatedAt surfaces item activity inside the
workspace — answering "where is work happening?" instead of "when was
this row last UPDATEd?".

Implementation: scalar `MAX(items.updated_at)` subquery in
`ListWorkspaces` and `GetUserWorkspaces`, then `effectiveWorkspaceUpdatedAt`
picks the later of the two timestamps (portable across SQLite +
Postgres, no GREATEST). Read-time approach per the bug's design notes.

Visibility-aware: codex review surfaced that a naive MAX leaks activity
timing for items the caller can't see. The member subquery mirrors
`VisibleCollectionIDs` (`collection_access='all'` short-circuits; for
`'specific'` members, system collections + `member_collection_access`
+ `collection_grants` + `item_grants` gate visibility). The guest
subquery limits MAX to items reachable via `collection_grants` /
`item_grants`. All grant lookups are workspace-scoped for
defense-in-depth.

Four regression tests cover: admin `ListWorkspaces`, member
all-access, member specific-access leak guard, and guest leak guard.
2026-05-15 12:30:07 -04:00
..
2026-03-26 01:52:36 +00:00