Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions sla-credit-revenue-guard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SLA Credit Revenue Guard

This module adds a focused Revenue Infrastructure slice for issue #20. It evaluates institutional contracts, AI compute usage, service incidents, and anonymized licensing exports before invoice release.

It covers:

- tiered subscription plan rules for individual, lab, and institutional accounts
- AI compute usage metering, included quotas, and overage invoice lines
- SLA uptime measurement and capped service-credit calculations
- institutional invoice packets with approval and postmortem warnings
- licensing/API export readiness checks that block private content and weak aggregation
- stable audit digests for finance review and revenue operations traceability

This is not another generic billing ledger, tax module, renewal true-up, margin guard, pricing experiment, or procurement workflow. The focus is the operational revenue moment when an outage or service-level breach must be converted into an auditable credit before billing AI compute and institutional licensing access.

## Local Validation

```sh
node sla-credit-revenue-guard/test.js
node sla-credit-revenue-guard/demo.js
```

## Demo Evidence

- [demo.mp4](demo.mp4) shows the problem, implementation scope, invoice packet, and validation commands.
- [demo.svg](demo.svg) provides a static finance dashboard preview.
- [requirements-map.md](requirements-map.md) maps the implementation to issue #20.
- [acceptance-notes.md](acceptance-notes.md) lists reviewer checks.
12 changes: 12 additions & 0 deletions sla-credit-revenue-guard/acceptance-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Acceptance Notes

Reviewer checks:

1. Run `node sla-credit-revenue-guard/test.js`.
2. Run `node sla-credit-revenue-guard/demo.js`.
3. Confirm institutional usage over quota creates an AI compute overage line.
4. Confirm SLA incidents below the contracted uptime produce capped service credits.
5. Confirm private or under-aggregated licensing exports hold the invoice.
6. Confirm audit digests remain stable for the same input.

The module is dependency-free and uses synthetic revenue events only, so it can be reviewed without payment credentials, cloud accounts, or private customer data.
41 changes: 41 additions & 0 deletions sla-credit-revenue-guard/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use strict";

const { evaluateRevenueGuard } = require("./index");

const result = evaluateRevenueGuard({
period: { id: "2026-05", totalMinutes: 43_200 },
contracts: [
{
customerId: "midwest-university",
plan: "institutional",
monthlyBaseCents: 275000,
includedComputeUnits: 50000,
overageUnitCents: 7,
},
],
usageEvents: [
{ customerId: "midwest-university", computeUnits: 42_500 },
{ customerId: "midwest-university", computeUnits: 11_000 },
],
incidents: [
{
id: "inc-ai-review-outage",
impactMinutes: 75,
impactedCustomerIds: ["midwest-university"],
postmortemReady: true,
},
],
licensingExports: [
{
customerId: "midwest-university",
billableCents: 80000,
minimumAggregationCount: 100,
privateContentIncluded: false,
customerNoticeReady: true,
},
],
});

console.log("SLA credit revenue guard demo");
console.log(JSON.stringify(result.dashboard, null, 2));
console.log(JSON.stringify(result.packets[0], null, 2));
Binary file added sla-credit-revenue-guard/demo.mp4
Binary file not shown.
23 changes: 23 additions & 0 deletions sla-credit-revenue-guard/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading