Notes

We keep the join key before we ever need it

Your account id is issued by our sign-in provider. If we ever change provider, matching old ids to people needs a key, so we record it now, on every event.

Every site on juudd belongs to an account, and the account id is written into a durable record next to the site. That id comes from our sign-in provider. If we ever changed provider, nothing in the store could say which new person each old id was. So from the start we keep the one thing that could: the email and issuer the sign-in token already carries, written down with every event.

That is the decision. The rest of this post is why we did not take the bigger options, and what the record does and does not do.

Leaving a vendor is a question about the store, not the code

We keep the sign-in provider. Replacing it would mean running an authorization server that outside clients such as claude.ai federate with, and the failures there are the quiet kind: a token accepted for the wrong audience, a check that is not really checked. We would rather those be someone else's problem.

So the useful question was the one we ask of every vendor: how do we leave?

The code is not where the lock-in is. The sign-in handling is about two hundred lines of ordinary OAuth, and pointing it at another provider is an afternoon. The lock-in is in the records. An account is user:<sub>, where sub is an identifier the provider issued, and that string sits inside each site's owner record and each account's billing record. A vendor's identifier had become part of the durable shape of the system.

The hard half is the join

Rewriting the records is a script. The hard half is the join: given an owner record that says user:<old sub>, which person at the new provider is that?

Nothing in the store answered it. The owner record held the subject and the date and nothing else. The only way to build the map is to match on something both providers know about the same human, in practice an email address, and that has to happen while both providers still exist. A migration that starts after the old tenant is gone has no join key and no way to recover one.

Five options, and the one we took

The ADR weighs five. In short:

  • Do nothing, and improvise the join when the day comes. That day is the one where "we will match them on email somehow" is not a plan.
  • Full indirection: our own account ids, resolved on every request. It is complete, and it adds a read to every call, plus a record whose absence is a lockout rather than a refusal.
  • Derive the account from the email. Rejected: people change email, and ownership of a site would move silently under a customer whose credentials are all valid.
  • Name the provider in the id. It makes a future store legible, and costs a rewrite of every record on its own.
  • Keep the join key, and change nothing else.

We took the last. The token already carried the email; our verifier was throwing it away on every request. Nothing needed to be collected. It needed to stop being deleted.

Where it is kept

Not in a new record. Every event the platform writes already has an identity field, and the code that fills it names three fields on purpose: sub, email and issuer. It does not copy the whole token, so a credential cannot leak into the record by accident. If a token carries none of them, the field is left out rather than written as an empty object, because an empty object would claim the token carried nothing.

The email is written down and never used to decide anything. An account is still user:<sub> and nothing else, and the gate that decides who may act never reads the email. The two are kept apart in the code so that nobody is tempted to join them. Authorising on an address is the failure the account design was built to avoid.

What is not claimed

  • The ADR could not know whether a token minted for an assistant connection carries an email. The panel's does, because we ask for it. So the record is reliable for people who have signed in to the panel, and possibly thin for someone who only ever uses an assistant. A thin identity on an event is itself the evidence of that.
  • Nothing has been migrated and nothing is planned. This is insurance, not a project.
  • The ADR says plainly that there is no deadline and no window to miss, and that the records accumulate whether or not anyone decides. Deciding early was the argument: it is strictly one-directional, and this is the cheapest it will be.

The rule, once

Keep the key that would let you leave a vendor while both vendors still exist: record the email and issuer on every event, never authorise on them, and leave the account id exactly as it is. The tools and their limits are listed in the docs.