Count rotations as active days, and leave the seeded operator out of the KPI feed #361

Merged
cruelacid merged 2 commits from worktree-kpi-rotation-days into main 2026-11-28 10:14:43 +00:00
Owner

Task: NEC-401

Two KPI corrections found while reading "days seen" for a customer.

  • Rotations count as active days. A shard's devices.last_seen moves only when a device connects, so a desktop left syncing for a week read as one active day. The collector now also records the day of each identity session's last rotation (the plugin rotates at least hourly while it runs), as a union with the connect days. Counted from 27 Nov 2026; the schema comment and the active-users panel description say so, and the dashboard JSON is regenerated.
  • The seeded operator leaves the shard's KPI feed. The instance admin from ADMIN_USERNAME (shard:bc664ee2 on eu1) read as a person on the leaderboard and a one-member organisation. It is excluded from users, members, folder members and invites, and an organisation it alone belongs to is excluded with its folders. A pre-identity user who is not an instance admin, and a hosted user of any role, are still reported.

Both rules are tested and mutation-checked: removing the rotation union fails the collector test, and each of the eight server exclusions, inverted in turn, fails the server test.

The rest of NEC-401 (the last-active view and panel) is not in this PR.

After merge: manual steps

  1. The server change reaches eu1 when main promotes :stable.
  2. rsync deploy/clconsole/kpi/ to clconsole:kpi/ (excluding data, backups, .env) so the collector and dashboard pick up the rotation days.

Changelog

NONE

🤖 Generated with Claude Code

https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg

Task: NEC-401 Two KPI corrections found while reading "days seen" for a customer. - **Rotations count as active days.** A shard's `devices.last_seen` moves only when a device connects, so a desktop left syncing for a week read as one active day. The collector now also records the day of each identity session's last rotation (the plugin rotates at least hourly while it runs), as a union with the connect days. Counted from 27 Nov 2026; the schema comment and the active-users panel description say so, and the dashboard JSON is regenerated. - **The seeded operator leaves the shard's KPI feed.** The instance admin from `ADMIN_USERNAME` (`shard:bc664ee2` on eu1) read as a person on the leaderboard and a one-member organisation. It is excluded from users, members, folder members and invites, and an organisation it alone belongs to is excluded with its folders. A pre-identity user who is not an instance admin, and a hosted user of any role, are still reported. Both rules are tested and mutation-checked: removing the rotation union fails the collector test, and each of the eight server exclusions, inverted in turn, fails the server test. The rest of NEC-401 (the last-active view and panel) is not in this PR. ## After merge: manual steps 1. The server change reaches eu1 when `main` promotes `:stable`. 2. rsync `deploy/clconsole/kpi/` to `clconsole:kpi/` (excluding `data`, `backups`, `.env`) so the collector and dashboard pick up the rotation days. ## Changelog NONE 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg
A shard's last_seen moves only when a device connects, so a desktop left
syncing for a week counted as one day: the paying customer read 19 days
seen while their Windows plugin was rotating hourly on a day it did not
count. A signed-in plugin rotates at least hourly while it runs, and the
collector already receives every session's last_used_at, so each run now
records that day too. The union of the two can only find days the other
missed, never invent one.

Rotations are kept only as their latest value, so the days count from
27 Nov 2026; the schema comment and the active-users panel say so.

Task: NEC-401

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg
Leave the seeded operator out of the shard's KPI feed
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 4m43s
CI / e2e (pull_request) Successful in 17m19s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 5m4s
CI / e2e (push) Successful in 17m13s
CI / promote (push) Successful in 44s
e3b65e31eb
The instance admin seeded from ADMIN_USERNAME at every start was reported
as a person: `shard:bc664ee2` on eu1, holding a seat on the leaderboard and
a one-member organisation in the sizes. It is the account admin-token.mjs
and verify-scrubber.sh sign in as, and the seed recreates it, so it cannot
be deleted. The feed now leaves it out, with any organisation it alone
belongs to and that organisation's folders. A pre-identity user who is not
an instance admin is still reported, as is a hosted user of any role.

Task: NEC-401

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MY63BZ4UVtMHFcADNr1jFg
Sign in to join this conversation.
No reviewers
No milestone
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
Nectenda/nectenda!361
No description provided.