railyard/tools/reconcile-relay-rago/systemd/reconcile-relay-rago.service
caelum0x ee5070acb8 feat(railyard): nightly Relay and Rago shadow-metering reconciliation (RY-RG1)
tools/reconcile-relay-rago compares relay_cost_events with Rago relay_llm_usage
events for one UTC day, event by event: missing (dropped), dead-letter, amount
mismatch, duplicate across orgs, orphan and overdue pending. Drift over 0.5%,
any dead-letter or any duplicate pages the railyard ntfy topic; smaller findings
are reported at default priority. ry_rago_drift_ratio and per-key and per-org
figures go to VictoriaMetrics; a JSON report is kept per day. Both databases are
read in READ ONLY transactions, so no charge of record changes.

Includes systemd service and timer (04:20 UTC), installer, env sample, the
emitter flip checklist per lane, and 12 offline tests (fake psql, local ntfy and
VictoriaMetrics).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 02:09:50 +03:00

20 lines
601 B
Desktop File

[Unit]
Description=Railyard: reconcile Relay cost events with Rago usage for yesterday (RY-RG1)
Documentation=file:///srv/src/railyard/tools/reconcile-relay-rago/README.md
Wants=network-online.target
After=network-online.target docker.service
[Service]
Type=oneshot
EnvironmentFile=-/etc/products/reconcile-relay-rago.env
ExecStart=/usr/bin/python3 /srv/src/railyard/tools/reconcile-relay-rago/reconcile.py
StateDirectory=railyard/reconcile-relay-rago
StateDirectoryMode=0750
Nice=10
IOSchedulingClass=idle
MemoryMax=256M
TimeoutStartSec=20min
NoNewPrivileges=true
ProtectSystem=full
PrivateTmp=true