Skip to content

[RFE] Support multiple key holders per key #52

Description

@alronova

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.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions