Commit Graph
58 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 c99aa6908d feat(entitlements): Staff preview grants for products not for sale yet
ci / test (pull_request) Successful in 25m20s
ci / image (pull_request) Skipped
ci / shared (pull_request) Successful in 12s
Lets BreakPilot staff open a product that is still disabled in the
catalogue (Werkmeister) for one tenant for a limited time, e.g. a seeded
staging tenant for portal#86, without a stage/prod divergence:

- Migration 0018: tenant_products.preview and preview_expires_at, kept
  apart from a booking's expires_at.
- Entitlement check: a disabled product is allowed only under an active
  preview (answer carries "preview": true); expiry is enforced at check
  time (reason preview_expired). A leftover plain row of a product off
  sale stays unknown_product.
- A real booking (ERP, trial, catalogue upsert) clears the preview and
  its expiry, so it never cuts off a paid entitlement; a preview over a
  booking is refused (409).
- Usage under a preview is accepted, tagged properties.preview=true and
  kept out of the ERP outbox; claims list a preview product only while
  it is active.
- Staff only, audited: POST /v1/admin/tenants/{id}/preview-grants
  {product, expires_at ≤ 180 d}, DELETE …/preview-grants/{product}; a
  named staff member (X-Staff-Subject) is required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 01:25:04 +02:00
sharang 5b4590d3bc feat(api-keys): CI licences by API key and integration keys (#71)
ci / shared (push) Successful in 13s
ci / image (push) Successful in 36s
ci / test (push) Successful in 25m10s
2026-10-13 22:12:05 +00:00
sharang 97284b5008 feat(api-keys): Scope catalogue, kinds, expiry and sha256 keys (#70)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m3s
ci / image (push) Successful in 39s
2026-10-13 21:21:16 +00:00
sharang 1d3b5ebbc5 feat(catalog): Add werkmeister as a draft product, not for sale (#69)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 24m24s
ci / image (push) Successful in 36s
2026-10-13 20:36:02 +00:00
sharangandSharang Parnerkar 271c23e5f2 fix(erpsetup): restore the letter head source, ignore <tbody> from UI saves (#68)
ci / image (push) Successful in 35s
ci / shared (push) Successful in 14s
ci / test (push) Successful in 28m11s
## What
- The letter head step also compares `source` and `footer_source` (want: HTML/HTML).
- `ensureFields` treats `<tbody>`/`</tbody>` as equal (Frappe's HTML editor adds them on a UI save).

## Why
Live ERPNext letter head `BreakPilot` (last saved 2026-10-06 09:19 in the UI): `source = Image`, so documents use an image header instead of our HTML one, plus `<tbody>` in content and footer. The dry run showed `letter head → would update` on every run, and an apply would not have restored `source`.

## Test plan
- [x] New test: tbody-only difference → `exists`; source Image → restored to HTML.
- [x] Existing erpsetup tests.
- [ ] User: dry run shows `letter head → would update` once, apply, then `exists`; check one invoice PDF shows the HTML header.

## Risk
**Blast radius:** Letter Head `BreakPilot` only (source fields). **Rollback:** set source back in the UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #68
2026-10-13 09:23:40 +00:00
sharangandSharang Parnerkar 8e2d8db4bf feat(erpsetup): cost centers per product, deferred revenue for yearly items (#67)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m45s
ci / image (push) Successful in 37s
## What
erpsetup gets two accounting steps (new `internal/erpsetup/accounting.go`), run after the contract-basis fields:

**A1: cost centers**
- Creates Plattform, Prüfwerk, Firmwerk, Werkpilot, Infrastruktur and Verwaltung below the company's root cost center.
- Makes **Verwaltung** the company default. `Main` is kept, not renamed.
- Gives every SKU its product's **selling cost center** in its Item Defaults row for the company:
  - PLT → Plattform
  - CRA (Prüfwerk + Werkbank) → Prüfwerk
  - DEV-FWK → Firmwerk
  - DEV-WP → Werkpilot
  - INF (Managed Git + build runners) → Infrastruktur
- Other Item Defaults rows and other fields of the company's row (e.g. an income account) are kept.

**A2: deferred revenue**
- The 12 yearly items (`Jahr`: Werkpilot, Firmwerk, Managed Git and build-runner On-Prem) get `enable_deferred_revenue` over **12 months**.
- The company's default deferred revenue account becomes **SKR04 3900** (looked up by account number, never created). If it's missing, the deferral steps are skipped and reported as `missing (not created)`.
- Accounts Settings release the deferral **monthly as Journal Entries that stay drafts** (`submit_journal_entries = 0`): a person checks and submits them.

## Why
These follow the decisions with the tax advisor on 2026-10-12 (Collectives ERP/07):
- Cost centers live in ERPNext only, with no KOST1 in DATEV. They give a P&L per product.
- Yearly licences are deferred, so the monthly ERPNext P&L can be compared with her BWA. She books the RAP at year end in DATEV.

## How
- The cost-center and account names carry the company abbreviation, which is read from the Company.
- Item Defaults are PUT as the full table, because rows left out would be deleted.
- Idempotent and dry-run capable like the other steps; nothing is submitted.

## Test plan
- [x] Unit tests (fake Frappe):
  - cost centers and their parent
  - company defaults
  - Accounts Settings
  - cost center per SKU, deferral only on yearly items
  - existing Item Defaults rows and fields are kept
  - a missing 3900 skips the deferral
  - a missing company stops the run
- [x] Second run is a no-op; the dry run writes nothing.
- [ ] `erpsetup -dry-run` against live ERPNext (user): check that `deferred revenue account 3900` resolves, and expect 6 cost centers, 2 company fields, the Accounts Settings and 34 items as `would create`/`would update`.
- [ ] Apply, then spot-check one Werkpilot On-Prem item and one Prüfwerk item in ERPNext.

## Risk
**Blast radius:** live ERPNext master data: cost centers, company defaults, Accounts Settings, Item Defaults and deferral flags on the 34 SKU items. No transactions are touched.

**What could break:**
- New Sales Invoices for yearly items now need a service start and end date (ERPNext fills them from the posting date and the 12 months). Monthly items are unchanged.
- A Journal Entry draft appears each month for open deferrals.

**Rollback plan:** in ERPNext:
- set the company default cost center back to Main
- untick deferred revenue on the 12 yearly items
Cost centers can stay. Nothing is submitted by this change.

## Checklist
- [x] Docs updated (package doc; Collectives ERP/06 gets the cost-center note after the apply)
- [x] Audit events emitted for state changes (n/a: ERP master data)
- [x] Secrets via Infisical, never in repo (no secrets)
- [x] Migration is forward-only + idempotent (no migration; erpsetup is idempotent)
- [x] Tenant scoping enforced on every DB query (no DB access)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #67
2026-10-13 09:02:58 +00:00
sharangandClaude Opus 5.5 557fbf85f5 feat(server): public GET /version with build version and commit (#63)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 24m47s
ci / image (push) Successful in 39s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-05 19:51:40 +00:00
sharangandClaude Opus 5.5 1f6236a754 feat(members): team management: role, block, remove, revoke, resend (#64)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 24m46s
ci / image (push) Successful in 33s
portal#74: PATCH/DELETE /v1/tenants/{id}/members/{uid}, POST .../resend and the staff variants; per-workspace block via org_blocked, session logout, last-admin and self guards, audit events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-05 18:43:31 +00:00
sharang 8753305ad4 feat(services): build runners INF-CI-* and managed service kind ci-runner (#62)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 24m26s
ci / image (push) Successful in 36s
2026-10-05 18:06:49 +00:00
sharangandClaude Opus 5.5 85934567f1 feat(services): managed services per tenant for the portal (#77) (#61)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 24m12s
ci / image (push) Successful in 35s
ci / shared (pull_request) Successful in 14s
ci / test (pull_request) Successful in 24m17s
ci / image (pull_request) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-04 19:33:20 +00:00
sharangandClaude Opus 5.5 5668895055 feat(erpsetup): Managed Git items INF-GIT-CLD/OPR-STD/BUS/ENT (#60)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 24m12s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-04 19:07:36 +00:00
sharangandClaude Opus 5.5 6141e45811 feat(erpsetup): AB and invoice after the legal review (#59)
ci / test (push) Successful in 24m9s
ci / shared (push) Successful in 12s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 16:26:47 +00:00
sharangandClaude Opus 5.5 60f20e6419 feat(trial): legal trial signup: offer, confirmation, activation (#58)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m58s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 16:00:52 +00:00
sharangandClaude Opus 5.5 f0e1f52838 feat(legal): mails link the platform's privacy notice (#57)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m41s
ci / image (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 15:07:30 +00:00
sharangandClaude Opus 5.5 5f7a383ea8 fix(erpsetup): letter head shows only contact details top right (#56)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m51s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 14:47:43 +00:00
sharangandClaude Opus 5.5 7e75fbafb3 fix(erpsetup): logo as a private File, PDFs work again (#55)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m44s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 13:32:48 +00:00
sharangandClaude Opus 5.5 2c365b9b3d fix(erpsetup): domestic customer address without capitals and country (#54)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m41s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 12:20:07 +00:00
sharangandClaude Opus 5.5 fb241befcc fix(erpsetup): letter head and footer in the print template, chevron as PNG (#53)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m53s
ci / image (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 11:48:16 +00:00
sharangandClaude Opus 5.5 fb9a2ee621 feat(erp): overdue invoices drive the ladder from the reconcile pass (#52)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m47s
ci / image (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 11:06:30 +00:00
sharangandClaude Opus 5.5 40a198c56f feat(erpsetup): BreakPilot document layout and list prices (#51)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m50s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 10:44:03 +00:00
sharangandClaude Opus 5.5 c33ae65342 fix(erp): webhook templates and usage datetimes for the live ERPNext (#49)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m40s
ci / image (push) Successful in 49s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-30 08:43:17 +00:00
sharangandClaude Opus 5.5 8a03be188d feat(erpsetup): sales catalogue — SKU items, units, SEPA mandate fields (#48)
ci / image (push) Successful in 34s
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m42s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-29 16:25:00 +00:00
sharangandClaude Opus 5.5 f96525dd4d fix(projects): name the portal user in project audit events (#47)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 23m47s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-29 14:50:38 +00:00
sharangandClaude Opus 5.5 f3450f84c7 feat(projects): Projekte for documents and product objects (#46)
ci / shared (push) Successful in 13s
ci / image (push) Successful in 35s
ci / test (push) Successful in 23m41s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-29 12:49:36 +00:00
sharangandClaude Opus 5.5 874c399e31 feat(mail): company signature for the no-reply sender (#45)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m27s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-29 11:04:43 +00:00
sharangandClaude Opus 5.5 b424e001dc fix(storage): bound the upload part size so uploads don't OOM the registry (#44)
ci / test (push) Successful in 23m21s
ci / image (push) Successful in 35s
ci / shared (push) Successful in 13s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-28 09:21:07 +00:00
sharangandClaude Opus 5.5 485f3432ac fix(keycloak): keep email and names when writing user attributes (#43)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m29s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-28 07:44:45 +00:00
sharangandClaude Opus 5.5 e8dcd1d259 feat(admin): repair a tenant's sign-in, delete an archived tenant (#42)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 23m50s
ci / image (push) Successful in 45s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-26 11:00:14 +00:00
sharangandClaude Opus 5.5 3aa1a8cb8d fix(mail): accurate and grammatical new-findings mail (#41)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m35s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-25 22:03:49 +00:00
sharangandClaude Opus 5.5 b0ba984793 feat(mail): the website's palette and wordmark in the notification mails (#40)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 23m24s
ci / image (push) Successful in 38s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-25 21:23:12 +00:00
sharangandClaude Opus 5.5 7834907562 fix(signup): report when Keycloak refuses to send the invitation (#39)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 25m6s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-24 11:50:23 +00:00
sharangandClaude Opus 5.5 fb8a6b3902 fix(erpsetup): name the Frappe webhooks (#38)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m20s
ci / image (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-24 10:34:09 +00:00
sharangandClaude Opus 5.5 0a26331ffd fix(signup): reject an email that already has an account (#37)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 23m29s
ci / image (push) Successful in 32s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-23 22:09:00 +00:00
sharangandClaude Opus 5.5 25419c48b3 fix(erpsetup): let the registry's API user append usage records (#36)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 23m25s
ci / image (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-23 21:36:36 +00:00
sharangandClaude Opus 5.5 e0bff8c793 feat(notify): branded mails for published documents and new findings (#35)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 23m16s
ci / image (push) Successful in 36s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-23 21:10:06 +00:00
sharangandClaude Opus 5.5 8d3cda4bb0 feat(documents): tenant documents with staff upload and signed downloads (#34)
ci / test (push) Successful in 23m15s
ci / shared (push) Successful in 12s
ci / image (push) Successful in 31s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-23 20:31:55 +00:00
sharang 54e9f6a720 feat(admin): staff tenant list, detail, trial extension, invite resend (#33)
ci / shared (push) Successful in 11s
ci / test (push) Successful in 22m43s
ci / image (push) Successful in 44s
2026-09-23 19:57:59 +00:00
sharang ceeff16f26 feat(erp): erpsetup for live ERPNext, reserved tenant slugs (#32)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 22m58s
ci / image (push) Successful in 37s
2026-09-23 17:16:24 +00:00
sharangandClaude Opus 5 13da983d1e feat(llmkeys): allow Qwen3.8-27B on tenant LiteLLM keys (#31)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 22m20s
ci / image (push) Successful in 26s
Add Qwen3.8-27B to the default LITELLM_MODELS allowlist for per-tenant LiteLLM keys. Existing keys are updated separately via LiteLLM /key/update.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKb71CELE4iptE9em1ZEgv
2026-09-18 18:51:28 +00:00
sharang 33ba32ef30 fix(keycloak): resolve an organization by alias, not by display name (#30)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 22m28s
ci / image (push) Successful in 25s
2026-09-14 11:30:00 +00:00
sharangandSharang Parnerkar e0ae19f2a7 feat(licences): per-tenant LiteLLM key with a Werkpilot grant (#29)
ci / shared (push) Successful in 11s
ci / test (push) Successful in 22m23s
ci / image (push) Successful in 24s
Demonstration plan, phase D6 (registry side). A prospect trialling Werkpilot had no model access until someone created a LiteLLM key by hand. The registry issues one with the licence, scoped and budgeted per tenant.

**On issue** (`product=werkpilot`): `POST /key/generate` on LiteLLM with `key_alias = werkpilot-<slug>-<licence id>`, `metadata` carrying tenant id/slug/licence/product, the model list and the plan's budget (trial and default, USD per 30 days). LiteLLM's hashed token id goes on the `licences` row (migration `0007`, exposed as `llm_key_id` on `GET /v1/licences`); the `sk-…` secret is returned in that one response as `llm_api_key`, together with `llm_base_url`, and is never stored or returned again.

**On renewal** (licence heartbeat): the existing key moves to the new licence row rather than a second key being generated — the secret cannot be re-read, and the CLI still holds the one it stored.

**On revoke:** the key is deleted; a 404 from LiteLLM is treated as already gone. If the delete fails, the licence is still revoked and the key id stays on the row so it can be retried by hand.

**Failure is never fatal:** with `LITELLM_MASTER_KEY` unset, LiteLLM unreachable or refusing, the licence is issued anyway and the grant carries `warnings: ["llm_key_unavailable"]` with no LLM fields. Also, a key that cannot be persisted is deleted again rather than handed out un-revocable.

Config: `LITELLM_BASE_URL` (default `https://llm.breakpilot.com`), `LITELLM_MASTER_KEY`, `LITELLM_MODELS` (default `Qwen3-Coder-30B-A3B-Instruct,gpt-oss-120b`), `LITELLM_BUDGET_TRIAL` (5), `LITELLM_BUDGET_DEFAULT` (50). Startup logs whether provisioning is on.

Note the migration is numbered `0007`: `0006` is taken by the members PR (#28), which is independent of this one — merge order does not matter.

Verified locally: `go vet ./...`, `gofmt` clean, `go test ./...` green, CI coverage command at **74.4%** (gate 70%). `internal/llmkeys` is tested against an httptest fake; no live LiteLLM call was made.

Pairs with a `bp-licence` bump (the Rust `Grant` gains the optional fields) and with `LITELLM_MASTER_KEY` on `tenant-registry-stage`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #29
2026-09-14 08:27:25 +00:00
sharangandSharang Parnerkar 99214c088b feat(members): tenant organization members, invites, admin email (#28)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 22m21s
ci / image (push) Successful in 25s
Demonstration plan, phase D1 (registry side). The portal's Settings/Users page renders design fixtures today and its "Invite member" button posts to a route that does not exist, because the registry had no membership surface.

**`GET /v1/tenants/{id}/members`** lists the tenant's Keycloak organization members — user id, email, first/last name, `org_roles`, `enabled`, `created_at`. A tenant whose organization was never created (sales-led) answers an empty list rather than an error.

**`POST /v1/tenants/{id}/invites`** `{email, first_name?, last_name?, role?}` creates the Keycloak user if missing, adds the organization member (KC 26: the member body is the bare user id), writes the tenant-context user attributes, sends the same execute-actions mail the first admin gets, and audits `user.invited` with the caller as actor. Idempotent: an existing member answers `200 {status:"member"}` and sends no mail; a new one `202 {status:"invited"}`.

**Scope.** A user token may only touch its own tenant — another tenant's id is a 404, never a hint that it exists. Inviting needs the `IT_ADMIN` or `OWNER` org role, so `Principal` now carries the `org_roles` claim and `IsTenantAdmin()`. Service clients stay gated by `AUTHZ_RULES` route groups: members on `tenants.read`, invites on `tenants.write`.

**`admin_email` on the tenant** (migration `0006`, backfilled from the `keycloak.invite_sent` audit trail, and from `keycloak.provision_failed` metadata where the first invite failed) so Settings can show a real contact instead of an em dash. The first `IT_ADMIN`/`OWNER` invite fills it in when it was empty.

**Routing note worth keeping:** `GET /v1/tenants/{id}/members` cannot be registered — Go's ServeMux calls it a conflict with `GET /v1/tenants/by-slug/{slug}`, since both match `/v1/tenants/by-slug/members` and neither pattern is more specific. It is registered as `GET /v1/tenants/{id}/{sub}` instead, which *is* less specific than the by-slug lookup, so the two coexist; anything but `members` answers 404.

`openapi.yaml` documents both endpoints, the `OrgMember`/`Invite` schemas, `admin_email` and a `Forbidden` response.

Verified locally: `go vet ./...`, `gofmt` clean, `go test ./...` green, CI coverage command at **74.3%** (gate 70%).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #28
2026-09-14 08:27:12 +00:00
sharang 8f5c9ba0b9 fix(keycloak): KC 26 org member body is the bare user id; set org tenant_id (#27)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 21m54s
ci / image (push) Successful in 22s
2026-09-12 09:39:27 +00:00
sharang 8388e47742 feat(provision): service token on product lifecycle calls; stage/prod provision URLs (#26)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 22m4s
ci / image (push) Successful in 24s
2026-09-12 09:27:40 +00:00
sharang 209524e5ac feat(erp): always-on ERP link, usage events, outbox, CLI licences (#25)
ci / shared (push) Successful in 14s
ci / image (push) Successful in 28s
ci / test (push) Successful in 22m28s
2026-09-12 08:35:13 +00:00
sharang 2ea49be29d feat(m-mig-5): products table, entitlement check, tenant ladder, per-client authz (#23)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 21m58s
ci / image (push) Successful in 56s
2026-09-12 07:38:47 +00:00
sharang 6b82c14573 chore: module path gitea.meghsakha.com → git.breakpilot.com (#22)
ci / shared (push) Successful in 13s
ci / test (push) Failing after 16m16s
ci / image (push) Skipped
2026-09-11 14:06:43 +00:00
sharang a048d47959 feat(tenants): provision the product tenant with the registry UUID on create (#21)
ci / shared (push) Successful in 12s
ci / test (push) Failing after 16m8s
ci / image (push) Skipped
2026-09-01 21:20:03 +00:00
sharang 80565fdbf2 fix(keycloak): org create must send a domain (KC 26 rejects domainless) (#20)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 21m24s
ci / image (push) Successful in 17s
2026-09-01 09:18:15 +00:00
sharang 84516e9b4f feat(keycloak): organizations become the membership authority source (#19)
ci / shared (push) Successful in 11s
ci / test (push) Successful in 21m22s
ci / image (push) Successful in 19s
2026-09-01 09:03:23 +00:00