Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Record commercial reconciliation evidence

rcourtman536a845c7ad8
diff --git a/docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-read-only-reconciliation-2026-07-21.md b/docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-read-only-reconciliation-2026-07-21.md
new file mode 100644
index 0000000000..fc322a6321
--- /dev/null
+++ b/docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-read-only-reconciliation-2026-07-21.md
@@ -0,0 +1,264 @@
+# Self-Hosted Commercial Transition Read-Only Reconciliation Record
+
+- Date: `2026-07-21`
+- Gate: `self-hosted-commercial-transition-coherence`
+- Result: `local reconciliation hardened; external transition gate remains blocked`
+- Evidence posture: `test-proof` plus `production-observed` read-only checks
+- Implementation commit: `pulse-pro:4fc4820`
+
+## Safety Boundary
+
+This slice performed local tests, public HTTP GETs, pinned read-only SSH
+inspection, and a Stripe GET-only catalog/portal audit. It did not change a
+Stripe object, customer, subscription, invoice, payment method, webhook,
+license record, deployed binary, service configuration, secret, release, or
+customer system. No customer was contacted.
+
+The local Stripe CLI has no current test-mode authority: its configured test
+credential metadata expired on `2026-05-26`, and no `STRIPE_SECRET_KEY` was
+present in the task environment. Consequently, no Stripe test-mode mutation
+was attempted.
+
+## Read-Only Observations
+
+1. `https://license.pulserelay.pro/healthz` and
+ `https://relay.pulserelay.pro/healthz` both returned `{"status":"ok"}`.
+2. The public v6 pricing model passed
+ `validate_public_pricing_model.py --track v6 --require-plan-keys`.
+3. The production Stripe GET-only audit passed all 25 governed prices and the
+ dedicated portal configuration `bpc_1TtNsxBrHBocJIGHTjRvG4Qf`. The four
+ expected public Relay/Pro price IDs resolved. The only warnings were the two
+ already-governed inactive v1 recurring prices.
+4. Read-only service inspection found both `pulse-license` and `pulse-relay`
+ active and enabled with healthy loopback endpoints. The Relay configuration
+ contained both required license-server/feed settings. The deployed Relay
+ binary had SHA-256
+ `e00b1ba9a5a69a1958a4e8f6e9e85eefa285fe824422f19973401900397f1225`
+ and reported VCS revision
+ `be79bb1a074d296b8b227ed10bb2eebb745b1070`. The deployed license binary
+ had SHA-256
+ `5241742fb62d778fd5570fad99240b5f2af472f724b0b6943734d590e15d879b`.
+
+One initial local audit invocation was discarded: sourcing the Bash SSH helper
+from a different shell misresolved its pin path, and the helper's process-
+substitution error did not propagate before `ssh` ran. The audit was repeated
+through Bash with the repository pin enforced. Commit `pulse-pro:4fc4820`
+changes both SSH and SCP helpers to obtain the pin arguments synchronously and
+fail closed; a subprocess test proves that a missing pin cannot reach SSH.
+
+## Reconciliation Defect And Fix
+
+`invoice.payment_failed` previously projected `past_due` from the historical
+invoice delivery and locally cached plan state. Invoice and subscription
+events share the subscription ordering cursor, so an older failure is rejected
+after an observed recovery. That cursor cannot protect against a recovery event
+that never arrived, however: a delayed historical invoice failure newer than
+the last observed event could regress already-recovered Stripe state into
+grace.
+
+Commit `pulse-pro:4fc4820` now retrieves the current Stripe subscription with a
+GET, verifies subscription/customer ownership, resolves its one governed
+price, and feeds the resulting authoritative snapshot through the same atomic
+commercial projection used by transition application. Tests prove:
+
+- a current `past_due` snapshot enters payment-failure grace and increments
+ the version floor;
+- a stale invoice failure cannot regress a currently active Stripe
+ subscription even when its recovery event was missed locally;
+- the durable inbox accepts a delayed failure after the last observed baseline,
+ then converges to the authoritative active subscription; and
+- replaying that same invoice event is idempotent and does not repeat the
+ Stripe fetch or increment `license_version`.
+
+The complete local license-server and Relay Go suites passed. The focused
+Stripe catalog/remediation/runtime/price-creation/SSH Python suites passed 24
+tests. `bash -n scripts/license_ssh.sh` and `git diff --check` also passed.
+
+## Executable Operator Packet For The Remaining Gate
+
+Run this only against a new isolated rehearsal license server, Relay server,
+Pulse installation, and Stripe **test-mode** account. It intentionally refuses
+the production license origin and live Stripe keys. The candidate must include
+`pulse-pro:4fc4820`; do not substitute the currently deployed production
+license binary because that commit has not been deployed.
+
+### 1. Establish And Record The Isolated Authority
+
+```bash
+set -euo pipefail
+
+: "${PULSE_REHEARSAL_LICENSE_ORIGIN:?set the isolated license-server origin}"
+: "${PULSE_REHEARSAL_RELAY_ORIGIN:?set the isolated Relay origin}"
+: "${PULSE_REHEARSAL_PULSE_ORIGIN:?set the isolated Pulse origin}"
+: "${STRIPE_TEST_SECRET_KEY:?set a current Stripe test-mode secret key}"
+: "${RELAY_MONTHLY_PRICE_ID:?set the isolated Relay monthly test price}"
+: "${RELAY_ANNUAL_PRICE_ID:?set the isolated Relay annual test price}"
+: "${PRO_MONTHLY_PRICE_ID:?set the isolated Pro monthly test price}"
+: "${PRO_ANNUAL_PRICE_ID:?set the isolated Pro annual test price}"
+
+case "$STRIPE_TEST_SECRET_KEY" in
+ sk_test_*) ;;
+ *) echo "refusing a non-test Stripe key" >&2; exit 1 ;;
+esac
+case "$PULSE_REHEARSAL_LICENSE_ORIGIN" in
+ https://license.pulserelay.pro|https://license.pulserelay.pro/*)
+ echo "refusing the production license origin" >&2; exit 1 ;;
+esac
+
+PULSE_REHEARSAL_EVIDENCE="$(mktemp -d)"
+export PULSE_REHEARSAL_EVIDENCE
+curl -fsS "$PULSE_REHEARSAL_LICENSE_ORIGIN/healthz" | tee "$PULSE_REHEARSAL_EVIDENCE/license-health.json"
+curl -fsS "$PULSE_REHEARSAL_RELAY_ORIGIN/healthz" | tee "$PULSE_REHEARSAL_EVIDENCE/relay-health.json"
+curl -fsS "$PULSE_REHEARSAL_LICENSE_ORIGIN/v1/public/pricing-model" \
+ | tee "$PULSE_REHEARSAL_EVIDENCE/pricing-model.json" >/dev/null
+for price_id in "$RELAY_MONTHLY_PRICE_ID" "$RELAY_ANNUAL_PRICE_ID" "$PRO_MONTHLY_PRICE_ID" "$PRO_ANNUAL_PRICE_ID"; do
+ stripe prices retrieve "$price_id" --api-key "$STRIPE_TEST_SECRET_KEY" \
+ >"$PULSE_REHEARSAL_EVIDENCE/price-$price_id.json"
+done
+```
+
+The isolated license server must use a fresh database, the four test price IDs,
+`PULSE_LICENSE_V6_ENABLED=true`, a new rehearsal-only
+`PULSE_LICENSE_RELAY_FEED_TOKEN`, and a new rehearsal-only
+`STRIPE_WEBHOOK_SECRET`. The isolated Relay must use the same feed authority
+through `PULSE_RELAY_LICENSE_SERVER_URL` and
+`PULSE_RELAY_REVOCATION_FEED_TOKEN`. Keep Stripe webhook IP enforcement off
+only on this isolated service because the controlled replay below originates
+from the operator host. Do not copy either feed token into Pulse.
+
+### 2. Exercise Acquisition And Quoted Transitions
+
+For each combination `relay/monthly`, `relay/annual`, `pro/monthly`, and
+`pro/annual`, create a new test email subject and request checkout:
+
+```bash
+export PULSE_REHEARSAL_TIER=relay
+export PULSE_REHEARSAL_CADENCE=monthly
+curl -fsS -X POST "$PULSE_REHEARSAL_LICENSE_ORIGIN/v1/checkout/session" \
+ -H 'Content-Type: application/json' \
+ --data "{\"tier\":\"$PULSE_REHEARSAL_TIER\",\"billing_cycle\":\"$PULSE_REHEARSAL_CADENCE\"}" \
+ | tee "$PULSE_REHEARSAL_EVIDENCE/checkout-$PULSE_REHEARSAL_TIER-$PULSE_REHEARSAL_CADENCE.json"
+```
+
+Open each returned test Checkout URL, pay with Stripe's governed test cards,
+and retrieve the result through the returned session flow. Record the Stripe
+customer/subscription IDs, Pulse license ID, price, tier, cadence,
+`license_version`, and continuity epoch. Repeat with a declining test card for
+the decline case.
+
+For each owned test subject, request a fresh manage code from the rehearsal
+mail sink, then create and apply a quote:
+
+```bash
+: "${PULSE_REHEARSAL_EMAIL:?set the owned rehearsal email}"
+curl -fsS -X POST "$PULSE_REHEARSAL_LICENSE_ORIGIN/v1/manage/request" \
+ -H 'Content-Type: application/json' \
+ --data "{\"email\":\"$PULSE_REHEARSAL_EMAIL\"}"
+read -r -p 'Rehearsal manage code: ' PULSE_REHEARSAL_CODE
+export PULSE_REHEARSAL_TARGET_TIER=pro
+export PULSE_REHEARSAL_TARGET_CADENCE=annual
+curl -fsS -X POST "$PULSE_REHEARSAL_LICENSE_ORIGIN/v1/commercial/transition/quote" \
+ -H 'Content-Type: application/json' \
+ --data "{\"email\":\"$PULSE_REHEARSAL_EMAIL\",\"code\":\"$PULSE_REHEARSAL_CODE\",\"target_tier\":\"$PULSE_REHEARSAL_TARGET_TIER\",\"target_billing_cycle\":\"$PULSE_REHEARSAL_TARGET_CADENCE\"}" \
+ | tee "$PULSE_REHEARSAL_EVIDENCE/transition-quote.json"
+jq -er '.quote_token' "$PULSE_REHEARSAL_EVIDENCE/transition-quote.json" >"$PULSE_REHEARSAL_EVIDENCE/quote-token"
+curl -fsS -X POST "$PULSE_REHEARSAL_LICENSE_ORIGIN/v1/commercial/transition/apply" \
+ -H 'Content-Type: application/json' \
+ --data "$(jq -n --rawfile token "$PULSE_REHEARSAL_EVIDENCE/quote-token" '{quote_token:($token|rtrimstr("\n"))}')" \
+ | tee "$PULSE_REHEARSAL_EVIDENCE/transition-apply.json"
+```
+
+Repeat immediate Relay-to-Pro and monthly-to-annual transitions for success,
+timeout-after-Stripe-success, duplicate apply, and replay. Repeat
+renewal-bound Pro-to-Relay and annual-to-monthly transitions, including cancel
+and resume before the effective timestamp. Use Stripe test clocks to advance
+renewal, paid-through cancellation, payment-failure grace, grace expiry,
+refund/dispute, recovery, and current-price re-entry without waiting on wall
+clock time. After every step, record Stripe's current subscription and the
+Pulse Account/runtime projection; require exactly one subscription item and
+one current local subscription projection.
+
+### 3. Deliver Real Stripe Events In Controlled Order
+
+Do not register the isolated webhook endpoint with Stripe during this phase.
+The test-mode mutations still create real Stripe Event objects, while delivery
+remains under operator control. Retrieve each required event envelope:
+
+```bash
+: "${PULSE_REHEARSAL_EVENT_ID:?set a Stripe test-mode event ID}"
+stripe events retrieve "$PULSE_REHEARSAL_EVENT_ID" --api-key "$STRIPE_TEST_SECRET_KEY" \
+ >"$PULSE_REHEARSAL_EVIDENCE/$PULSE_REHEARSAL_EVENT_ID.json"
+```
+
+Deliver the saved envelopes in chronological order, reversed order, and with
+duplicates. Set `PULSE_REHEARSAL_EVENT_FILES` to the exact desired sequence:
+
+```bash
+: "${STRIPE_REHEARSAL_WEBHOOK_SECRET:?set the isolated webhook signing secret}"
+: "${PULSE_REHEARSAL_EVENT_FILES:?space-separated event JSON paths in delivery order}"
+for event_file in $PULSE_REHEARSAL_EVENT_FILES; do
+ event_ts="$(date +%s)"
+ event_sig="$( (printf '%s.' "$event_ts"; cat "$event_file") \
+ | openssl dgst -sha256 -hmac "$STRIPE_REHEARSAL_WEBHOOK_SECRET" -hex \
+ | awk '{print $NF}')"
+ curl -fsS -X POST "$PULSE_REHEARSAL_LICENSE_ORIGIN/stripe/webhook" \
+ -H 'Content-Type: application/json' \
+ -H "Stripe-Signature: t=$event_ts,v1=$event_sig" \
+ --data-binary "@$event_file"
+done
+```
+
+For the missing-event case, omit the event, leave the isolated service running
+for one full reconciliation interval plus jitter, and require reconciliation
+to fetch the event from Stripe. Then replay the omitted envelope and require no
+state or version change. Capture the durable inbox statuses and final Stripe,
+license, account, and runtime projections without recording buyer secrets.
+
+### 4. Prove The Joined Relay And Pulse Version Floor
+
+Activate the owned rehearsal license in the candidate Pulse installation and
+establish a real Relay connection. Record the pre-change Pulse
+`/api/license/status`, Relay session presence, grant `license_version`, and
+reconnect token. While the session remains connected, apply a material
+entitlement reduction from the matrix and deliver or reconcile its Stripe
+event.
+
+Require all of these postconditions:
+
+1. the license transaction increments `license_version` and emits the matching
+ `bump_license_version` feed event atomically;
+2. the isolated Relay consumes that event and disconnects the old session by
+ the next successful 30-second feed poll;
+3. the old reconnect token is rejected;
+4. Pulse observes the installation-scoped authoritative version, refreshes or
+ clears the old grant, and never receives the global feed token; and
+5. settings, report definitions, audit records, and the governed downgrade
+ history remain present while paid work is denied.
+
+Repeat for payment recovery and current-price re-entry. Capture timestamps so
+the feed convergence bound is measurable.
+
+### 5. Customer Journey And Verdict
+
+Run the buyer/account journey at a desktop viewport and a phone viewport. At
+each transition, capture the quote amount, recurring amount, effective date,
+plan, cadence, cancellation/recovery copy, and the matching Stripe/runtime
+state. Redact email, activation, grant, session, reconnect, feed, and webhook
+secrets before moving evidence into the canonical repository.
+
+The operator may mark the gate passed only when every matrix row converges to
+one Stripe billing contract and one matching Pulse entitlement projection,
+all restrictive changes advance the version floor and invalidate old Relay
+and Pulse authority, replay/order/missing delivery produces the same result,
+and protected customer data survives downgrade/cancellation. Otherwise record
+the exact failed row and keep the gate blocked.
+
+## Residual And Approval Boundary
+
+The remaining proof requires fresh Stripe test-mode authority and controlled
+test-mode mutations. The joined proof also requires deploying the candidate to
+an isolated license/Relay environment and applying material entitlement
+changes to an owned rehearsal subject. Using the live production services or a
+real customer would mutate billing/license/runtime state and requires a
+separate explicit approval. No such approval was present in this slice, so the
+gate remains blocked.
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index 22532cd5b8..f1f8e59807 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -8225,6 +8225,12 @@
"kind": "file",
"evidence_tier": "production-observed"
},
+ {
+ "repo": "pulse",
+ "path": "docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-read-only-reconciliation-2026-07-21.md",
+ "kind": "file",
+ "evidence_tier": "production-observed"
+ },
{
"repo": "pulse",
"path": "docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-remediation-prepared-2026-07-14.md",
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 0882f83b18..2fda5b71e7 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -1364,9 +1364,14 @@ Stripe state even when the requested flag already matches, newly created
subscription schedules are durably attached to their quote before later Stripe
or local completion steps, schedule-release retries repair the local quote, and
the authoritative backfill can reopen a terminal inbox event through the
-cursor-aware retry path. The implementation is not yet a released self-
-service capability: the governed external Stripe transition matrix, event-
-order/reconciliation exercise and Relay version-floor proof remain required by
+cursor-aware retry path. Payment-failure delivery also re-fetches and projects
+the current authoritative Stripe subscription instead of trusting the invoice
+event's historical failure state or the locally cached plan. Inbox-level proof
+covers a missed recovery, a later-delivered historical invoice failure, and a
+duplicate replay without state or license-version regression. The
+implementation is not yet a released self-service capability: the governed
+external Stripe transition matrix, event-order/reconciliation exercise and
+Relay version-floor proof remain required by
`self-hosted-commercial-transition-coherence`. Cloud remains unavailable and
MSP remains an assisted preview.
@@ -1401,6 +1406,19 @@ until the external Stripe lifecycle transition/event-reconciliation matrix and
real Relay license-version-floor exercise pass. The evidence record is
`docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-production-remediation-2026-07-15.md`.
+The 2026-07-21 safe re-audit kept that production catalog/portal result green
+and found a missing-event defect in local payment-failure handling: the shared
+subscription cursor rejects a failure older than an observed recovery, but it
+cannot protect against a recovery event that never arrived. A later-delivered
+historical invoice failure could therefore regress already-recovered Stripe
+state. The license server now re-fetches the current Stripe subscription before
+payment-failure projection, and inbox-level proof covers a missed recovery, the
+delayed failure, and a duplicate replay. The dated record also contains the
+executable isolated Stripe test-mode and joined Relay/Pulse operator packet:
+`docs/release-control/v6/internal/records/self-hosted-commercial-transition-coherence-read-only-reconciliation-2026-07-21.md`.
+This is test/read-only evidence, not the missing real-external exercise, so the
+gate remains blocked.
+
The Relay side now fails closed on missing feed authority, drains the feed
before serving, exposes feed staleness through readiness, and tears down stale
already-connected v6 sessions while clearing their reconnect tokens. Customer