feat: prompt a reconcile after each tier_pro change #73
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-payment!73
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "feat/14-shim-trigger"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What
tier_prowrite (grant, revoke, withdrawal, sweep), the serviceposts to the reconcile auth shim with a bearer token. Refs #14.
ent_orgsnesting comment insrc/entitlements.ts. Refs #15.How
kanidmIdentitytakes an optionalonChangecallback, called after the Kanidm write succeeds.All four paths go through
deps.identity, so one hook covers them. No Kanidm write, no call(for example a revoke skipped because another live subscription remains).
src/reconcile-trigger.ts:POSTwithAuthorization: Bearer, no body, 3 s timeout. Returnsat once and never throws. Failures log the status or error message, never the token.
RECONCILE_TRIGGER_URLandRECONCILE_TRIGGER_TOKEN. Either unset or empty: nothingis sent and the 5-minute tick applies the change.
.env.exampleand README updated.Tested
pnpm test: 227 passed, 46 skipped (the Postgres tests, noTEST_DATABASE_URLhere). 7 new tests:bearer and no body, failing shim and 401 logged without the token, unset env sends nothing,
fires after grant and revoke, not after a failed Kanidm write, hanging or failing shim does not
fail the membership write.
pnpm lint,pnpm typecheck,pnpm buildclean.Infra side (not in this PR, needs an apply)
The shim role already accepts a
paymentsource. Nothing to change in the shim.vault_payments_webhook_token(openssl rand -hex 32). It is declared and empty ingroup_vars/vault.example.yml. Empty means the shim omits thepaymentsource.--tags reconciler: re-rendersreconcile-shim.env.j2withpayment=<token>andrestarts the shim (
reconcile_shim_env_file).roles/billing/templates/billing.env.j2: add, only when the token is non-empty,RECONCILE_TRIGGER_URL={{ reconcile_shim_internal_url }}andRECONCILE_TRIGGER_TOKEN={{ vault_payments_webhook_token }}.reconcile_shim_internal_urlis aroles/reconcilerdefault(
http://bitborg-reconcile-trigger:8099/). Check it resolves in a--tags billingrun, orcopy it into
group_vars. Then apply--tags billing.bitborg_networkpodman network on one host. #14 assumed cross-host. Revisit if billing moves.paymentsource.
Open questions
how the priced org add-on is granted, and handling of
overwrite_members: trueonent_orgs.The comment now states both facts. Today a paying org customer gets no org-creation. The issue
closes on merge as instructed, so open a follow-up for the decision.