Skip to content

feat: opt-in server-only bot user provisioning - #64

Open
smvrnn wants to merge 1 commit into
vcode-sh:mainfrom
smvrnn:feat/bot-provisioning
Open

smvrnn wants to merge 1 commit into
vcode-sh:mainfrom
smvrnn:feat/bot-provisioning

Conversation

@smvrnn

@smvrnn smvrnn commented Nov 22, 2026

Copy link
Copy Markdown

What fresh chaos is this?

Adds opt-in, server-only user provisioning from Telegram updates already verified by the host's bot. botProvisioning: true registers a pathless SERVER_ONLY auth.api.provisionTelegramUser operation that creates or resolves a user and returns { userId } without a session. It adds no HTTP route, is off by default, and changes nothing for setups that don't enable it. Also exports validateTelegramBotOwnership for OIDC link protection. Full guide: Bot provisioning.

Nature of the beast

  • Bug fix (something was broken and you, heroically, fixed it)
  • New feature (you added something nobody asked for but everyone needed)
  • Breaking change (you chose violence)
  • Documentation update (the rarest contribution in open source)
  • Refactoring (you moved things around and called it progress)

The bare minimum

  • Tests pass (npm test) -- yes, all of them (373 passed)
  • Types check (npm run type-check) -- TypeScript is not optional here
  • Lint passes (npm run lint) -- Biome has no feelings to hurt
  • Changed behavior has meaningful protection; added tests name the defect they catch (6 integration tests: opt-in registration, malformed input, server-only guard, autoCreateUser: false, idempotent provisioning, OIDC ownership conflict)
  • Existing coverage floors pass; uncovered risks were reviewed without padding tests (98.62% statements, 95.95% branches, 100% functions)
  • Docs updated (README, configuration, API reference, security, new guide)
  • CHANGELOG.md updated (under [Unreleased])

Proof of life

Verified behavior: repeat provisioning returns the same user and creates no session; OIDC sign-in reuses that user; a signed-in user cannot link an OIDC identity owned by a provisioned user; malformed bodies and request-carrying calls are rejected with stable BOT_PROVISIONING_* codes; the operation is absent when botProvisioning is off.

Commands run: npm run lint, npm run lint:fix, npm run type-check, npm test, npm run test:coverage, npm run build (publint + attw), npm run test:types, npm run test:package. All passed.

Unproved boundaries: real database adapters, provisioning concurrency across several servers, and live Telegram updates. The host must verify updates and authenticate callers; the plugin does neither by design. No version bump is included: releases are tagged by the maintainer, and the user-facing change is recorded under [Unreleased].

Relevant wreckage

None linked.

Adds `botProvisioning` with a pathless SERVER_ONLY `provisionTelegramUser` operation, an opt-in OIDC link ownership validator, documentation and integration tests. Disabled by default; existing setups are unchanged.
@smvrnn
smvrnn requested a review from vcode-sh as a code owner November 22, 2026 10:10
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.

1 participant