Railyard side of PY1.5 (dispatch 5.3). Acceptance:
1. tests/contract/consumers/contract.json is the contract PM1.5, PR1.5 and
the Scribase carve-out test against: env names (RELAY_URL, RELAY_KEY,
RAGO_URL, RAGO_API_KEY, MINT_URL, MINT_API_KEY, RAILYARD_LIVE), the
RAILYARD_LIVE switch (default 0), every product's meters and one sample
event per meter with the <product>:<meter>:<source id> idempotency key.
2. apps/rago/seeds/portfolio/{scribase,menivor,rally}-portfolio.json define
exactly those meters (valid Rago aggregations, field names where summed)
under $0 mirror plans; consumers.test.ts checks seeds against the contract.
4. tools/reconcile-portfolio/reconcile.mjs compares each product's own counts
with Rago's totals per customer, meter and month; on the fixtures the
difference is 0, and dropped, extra or malformed rows are named (exit 1/2).
5. Nothing switches live in code: docs/CONSUMERS.md gains the Wave P switch
table. scripts/relay/provision-product-keys.mjs prints names and the box
steps only (no value is generated, read or printed).
3 (Mint stack, 128 MiB, /metrics scraped): infra-box stacks/mint; Mint's
/metrics handler exists since RY-MT1.
Not in this commit: Mint outbound event webhooks and the paid-event mirror
(see the lane report).
Tests: consumers 3/3, reconcile 2/2, provision 1/1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { execFileSync } from "node:child_process";
|
|
import { readFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { plan, render } from "../provision-product-keys.mjs";
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
const contract = JSON.parse(readFileSync(join(HERE, "../../../tests/contract/consumers/contract.json"), "utf8"));
|
|
|
|
test("one plan per product with names only, never a value", () => {
|
|
const p = plan(contract);
|
|
assert.deepEqual(p.map((x) => x.product), ["scribase", "menivor", "rally"]);
|
|
const text = render(p) + JSON.stringify(p);
|
|
assert.doesNotMatch(text, /sk-t0-|whsec_|rago_live_|[A-Fa-f0-9]{32,}/);
|
|
for (const x of p) assert.ok(x.vars.includes("RAILYARD_LIVE=0"), "nothing switches live by default");
|
|
const out = execFileSync(process.execPath, [join(HERE, "../provision-product-keys.mjs"), "--json"], { encoding: "utf8" });
|
|
assert.equal(JSON.parse(out).length, 3);
|
|
});
|