mdgspace / mdgspace/bot

[RFE] Support multiple key holders per key

Open
#52 0 comments 0 reactions 1 assignee View on GitHub

@dhairyathareja1 is already working on this.

Since Sep 1, 2026.

enhancement
Dominant language
TypeScript
Stars
19
Forks
20
Avg merge
29m
Merged PRs (30d)
2

Description

Summary

Currently the keys system tracks a 1-to-1 mapping — each key entry maps one owner to one holder. In practice, lab keys are often held by multiple people at the same time (e.g., two people share responsibility, or one person temporarily hands a spare to a friend).

Current behavior

Each key entry is a single {holder, owner} pair. If Alice already holds Ravi's key and Bob also picks it up, the bot has no way to record Bob without losing Alice's entry.

Alice: "i have keys of ravi"    →  { holder: "Alice", owner: "ravi" }
Bob:   "i have keys of ravi"    →  { holder: "Bob",   owner: "ravi" }   ← separate entry, both tracked

This technically works today (multiple entries per owner), but the "who has keys" and "who has ravi's keys" queries list each entry separately, and "i don't have keys" only removes the first matching entry. There's no concept of a key set for a single owner.

Proposed behavior

  • Treat each owner's key as a set of holders, not individual entries.
  • bot who has keys should show something like:
    ravi's keys are with Alice, Bob
    
  • bot ravi has keys should add the sender to the existing holder set (not create a duplicate entry).
  • bot i don't have keys should remove only the sender from the holder set.
  • bot i gave keys to Bob should transfer all of the sender's held keys to Bob (or add Bob if the intent is sharing).
  • bot who has ravi's keys should list all holders in one message.

Why

  • Lab key management is a shared responsibility — multiple people hold keys at once.
  • The current flat-list model makes it easy to create duplicates and hard to get a clean overview.
  • A set-based model matches how keys actually work in the lab.

Acceptance criteria

  • Adding a holder to an existing owner appends to the holder list (no duplicates).
  • Removing a holder only removes that person, leaving others intact.
  • Querying keys shows a consolidated list per owner.
  • Existing tests in test/migration-regressions.js continue to pass.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.