Skip to content

feat: support multiple holders for numbered lab keys - #57

Open
dhairyathareja1 wants to merge 3 commits into
mdgspace:masterfrom
dhairyathareja1:feat/multiple-key-holders
Open

dhairyathareja1 wants to merge 3 commits into
mdgspace:masterfrom
dhairyathareja1:feat/multiple-key-holders

Conversation

@dhairyathareja1

@dhairyathareja1 dhairyathareja1 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #52.

  • Track multiple holders per key without duplicates: k0 is the master key, and further kN keys are created as needed. Commands without a key number use a separate unknown group.

  • Show all holders together in key queries, with commands to remove or transfer holdings.

  • Preserve old owner-based records for recovery; numbered-key holders start empty for manual assignment in Slack.

Key-handling commands

k0 is the master key. Add any number of numbered keys (k1, k2, etc.). If the key number is unknown, the holder is recorded
under unknown—it is never assumed to be k0.

List holders

  • bot who has keys — list all recorded keys and their holders
  • bot who has k1 — list holders of a specific key (k0, k1, k2, etc.)
  • bot who has unknown keys — list holders whose key number is unknown

Add a holder

  • bot i have k1 — add yourself as a holder of a numbered key
  • bot @alice has k1 — add someone else as a holder of a numbered key
  • bot i have keys — add yourself under unknown
  • bot @alice has keys — add someone under unknown
  • bot @alice has unknown keys — explicitly add someone under unknown

You can use a person’s Slack username or display name instead of @alice. If the name matches multiple people, make it more specific.

Remove yourself

  • bot i don't have k1 — remove yourself from a numbered key
  • bot i don't have unknown keys — remove yourself from unknown
  • bot i don't have keys — remove yourself from all recorded keys

Transfer keys you hold

  • bot i gave k1 to @alice — transfer one numbered key
  • bot i gave unknown keys to @alice — transfer your unknown assignment
  • bot i gave keys to @alice — transfer all your recorded key assignments

@alronova

Copy link
Copy Markdown
Member

here are few findings to take reference:

  1. Messages that end in ? or . no longer get a reply (src-ts/keys.ts:200-265). Every pattern now has to match all the way to the end of the message. On master, bot who has keys? worked; now it gets no reply at all. I checked this directly:
    • who has keys?, who has the keys ?, who has k1? and i have k1. match nothing.
    • People naturally type "who has keys?", so this will look like the bot is broken.
    • Fix: allow trailing punctuation and spaces before the end, e.g. \s*[?.!]*$.
  2. Only the holder can remove themselves from a key. Anyone can add anyone (bot bob has k1), but the only ways to remove someone are i don't have … and i gave … to …, which only act on the sender. Now that a key can have several holders, a new assignment no longer replaces the old one. So these records can't be cleaned up:
    • a mistaken assignment, unless the wrongly-listed person fixes it themselves;
    • a member who has left or graduated;
    • a mistyped key like k71, which stays in who has keys forever as "no holders recorded", since empty keys are never removed.

I'd Suggest adding bot <name> doesn't have k1 (and maybe a way to drop an empty key).
Also,

  • instead of unknown, replace it with kx
  • keep the upper limit of keys fixed (ig the total is 9 or 10)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFE] Support multiple key holders per key

2 participants