Commit Graph
104 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 19f2300934 feat(authz): the catalogue of rights (RBAC step 1)
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 8m8s
ci / image (pull_request) Skipped
Capabilities, bundles and the two position variants, versioned in
code and served as GET /v1/authz/catalogue. Today's six roles are
bundles that reproduce the portal surfaces, the Werkmeister
permissions and the registry's own role checks; pin tests fail if
any of them drifts. Nothing reads the catalogue yet, so no right
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-11-10 22:46:34 +01:00
Sharang ParnerkarandClaude Opus 5.5 4c17affc1f feat(intake): page the pending list and say when a capture is settled
ci / shared (pull_request) Successful in 10s
ci / test (pull_request) Successful in 5m9s
ci / image (pull_request) Skipped
The pending list is across workspaces, oldest first; entries that keep
waiting in one workspace (no receiving workflow, not booked) could fill
every page and hide those of all others. GET /v1/internal/intake/pending
takes after=<entry id>, so the reader pages on with the last id it got.

Each item says whether its report's capture is settled
(capture_settled), so a reader paging on can hold a supplement back
until its capture is handed over, also when the capture was on an
earlier page. Without after the route answers as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-11-10 10:50:54 +01:00
Sharang ParnerkarandClaude Opus 5.5 cc4675c85d test(intake): plain error comparison in the store test
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 7m33s
ci / image (pull_request) Skipped
staticcheck flagged the double negation (tenant-registry#119).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-11-10 09:53:36 +01:00
Sharang ParnerkarandClaude Opus 5.5 bf83d0625e feat(intake): pending entries carry the newest receipt's handoff
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Failing after 1m32s
ci / image (pull_request) Skipped
So the receiving service can look up a handoff it already made before it
repeats one (tenant-registry#119).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-11-10 09:52:23 +01:00
Sharang ParnerkarandClaude Opus 5.5 b4583de691 feat(intake): record R1 security reports with one stable reference
ci / shared (pull_request) Successful in 27s
ci / test (pull_request) Failing after 1m58s
ci / image (pull_request) Skipped
docgen#6 slice 3, F01 (P-R1-K05 Fassung 4 M21, M13): the R1 intake keeps
a security notice unchanged with the time it arrived and gives it one
stable Eingangsreferenz (SH-YYYY-NNNNN), which is also the Meldereferenz
of the confirmation (F-1). Later information is a supplement to the same
reference, never a second report.

- migration 0028: intake_reports, intake_entries (capture and
  supplements), intake_receipts; all insert-only (trigger), one capture
  per report, one settling receipt per entry
- a person reports, lists and reads their own reports and adds to them
  with their own token (route group intake.user); others get 404, and
  no route returns the original text, since "Original einsehen" (F07,
  TV-1) does not exist yet
- werkmeister reads entries not settled yet (reference and the
  reporter's own answers, never the text) and writes receipts back:
  waiting, delivered, processed, refused (route group intake)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-11-10 09:50:37 +01:00
sharang 5525759392 feat(contracts): serve contract documents in Vertragsunterlagen (#118)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 25m50s
ci / image (push) Successful in 35s
2026-11-09 12:59:20 +00:00
sharang f778cbb1a8 feat(erpsetup): quotes name the Leistungsbeschreibung versions (#117)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 26m31s
ci / image (push) Successful in 40s
2026-11-09 10:25:59 +00:00
sharangandSharang Parnerkar 1332ad7bc5 feat(erpsetup): catalogue for Leistungsbeschreibung 1.0.0, opt-in -sync-catalog (#115)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 26m35s
ci / image (push) Successful in 53s
Brings the ERPNext sales catalogue in line with the frozen Leistungsbeschreibungen 1.0.0. This PR changes code and tests only. No ERP was called; the live run is yours, using the erpsetup CLI.

## Dry run first (with the flag; only this path prints `field old → new`)

```sh
ERP_BASE_URL=https://erp.breakpilot.com ERP_API_KEY=… ERP_API_SECRET=… ERP_WEBHOOK_SECRET=… \
  go run ./cmd/erpsetup -webhook-url https://registry.breakpilot.com/v1/internal/erp/webhook -sync-catalog -dry-run
```

(`ERP_LEAD_DOCTYPE` is optional, as before.) Leave out `-dry-run` for the real run.

## What a run does with and without `-sync-catalog`

| | without the flag (as today) | with `-sync-catalog` |
|---|---|---|
| New items, unit "Prüftag", their list prices | created | created |
| Item **description** | **updated (this already happens on every run today)** | updated |
| Item `item_name`, `disabled` | untouched | updated when they differ |
| Standard Selling `price_list_rate` (rows without a customer) | set once, never changed | updated when it differs |
| Customer-specific Item Prices | untouched | untouched |
| Quote print format (Mehrverbrauch row) | updated | updated |

**A plain run is not inert.** It creates the 5 new items, the new unit and 5 new prices, rewrites every changed description, and updates the quote template. Only names, the disabled flags and price changes wait for the flag. Nothing is ever deleted. Only the doctypes Item, Item Price and UOM are touched beyond what erpsetup already manages.

## Catalogue changes

| Code | Status | Price old → new (EUR) |
|---|---|---|
| PLT-CORE-CLD-STD/BUS/ENT | keep (name "Breakpilot …", new text) | 290 / 790 / 1990 (unchanged) |
| PLT-BNDL-CLD-STD | **new** Starter-Modulpaket | 990 |
| PLT-BNDL-CLD-ADD | **new** Weiteres Modul | 499 |
| CRA-CSA-CLD-STD | keep | **1490 → 490** |
| CRA-CSA-CLD-BUS | keep | **3990 → 1290** |
| CRA-CSA-CLD-ENT | keep | **9900 → 0** (Preis nach Vereinbarung: a quote shows 0,00 € unless the rate is entered by hand) |
| CRA-CSA-CLD-TGT | **new** extra Prüfobjekt / Monat | 5.99 |
| CRA-CSA-CLD-DAY | **new** Prüftag (unit Prüftag) | 9.99 |
| CRA-CSA-CLD-SCAN | **disable** | 12 (unchanged) |
| CRA-WBK-CLD-STD/BUS/ENT | **disable** | unchanged |
| DEV-WP-CLD-STD | keep ("Werkpilot Cloud") | 59 |
| DEV-WP-CLD-BUS/ENT | **disable** | unchanged |
| DEV-WP-OPR-*, DEV-FWK-OPR-*, INF-GIT-OPR-*, INF-CI-OPR-* | keep, new texts | unchanged |
| DEV-FWK-CLD-STD | keep ("Firmwerk Cloud") | 89 |
| DEV-FWK-CLD-BUS/ENT | **disable** | unchanged |
| INF-GIT-CLD-STD/BUS/ENT | keep, new texts | 190 / 390 / 790 |
| INF-GIT-CLD-USR | **new** extra user | 19 |
| INF-CI-CLD-STD/BUS/ENT | keep, new texts | 149 / 290 / 590 |

The item group stays "BreakPilot Abonnements".

Correction to the spec, applied here: PLT-CORE-CLD-STD no longer mentions "Rechnungen", because LB Plattform §2(3) says the portal provides no invoices. The text is now "Arbeitsbereich mit Anmeldung und Team für bis 25 Nutzer, Standard-Support. Module werden einzeln gebucht." No other item text mentions invoices, and a test now checks that none does.

## Other changes

- `sku.Disabled` is sent to ERPNext as the Item field `disabled: 1`. Disabled items stay in ERPNext so old documents keep working. Since the disabled items already exist on prod, their flag only changes with `-sync-catalog`.
- **Quote, Mehrverbrauch row:** "Zusätzliche Prüfobjekte werden mit {TGT} netto je Monat berechnet, Prüftage nach verbrauchtem Monatskontingent mit {DAY} netto (Leistungsbeschreibung Prüfwerk, Abschnitt 7)." If a rate is missing, the text says "gemäß der jeweils gültigen Preisliste" instead, per rate. If both are missing, one combined sentence is printed. Quotes with INF-GIT-CLD-STD/BUS/ENT or PLT-BNDL-* add the sentence on extra users (Leistungsbeschreibung Breakpilot Plattform, Abschnitt 4). The Jinja was parsed and rendered locally with jinja2 against mocks for eight item mixes.
- **Migration 0026** adds CRA-CSA-CLD-TGT and -DAY to the `pruefwerk` product. SCAN stays so old orders still map. The up is guarded so it can run twice; the down removes the two SKUs. `DefaultProducts` and the ERP mock's SKU list follow. **Run `migrate-up` with the deploy.** Without it, TGT/DAY lines on an order log "sales order item without catalog product".
- **0 € module lines:** nothing needed fixing. Neither the webhook path nor reconcile reads the rate: the webhook template sends only `item_code` and `qty`, and `SubscriptionPlan` has no rate. A new test covers both paths: a bundle order with modules at rate 0 and qty 15 gives an active tenant, plan standard, and seats 15 per module.

## Decisions the spec did not cover

1. **No Prüfwerk Mehrverbrauch sentence on Enterprise quotes.** CRA-CSA-CLD-ENT is "ohne Begrenzung". Edge case: a quote with both -STD and -ENT also prints no Prüfwerk sentence. The extra-users sentence is not affected.
2. The run without the flag still writes descriptions, as `Run` has done until now (see the table).
3. `-sync-catalog` only changes Item Price rows without a `customer`. If there are several such rows for an item, the run reports "not synced". If there are none, it creates the list price.
4. The quote template's Item Price lookup still has no customer filter (unchanged from before).
5. INF-GIT-OPR texts: STD uses the spec text exactly, so "kein Quellcode verlässt das Haus" is gone. BUS keeps "für mittelgroße Teams" and loses "schnellerer Patch-Rhythmus", like CI. ENT says "für große Entwicklungsorganisationen".
6. INF-CI-OPR texts differ only by size ("mindestens 2 vCPU / 4 GB" etc.); "für größere/umfangreiche Builds" was dropped.
7. DEV-WP-OPR and DEV-FWK-OPR texts: the tier phrase sits after "im eigenen Netz", e.g. "Werkpilot im eigenen Netz für mittlere Teams, mit einem vom Kunden betriebenen KI-Modell; …".
8. TGT/DAY quantities on an order or subscription count toward Prüfwerk `seats`, exactly as SCAN already does. Not changed here.
9. Bundle revenue goes to cost center Plattform (PLT-*). Module lines at 0 € book nothing on Prüfwerk, Firmwerk or Werkpilot. Whether to allocate it is an accounting decision for you.
10. The dry run prints texts in full (no truncation), so the wording can be read before it goes live.
11. `TestEverySKUHasAListPrice` now allows exactly one item at 0: CRA-CSA-CLD-ENT.
12. The ERP mock's `DefaultSKUs` now also lists PLT-BNDL-* and CRA-CSA-CLD-TGT/DAY.

## Tests

`go build ./... && go vet ./... && go test ./...` all pass. The Postgres testcontainers suites ran (podman socket) with no skips: server 463 s, migrations 32 s. New tests:

- catalogue consistency: unique codes, units, disabled set, prices including 5.99/9.99, brand spelling
- `TestSyncCatalog`: the dry run writes nothing and names every change; the run updates name, description, disabled and price and keeps the customer price; a second run makes no updates; without the flag only the description changes
- quote template phrases
- `TestMigrate_productsSeedMatchesDefaults`: seed equals `DefaultProducts`, 0026 applied twice, down
- `TestErp_zeroRateModuleLinesEntitle`: webhook and reconcile, memory and Postgres

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

---------

Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #115
2026-11-06 16:20:22 +00:00
sharangandSharang Parnerkar 32e10e0e13 feat(entitlements): Prüfwerk plan limits and Prüftag cap setting (t72) (#114)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 26m37s
ci / image (push) Failing after 39s
Registry side of Prüfwerk metering (backlog t72). Stage first; nothing deployed.

## What changes

- **Entitlement check**: for `pruefwerk` the limits now always carry `included_targets`, `monthly_pruefungen` and `prueftag_cap`, with `null` meaning unlimited or no cap. The values come from one plan table in `internal/server/pruefwerk.go`:

  | Plan | SKU | included_targets | monthly_pruefungen | prueftag_cap |
  |---|---|---|---|---|
  | Standard | CRA-CSA-CLD-STD | 5 | 100 | the workspace's cap or null |
  | Business | CRA-CSA-CLD-BUS | 25 | 500 | the workspace's cap or null |
  | Enterprise | CRA-CSA-CLD-ENT | null | null | always null |

  The highest plan SKU in `config.skus` wins. A tenant with no plan SKU (trial, preview grant, SCAN-only order) gets Standard. The limits are built on a copy of `tenant_products.config`, so the existing keys stay and the stored config is not changed. Other products are unchanged.
- **Migration 0025** adds `tenant_product_settings(tenant_id, product, settings jsonb, updated_by, updated_at)`, PK `(tenant_id, product)`, with ON DELETE CASCADE. Both stores implement it (Postgres and Memory). `recomputeEntitlements` never touches this table, so the cap survives ERP recomputes.
- **`GET`/`PUT /v1/tenants/{id}/products/pruefwerk/settings`**: the body is `{"prueftag_cap": 0..10000 | null}`. Unknown keys, a missing key, non-integers and out-of-range values all return 400.
  - **User tokens** must be in their own tenant (404 otherwise) and have the IT_ADMIN, OWNER or FINANCE org role (403 `FORBIDDEN_ROLE` otherwise).
  - **Service clients** are gated by their route group, as for the company profile: GET needs `tenants.read`, PUT needs `tenants.write`. Staff come through the admin client with `X-Staff-*`.
  - **Audit**: a change is logged as `product_settings.changed` with `old`, `new`, `plan` and `applies`. A PUT that changes nothing writes nothing and logs nothing.
  - **Enterprise**: PUT still stores the cap and GET shows it with `cap_applies: false`, but the check sends `null`.
- **Usage metrics**: `prueftag.booked` and `target.extra` go through the existing `POST /v1/usage/events`. A test checks that both are stored once per idempotency key and that a repeat, even with a different quantity, counts as a duplicate. No update-in-place path, no invoicing, no ERP item or price changes.
- OpenAPI: the new path, a `PruefwerkSettings` schema, and the three keys described on `EntitlementCheck.limits`.

## Deploy note

Run **`migrate-up` (0025) before the new build takes traffic.** If reading the settings table fails, the Prüfwerk check returns 500 rather than silently sending `prueftag_cap: null`.

## Decisions not in the brief

1. OWNER is allowed alongside IT_ADMIN and FINANCE, because every other admin check in the registry treats OWNER like IT_ADMIN. Dropping it is a one-line change.
2. The registry enforces the org role only on user tokens. Service clients are trusted by route group (the portal checks roles for its users), which matches the company-profile route.
3. The plan table wins over same-named keys that a staff `activate` may have written into the config.
4. The settings response also carries `plan` and `cap_applies`. GET with nothing saved returns 200 with `prueftag_cap: null`.

## Tests

- `go build ./... && go vet ./...` pass.
- `go test -race ./...` passed with the Postgres harness, using rootless podman as the testcontainers backend.
- After two small edits I re-ran `-short` and the new and related tests against Postgres; all passed.
- New tests cover: plan resolution (STD, BUS, ENT, none, SCAN-only, mixed SKUs, JSONB `[]interface{}`); limits per plan, checking that null keys are present in the JSON rather than left out; settings validation; the role matrix with audit (user token, portal user, staff); a product client reading but not writing; the cap surviving an ERP recompute; the store contract on both stores; usage dedup for both metrics; and migration 0025 (table, one row per product, object check, cascade).

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

---------

Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #114
2026-11-06 14:29:49 +00:00
sharang 286f50c5fb feat(invoiceintake): send every invoice mail on to DATEV from invoice@ (#110)
ci / shared (push) Successful in 12s
ci / image (push) Successful in 39s
ci / test (push) Successful in 26m6s
2026-11-02 11:59:00 +00:00
sharangandClaude Opus 5.5 b14d6f61f0 feat(store): public product documents may name their product (#109)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 26m48s
ci / image (push) Successful in 42s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-30 10:36:20 +00:00
sharang 1691bf1be3 Merge pull request 'test: postgres harness no longer provisions at the live stage Prüfwerk' (#108) from fix/tests-no-stage-calls into main
ci / shared (push) Successful in 15s
ci / test (push) Successful in 27m10s
ci / image (push) Successful in 40s
2026-10-30 07:58:35 +00:00
sharang 9af8b283a2 Merge pull request 'fix(telemetry): name tenant sub-resource requests after their collection' (#107) from fix/telemetry-sub-route into main
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m10s
ci / image (push) Successful in 41s
2026-10-30 07:31:48 +00:00
Sharang ParnerkarandClaude Opus 5.5 e8fc5c4293 test: postgres harness no longer provisions at the live stage Prüfwerk
ci / shared (pull_request) Successful in 16s
ci / test (pull_request) Successful in 26m58s
ci / image (pull_request) Skipped
pruefwerk-agent-stage logged 'platform token rejected: failed to decode
JWT header' in bursts of five provisions and one targets read, each time
the registry's tests ran (CI and local). The migrations seed the real
provision URLs (0005: pruefwerk-stage), a test config's env 'dev' reads
as 'stage', so every postgres test that provisioned a tenant called the
live endpoint with the Keycloak mock's non-JWT token and got 401.

The postgres harness clears provision_urls after migrating, as the
memory store has none; tests that need one set it themselves. Checked:
a full local run with postgres left no request in Prüfwerk's traces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-30 08:31:02 +01:00
Sharang ParnerkarandClaude Opus 5.5 d31594cc6c fix(telemetry): name tenant sub-resource requests after their collection
ci / shared (pull_request) Successful in 18s
ci / test (pull_request) Successful in 26m56s
ci / image (pull_request) Skipped
GET /v1/tenants/{id}/{sub} serves eight collections (members, documents,
projects, contracts, managed-services, company-profile, role-dataset,
store), and spans and access-log lines all said '{sub}': SigNoz could
not tell a document-store read from a team list. The route name now
carries the collection when it is one of the eight, and keeps the
wildcard for anything else, so no free path text reaches the name.

The list lives next to the dispatcher; a test keeps the two in step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-29 22:28:39 +01:00
Sharang ParnerkarandClaude Opus 5.5 e5ed990bf7 fix(outbox): dead-letter after a week; ERP mock names unique per boot
ci / shared (pull_request) Successful in 11s
ci / test (pull_request) Successful in 25m15s
ci / image (pull_request) Skipped
Stage logged ~11,100 failed usage.record items a day ('tenant has no ERP
customer yet') behind 36 customer.upsert failures on the unique
tenants_erp_customer_id_key (backlog t25). The ERP mock keeps its docs
in memory and restarts with every registry deploy on stage: its counter
began at CUST-00001 again and handed new tenants names older tenants are
still linked to, so they never got linked and their usage waited
forever.

- erpmock: Config.NameToken goes into every assigned name; cmd/erpmock
  sets one per boot (CUST-<yymmddHHMMSS>-00001). Tests keep plain names.
- outbox: after maxOutboxAttempts (170, about a week at the 1 h cap) an
  item is dead-lettered instead of retried forever: done_at set,
  last_error 'dead letter: <err>', payload kept for a re-queue, and an
  ERROR line (the prod error alert sees it). Store gains
  DeadLetterOutbox (memory + postgres).

Tests: dead letter after the last attempt and nothing claimed after,
memory and postgres; mock names carry the token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-29 18:21:01 +01:00
Sharang ParnerkarandClaude Opus 5.5 daca82ecf6 fix(invoiceintake): UBL e-invoice goes to the plain draft at once
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 24m56s
ci / image (pull_request) Skipped
eu_einvoice reads CII only and answers a UBL XRechnung with a 500
("Invalid XML, found tag …ubl…Invoice"). The intake took that for a
transient error and retried three runs (30 min) before the plain
draft. A wrong root element is now treated like the 417 "not an
e-invoice": next file, then the draft with the original attached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-29 13:42:48 +01:00
Sharang ParnerkarandClaude Opus 5.5 7857fb4f09 fix(invoiceintake): qualify order_by so Contact lookups by e-mail work
ci / shared (pull_request) Successful in 14s
ci / test (pull_request) Successful in 26m55s
ci / image (pull_request) Skipped
Every intake run failed with "list Contact: HTTP 500: (1052, Column
'creation' in ORDER BY is ambiguous)": the supplier lookup filters on the
child table Contact Email, Frappe joins it, and the bare order_by column
exists in both tables. Nothing sent to invoice@ became a draft (t53).
order_by is now `tab<Doctype>`.`creation`; the fake ERP in the tests
refuses an unqualified one with a child-table filter, like MariaDB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-29 12:34:12 +01:00
Sharang ParnerkarandClaude Opus 5.5 81f291b81e fix(telemetry): db.system on SQL spans for SigNoz's service map
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 25m2s
ci / image (pull_request) Skipped
The service map draws database nodes from the pre-1.26 db.system key
(dependency_graph_minutes_db_calls_mv_v2); the spans set only
db.system.name, so the registry's Postgres never appeared on the map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-29 10:54:35 +01:00
Sharang ParnerkarandClaude Opus 5.5 2aa9d8022d test(telemetry): errcheck and Value.String for golangci-lint
ci / shared (pull_request) Successful in 14s
ci / test (pull_request) Successful in 27m1s
ci / image (pull_request) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-28 22:43:00 +01:00
Sharang ParnerkarandClaude Opus 5.5 65ad1b52f6 feat(telemetry): traces to SigNoz for requests, outbound calls and SQL
ci / shared (pull_request) Failing after 12s
ci / test (pull_request) Failing after 15m24s
ci / image (pull_request) Skipped
internal/telemetry: OTLP/HTTP tracer provider from the OTEL_* env
(already set on stage and prod; unset = off), W3C propagation, one server
span per request named after the ServeMux pattern, client spans on the
default transport (Keycloak, ERP, LiteLLM, OIDC) and a pgx QueryTracer.
Client and DB spans only inside a request, so the background loops add
no traces. No raw paths, query strings, bodies, SQL parameters or client
addresses in spans; outbound spans carry the host only.

slog lines logged with a request context get trace_id/span_id; the
access log names the route instead of the raw path (slugs are names).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-28 22:24:34 +01:00
sharangandClaude Opus 5.5 5fff4dd581 fix(roles): first releases are management's; external-only decides nothing (#101)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 24m30s
ci / image (push) Successful in 38s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-28 16:13:09 +00:00
sharangandClaude Opus 5.5 cb173104b6 fix(roles): check the right to save before the revision (#100)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 26m43s
ci / image (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-28 12:00:46 +00:00
Sharang ParnerkarandClaude Opus 5.5 b96f319380 fix(erpsetup): quote overage price, portal doc basis, USt-IdNr. glyph
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 24m54s
ci / image (pull_request) Skipped
- Mehrverbrauch: only on quotes with Prüfwerk, priced from the
  CRA-CSA-CLD-SCAN Item Price (falls back to the price list).
- Vertragsgrundlagen default no longer cites a missing Anlage: documents
  on request beforehand, in the customer portal after signing.
- USt-IdNr.: NimbusSans sets "Nr." as one № glyph; a ZWNJ keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-28 09:33:25 +01:00
Sharang ParnerkarandClaude Opus 5.5 212b1b30d0 fix(erpsetup): top room for the Vertragsbedingungen block on page 2
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 24m38s
ci / image (pull_request) Skipped
With page-break-inside: avoid (#96) the block moves whole to page 2, which
has no letter head, so it sat flush against the top edge. Give the wrapper
28px top padding. Padding rather than margin: wkhtmltopdf drops a margin at
a page break. When the block fits on page 1 it only widens the gap after
the totals a little.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-28 09:22:09 +01:00
Sharang ParnerkarandClaude Opus 5.5 01a1b5b8fd fix(erpsetup): state the permanent discount when it is a negative line
ci / test (pull_request) Successful in 24m42s
ci / image (pull_request) Skipped
ci / shared (pull_request) Successful in 14s
The Vertragsbedingungen block (#95) only stated the permanent discount for a
document-level discount (total - net_total). The K-00001 Pilotrabatt is a
negative line item, by design, because eu_einvoice cannot carry a
document-level discount, so the sentence never rendered and the Rabattdauer
(one of the reviewer's required terms) was missing from the PDF.

Count negative lines (rate < 0) as well, and say the discount is already
contained in the stated net amount. Keep the block on one page
(page-break-inside: avoid); it split across pages 1-2.

Rendered against mocks: line-item discount, document-level discount and no
discount all produce the expected text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-27 17:12:15 +01:00
Sharang ParnerkarandClaude Opus 4.8 276670d0eb feat(erpsetup): Vertragsbedingungen block on the Quotation print format
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 24m47s
ci / image (pull_request) Skipped
Angebot review (§3/§5/§6): the Quotation PDF lacked the contractual terms a
B2B-SaaS offer needs. Add a Quotation-GUARDED Vertragsbedingungen block to the
shared documentHTML (Vertragsart, Vertragsbeginn, Laufzeit/Kündigung, Abrechnung,
monatliche Vergütung + Rabattdauer, Mehrverbrauch, Vertragsgrundlagen, Annahme),
the 14-day SEPA Vorabinformation on the non-invoice Zahlungsart line, and a
"Monatlicher Gesamtbetrag" label so the recurring nature is unambiguous (the
"1 Monat" misread). Every new block is doc.doctype == "Quotation" (or the
not-is_inv branch), so the GoBD Sales Invoices are untouched.

Terms per the owner's decisions 2026-10-27: no minimum term (monthly cancellable,
1 month to month-end), permanent discount incl. renewals, SEPA-Lastschrift 21
days, per-Prüfung overage. Vertragsgrundlagen renders a placeholder until the
SaaS-AGB/SLA/AVV/TOMs land in the portal document store. Structured per-field
Custom Fields are a documented follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
2026-10-27 10:29:19 +01:00
sharangandClaude Opus 5.5 4dd1179ca4 fix: the CXO sign-in role makes the first role dataset entry (#94)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 24m35s
ci / image (push) Successful in 41s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-26 22:48:21 +00:00
sharangandClaude Opus 5.5 1b9e2f1183 feat: role and authority dataset (R1 S0) (#93)
ci / shared (push) Successful in 12s
ci / test (push) Successful in 24m37s
ci / image (push) Successful in 44s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-26 21:18:57 +00:00
sharangandClaude Opus 5.5 9129e95538 fix: portal user headers only from the portal's service client (#91)
ci / shared (push) Failing after 4s
ci / test (push) Successful in 24m31s
ci / image (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aRnCGqELxoix5TfpX8Ejf
2026-10-26 20:39:03 +00:00
sharangandClaude Opus 5.5 ad4fe8f3fd feat(store): Unterlagen merge into the document store (#89)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 26m6s
ci / image (push) Successful in 38s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 18:04:53 +00:00
sharangandClaude Opus 5.5 2a0a274108 feat(store): Dokumentenablage with areas, checked serving, import (#88)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m46s
ci / image (push) Successful in 51s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:38:10 +00:00
sharangandClaude Opus 5.5 6a640d553f feat(erpsetup): Reisekosten expense claim types with SKR04 accounts (#87)
ci / shared (push) Successful in 13s
ci / image (push) Successful in 37s
ci / test (push) Successful in 25m57s
The 22 Expense Claim Types of the Reisekosten app, each with its standard SKR04 Arbeitnehmer account for Breakpilot GmbH (decided 2026-10-20), and breakpilot_report_id (unique) on Expense Claim as the relay's idempotency key. Backlog #39 (a)+(b).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 11:07:48 +00:00
sharangandClaude Opus 5.5 174a2f1e01 feat(company-profile): Unternehmensprofil per tenant, registry as the authority (#85)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m47s
ci / image (push) Successful in 37s
Migration 0021 (company_profiles + company_profile_revisions), GET/PUT /v1/tenants/{id}/company-profile, POST …/submit with optimistic revisions (409 + current revision; unchanged saves are no new revision), staff import via /v1/admin/tenants/{id}/company-profile (named staff member only), outline validation of the form document, audit without answers, OpenAPI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 10:30:09 +00:00
sharangandClaude Opus 5.5 f024a4042d fix(erpsetup): deliveries of goods to EU businesses are K, not AE (#86)
ci / shared (push) Successful in 15s
ci / test (push) Successful in 25m38s
ci / image (push) Successful in 37s
Lieferung an Unternehmen in der EU is an intra-community supply: tax category K with VATEX vatex-eu-ic; Sonstige Leistung an Unternehmen in der EU (services) stays AE. Found in the live dry run of 2026-10-20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 10:25:58 +00:00
sharangandClaude Opus 5.5 c3bb7702dc feat(erpsetup): outgoing e-invoices, payment by transfer, discount line (#84)
ci / shared (push) Successful in 17s
ci / test (push) Successful in 25m36s
ci / image (push) Successful in 36s
Code lists and mappings for eu_einvoice (units, payment means 58/59, AE/G tax categories with VATEX), Mode of Payment Überweisung on the company bank account and terms Überweisung 21 Tage, item RABATT for discount lines (SKR04 4700, Verwaltung), E Invoice Settings (warn on save, block on submit), default profile EN 16931 for new customers, transfer text on offers/orders and a mandate check in the invoice mail. Backlog #16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 09:32:05 +00:00
sharangandClaude Opus 5.5 8600c92e96 fix(invoiceintake): ToDos assigned by the intake user; forwarded invoices entered by hand (#83)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m36s
ci / image (push) Successful in 36s
Frappe 15.112 lets a user without System Manager create a ToDo only when it is assigned to or by that user, so the service sets assigned_by to its own user (asked once via frappe.auth.get_logged_user). Mails from our own domain or a freemail address no supplier has were forwarded by a person: their ToDo says to enter the invoice by hand instead of suggesting a retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 09:01:45 +00:00
sharangandClaude Opus 5.5 cee669d2bd feat(invoiceintake): invoice@ mails become draft Eingangsrechnungen (#82)
ci / shared (push) Successful in 14s
ci / test (push) Successful in 25m31s
ci / image (push) Successful in 46s
Reads the mails of ERPNext's Email Account Eingangsrechnung via the API: e-invoices become E Invoice Import drafts, other PDFs draft Purchase Invoices (supplier by sender, placeholder line, original attached), the rest ToDos. Never submits; state lives in ERPNext (unique Link intake_communication, ToDo reference). erpsetup adds the marker fields, the placeholder item EINGANGSRECHNUNG and its SKR04 6300 account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 08:15:32 +00:00
sharangandClaude Opus 5.5 36caf3c967 fix(erpsetup): visible footer line in PDFs, tighter totals (#81)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m32s
ci / image (push) Successful in 49s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 21:38:28 +00:00
sharangandClaude Opus 5.5 b4c184c26f fix(erpsetup): VAT after discount on documents; SEPA days on offers (#80)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m40s
ci / image (push) Successful in 41s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:51:33 +00:00
Sharang ParnerkarandClaude Opus 5.5 bb414fd241 fix(invite): Back to application lands in the workspace, not on /start
ci / shared (pull_request) Failing after 15s
ci / test (pull_request) Successful in 25m47s
ci / image (pull_request) Skipped
INVITE_REDIRECT_URI may contain {slug}; the registry replaces it with the
workspace slug at all three invite sites (new workspace, member invite,
resend). Stage and prod currently point at /start?invited=1, which the
portal does not handle, so invitees landed on the trial signup form after
setting their password. With https://app.breakpilot.com/{slug}/dashboard
they arrive signed in in their workspace. A redirect without {slug} stays
as configured, so this is safe to deploy before the env change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:06:29 +02:00
sharang 06ad8d9b55 feat(projects): product hierarchy - family, product, component (#78)
ci / test (push) Successful in 25m42s
ci / image (push) Successful in 35s
ci / shared (push) Successful in 13s
2026-10-15 20:36:20 +00:00
sharang 3f4dfa0cdc fix(trial): a product trial ends with the workspace's trial (#77)
ci / test (push) Successful in 25m31s
ci / image (push) Successful in 37s
ci / shared (push) Successful in 14s
2026-10-15 16:28:01 +00:00
sharang c1de728d16 feat(projects): pass open vulnerabilities through to the portal (#76)
ci / shared (push) Successful in 16s
ci / test (push) Successful in 26m1s
ci / image (push) Successful in 36s
2026-10-14 18:20:57 +00:00
sharangandSharang Parnerkar 310c438aea fix(tenants): Setting the current status again is a no-op (#75)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m41s
ci / image (push) Successful in 37s
On stage, staff picked "Apply" (set status) with `trial` selected on a trial tenant, instead of "Extend". The registry wrote an update, a `tenant.status_changed` audit entry (`trial` → `trial`) and a Keycloak sync. The audit log showed an entry, but nothing had changed.

**Change:** `POST /v1/tenants/{id}/status` with the tenant's current status answers 200 with the unchanged tenant: no write, no audit entry, no Keycloak sync. The call stays idempotent for scripts. Other transitions are unchanged.

**Test:** `TestSetStatus_unchangedIsNoOp` (memory and Postgres) checks 200 and that no audit entry is added. It fails without the fix ("audit entries: 1, want 0"). `go vet` and `go test -short ./...` pass locally; the full Postgres suite runs in CI.

Companion: the portal staff page greys out "Apply" until a different status is chosen (separate portal PR).

🤖 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: #75
2026-10-14 11:09:29 +00:00
sharangandSharang Parnerkar 358c4abcb7 feat(audit): Products may pass their caller's address as source_ip (#73)
ci / shared (push) Successful in 13s
ci / test (push) Successful in 25m31s
ci / image (push) Successful in 38s
`POST /v1/audit` recorded the address of the product that sent the event. So Prüfwerk's API-key writes showed the agent's container address (172.17.0.6 on stage) instead of the caller's.

- `appendAuditReq` gains `source_ip`. It is taken when `net.ParseIP` accepts it and stored in canonical form. The peer that sent the event is kept in `metadata.relayed_by`.
- Anything that doesn't parse is ignored, and the peer is recorded as before.
- Trust: `audit.write` is service-principal only, the same trust as the `actor_id` those callers already set.
- No migration, and existing callers are unchanged.
- Callers: Prüfwerk (pruefwerk #567, from the API host's proxy header); Werkmeister will reuse the field (agreed with werkmeister-18).

Test: `TestAppendAudit_sourceIP` covers a valid IP (recorded, `relayed_by` set) and junk (ignored), in each store.

Not in this PR: `clientIP()` takes the **leftmost** `X-Forwarded-For` entry. orca-proxy appends the peer it saw, so the rightmost entry is authoritative and the leftmost is chosen by the client. Separate issue for werkmeister-18.

Not run locally (RAM); CI runs the tests.

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

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #73
2026-10-14 10:07:17 +00:00
sharang fdebac1735 feat(entitlements): Staff preview grants for products not for sale yet (#72)
ci / shared (push) Successful in 18s
ci / test (push) Successful in 25m44s
ci / image (push) Successful in 41s
2026-10-14 08:42:40 +00: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