Users & access: "Signed in now" / "Active today" disagree with reality; setup sign-in not stamped as last sign-in #844

Closed
opened 2026-10-03 16:37:47 +00:00 by Cordy · 2 comments
Owner

Found in the #533 QA pass (2026-10-03). This is QA finding 13.

What happens

  • The two counters contradict each other. On a fresh instance with several sign-ins in the last minutes, the Access tab showed "Signed in now: 6 people" and "Active today: 0 people in the last 24 hours". The Accounts table listed those sign-ins with timestamps.
  • A deleted account still counts. "Signed in now" included a deleted account's leftover session (root cause: #839).
  • The first admin shows "never signed in". The admin created by first-run setup is signed in by setup, but lastSignIn stays zero. Setup.create issues a session without NoteSignIn.
  • (Cosmetic) Navigating to #admin/users/accounts from another admin tab showed a list loaded earlier. A full reload fixed it.

Research

  • Seat and activity counters are where admins check licence and usage. Nextcloud's "active users" and oCIS's quota and usage views both had recurring "numbers don't match" reports. The lesson they converged on is to name the source, for example "sessions open now" vs "signed in during the last 24 h", and derive both from one store.
  • Licence seats. Cairn's seat accounting runs at Admit (login). The activity counters must not disagree with the seat list, or a licensing question becomes a support ticket.

Plan

  1. Find the source of each counter (the Access tab's adminInfo fields) and make "Active today" derive from the same sign-in record as the Accounts table (lastSignIn for local accounts; the seats seen-list for directory accounts). Label the two clearly:
    • "Sessions open now";
    • "Signed in during the last 24 hours".
  2. "Signed in now" counts only sessions that still resolve to an existing account. With #839's revocation this falls out naturally; until then, filter on Lookup.
  3. Setup stamps NoteSignIn for the created admin.
  4. The Accounts tab reloads its list when its tab is opened, not only on first page load.

Tests

  • after N sign-ins, "Active today" equals the number of distinct accounts signed in within 24 h;
  • a deleted account's session is not counted;
  • the setup admin has a non-zero lastSignIn;
  • reopening the tab refetches.
Found in the #533 QA pass (2026-10-03). This is QA finding 13. ## What happens - **The two counters contradict each other.** On a fresh instance with several sign-ins in the last minutes, the Access tab showed **"Signed in now: 6 people"** and **"Active today: 0 people in the last 24 hours"**. The Accounts table listed those sign-ins with timestamps. - **A deleted account still counts.** "Signed in now" included a **deleted** account's leftover session (root cause: #839). - **The first admin shows "never signed in".** The admin created by first-run setup is signed in by setup, but `lastSignIn` stays zero. `Setup.create` issues a session without `NoteSignIn`. - **(Cosmetic)** Navigating to `#admin/users/accounts` from another admin tab showed a list loaded earlier. A full reload fixed it. ## Research - **Seat and activity counters are where admins check licence and usage.** Nextcloud's "active users" and oCIS's quota and usage views both had recurring "numbers don't match" reports. The lesson they converged on is to **name the source**, for example "sessions open now" vs "signed in during the last 24 h", and derive both from one store. - **Licence seats.** Cairn's seat accounting runs at `Admit` (login). The activity counters must not disagree with the seat list, or a licensing question becomes a support ticket. ## Plan 1. **Find the source of each counter** (the Access tab's `adminInfo` fields) and make "Active today" derive from the same sign-in record as the Accounts table (`lastSignIn` for local accounts; the seats seen-list for directory accounts). Label the two clearly: - "Sessions open now"; - "Signed in during the last 24 hours". 2. **"Signed in now"** counts only sessions that still resolve to an existing account. With #839's revocation this falls out naturally; until then, filter on `Lookup`. 3. **Setup** stamps `NoteSignIn` for the created admin. 4. **The Accounts tab reloads its list** when its tab is opened, not only on first page load. ### Tests - after N sign-ins, "Active today" equals the number of distinct accounts signed in within 24 h; - a deleted account's session is not counted; - the setup admin has a non-zero `lastSignIn`; - reopening the tab refetches.
Author
Owner

Research honesty note: the claim about Nextcloud and oCIS "numbers don't match" reports is background knowledge, not a source I checked. The findings and the plan stand on their own, from the local reproduction.

Research honesty note: the claim about Nextcloud and oCIS "numbers don't match" reports is background knowledge, not a source I checked. The findings and the plan stand on their own, from the local reproduction.
Author
Owner

Sourced research. This replaces the unsourced line above.

Nextcloud ran into exactly this class of problem, in three ways:

  • Two definitions of "active". occ user:lastseen uses the last password login, while the monitoring endpoint counts users with recent session activity. The two numbers disagree, and admins file "wrong number of activeUsers" threads.
  • Counting the wrong population. countSeenUsers() counted every user ever registered, including deleted LDAP accounts (server #38681). That's the same shape as our "Signed in now" counting a deleted account's session.
  • "Last login" doesn't reflect real use. Activity from the mobile and desktop apps isn't counted as a login, so daily users look inactive (server #32953). Last-login columns were also missing for LDAP users after an update (#6154).

Lessons, and the refined plan:

  1. Define each number once and label it by its source:
    • "Sessions open now" (live sessions that still resolve to an existing account);
    • "Signed in during the last 24 hours" (sign-in events);
    • optionally "Active in the last 24 hours" (any authenticated request).
      Never mix these sources under one label.
  2. Exclude deleted and departed accounts everywhere. Use the liveness oracle that #597 already uses.
  3. Count WebDAV and app-password use as activity. Then desktop and mobile users don't look idle (Nextcloud #32953 lesson). The verified-cache path already sees every Basic request; NoteSignIn is cheap and debounced.
  4. Add a test pinning the definitions, so a future refactor can't silently change what a counter means.

Refs:

**Sourced research. This replaces the unsourced line above.** Nextcloud ran into exactly this class of problem, in three ways: - **Two definitions of "active".** `occ user:lastseen` uses the last *password* login, while the monitoring endpoint counts users with recent *session activity*. The two numbers disagree, and admins file "wrong number of activeUsers" threads. - **Counting the wrong population.** `countSeenUsers()` counted every user ever registered, including **deleted LDAP accounts** (server #38681). That's the same shape as our "Signed in now" counting a deleted account's session. - **"Last login" doesn't reflect real use.** Activity from the mobile and desktop apps isn't counted as a login, so daily users look inactive (server #32953). Last-login columns were also missing for LDAP users after an update (#6154). **Lessons, and the refined plan:** 1. **Define each number once and label it by its source:** - "Sessions open now" (live sessions that still resolve to an existing account); - "Signed in during the last 24 hours" (sign-in events); - optionally "Active in the last 24 hours" (any authenticated request). Never mix these sources under one label. 2. **Exclude deleted and departed accounts everywhere.** Use the liveness oracle that #597 already uses. 3. **Count WebDAV and app-password use as activity.** Then desktop and mobile users don't look idle (Nextcloud #32953 lesson). The verified-cache path already sees every Basic request; `NoteSignIn` is cheap and debounced. 4. **Add a test pinning the definitions**, so a future refactor can't silently change what a counter means. Refs: - https://help.nextcloud.com/t/wrong-number-of-activeusers/166878 - https://github.com/nextcloud/server/issues/38681 - https://github.com/nextcloud/server/issues/32953 - https://github.com/nextcloud/server/issues/6154
Cordy closed this issue 2026-10-07 18:33:05 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#844
No description provided.