src-cli icon indicating copy to clipboard operation
src-cli copied to clipboard

Tracking: TODOs `src users clean`

Open DaedalusG opened this issue 2 years ago • 5 comments

This is a tracking issue for the forthcoming src users clean command: https://github.com/sourcegraph/src-cli/pull/826

TODOS

  • Add an email functionality to email removed users, open vim editor like in git commit
  • Write json file containing users to be deleted, last active usage, site-admin status, and emails. This is so that admins can potentially do their own programmatic analysis around who would be removed before removing users

DaedalusG avatar Sep 01 '22 05:09 DaedalusG

  • Processing work for this command should be moved to the Sourcegraph instance to prevent lots of data transfer over network. In instances with many users the current graphQL request takes way too long to process. For more details see comment from @mrnugget in initial PR

DaedalusG avatar Sep 08 '22 08:09 DaedalusG

User feedback:

  • provide -dry-run option which outputs the list of users to be deleted (this may be addressed by the json output bullet)
  • provide an input method for users to specify a list of users explicitly not to be deleted

DaedalusG avatar Sep 13 '22 19:09 DaedalusG

User feedback (from account #8247)

  • Allow users to pass a value <60 via the -days flag (customer in question does clean-up every 2 weeks)

hopkinscl avatar Sep 28 '22 21:09 hopkinscl

Hey @hopkinscl the 60 days constraint was a condition to release this provided by @ryphil -- originally rhe command allowed any value for days, but the idea was to prevent admins from using this too frequently. Happy to change that if its not a major concern.

DaedalusG avatar Sep 30 '22 16:09 DaedalusG

Opened an issue to inform on gateway timeout problem, and track improvements planned in this area: https://github.com/sourcegraph/src-cli/issues/848

DaedalusG avatar Sep 30 '22 16:09 DaedalusG

  • Move away from use of usageStatistics graphQL endpoint to use of the new aggregated_user_statistics table: https://github.com/sourcegraph/sourcegraph/pull/40301

Currently users who have never been active or have not been active for 93 days will have a null value for lastActiveTime in the graphQL userStatistics endpoint this causes difficulties and confusion in the cleanup script

event_logs only stores a record for 93 days and lastActiveTime is determined from the last event_logs entry associated to a user -- lastActiveAt is recorded in the aggregated_user_statistics table from event_logs but its then persisted there.

Not its unclear wether or not this will help at all with the timing out network request noted in https://github.com/sourcegraph/src-cli/issues/848

DaedalusG avatar Nov 24 '22 01:11 DaedalusG

One of the customer has requested if we can allow less than 60 days in -days flag.

Account related thread

rakeshjosh2003 avatar May 10 '23 03:05 rakeshjosh2003