Finish RAILIANCE-WP-0017 consumption-mode enforcement
Read the resource-control open/restricted signal and refuse new orders that would exceed a restricted entity's published allowance. Open and missing signals stay unchanged. Safety paths admit with an exception.
This commit is contained in:
parent
bf8c26cd61
commit
34a3123799
8 changed files with 437 additions and 4 deletions
63
docs/consumption-mode-enforcement.md
Normal file
63
docs/consumption-mode-enforcement.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# Consumption-mode enforcement
|
||||
|
||||
Work record: `RAILIANCE-WP-0017-T01`
|
||||
Signal owner: `resource-control` (`docs/resource-procurement-facility.md`)
|
||||
Terms: `resource-control/docs/TermsOfResourceProcurement.md` § 11.4
|
||||
|
||||
`resource-control` publishes `open` / `restricted` and the remaining
|
||||
transfer-price allowance. This repo refuses **new orders** and **elastic
|
||||
usage** that would exceed that allowance. It does not throttle a running
|
||||
cluster and does not cancel a committed provider contract (OQ-2).
|
||||
|
||||
## Signal
|
||||
|
||||
Default file: `data/consumption-mode/current.json`
|
||||
|
||||
Shape (one record or a list):
|
||||
|
||||
```json
|
||||
{
|
||||
"schema_version": "0.1",
|
||||
"record_type": "consumption_mode",
|
||||
"financial_entity_id": "entity:coulomb",
|
||||
"period": "2026-09",
|
||||
"consumption_mode": "restricted",
|
||||
"new_transfer_charges_allowed_eur": "45.83",
|
||||
"terms_version": "0.1"
|
||||
}
|
||||
```
|
||||
|
||||
Refresh after a settlement close by writing that file (or pointing
|
||||
`CONSUMPTION_MODE_FILE` at a settlement-statement JSON — the helper
|
||||
projects `next_month_allowance_eur`). An empty list means no entity is
|
||||
restricted. Missing mode is **not** `open` and **not** `restricted`; it
|
||||
does not refuse.
|
||||
|
||||
`entity:railiance` is the procuring entity and is never restricted.
|
||||
|
||||
## Check
|
||||
|
||||
```bash
|
||||
make consumption-preflight \
|
||||
CONSUMING_ENTITY=entity:coulomb \
|
||||
ESTIMATE_EUR=20 \
|
||||
CONSUMPTION_CLASS=new-order
|
||||
```
|
||||
|
||||
| Class | Restricted behaviour |
|
||||
| --- | --- |
|
||||
| `new-order` / `elastic` | Refuse if estimate is missing or greater than the allowance |
|
||||
| `safety` | Admit; print an exception line (backup, identity, ingress needed to avoid data loss) |
|
||||
| `committed` | Admit; flag for human financial authority (do not cancel) |
|
||||
|
||||
## Where it is wired
|
||||
|
||||
| Target | Class | Notes |
|
||||
| --- | --- | --- |
|
||||
| `make consumption-preflight` | caller-supplied | required on any new consuming order |
|
||||
| `make apps-pg-deploy` | `new-order` | only when `CONSUMING_ENTITY` is set (a new consumer, not a re-apply) |
|
||||
| `make valkey-deploy` | `new-order` | already gated; would still have to pass this check |
|
||||
| Backup / restore deploys | `safety` | continue under restriction; overage is an exception |
|
||||
|
||||
A restricted entity cannot place a new order that would exceed the
|
||||
published allowance. An `open` entity is unchanged.
|
||||
|
|
@ -15,6 +15,7 @@ unless the consumer-visible fields change.
|
|||
| Standing runtime secret | `ccr-workload-kv.v1` | Workloads that need a KV path via External Secrets | `schemas/credential-change-request.schema.yaml` |
|
||||
| Short-lived lease | `credential-grant.v1` | Operators/agents and dynamic DB roles | `credential-grants/catalog.yaml` |
|
||||
| Rapp credential bind | `rapp-lane.v1` | How a rapp names the two lanes above | `docs/rapp-credential-lane-binding.md` |
|
||||
| Consumption-mode gate | `consumption-mode.v1` | New orders for a restricted financial entity | `docs/consumption-mode-enforcement.md` |
|
||||
|
||||
## Compatibility rules
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue