Skip to content

feat(admin): operator commands for the gateway's configuration, the chain catalogue (diff, reload, chains, tokens, contracts) and every account's payouts - #227

Merged
pviti merged 2 commits into
milestone/nextfrom
feature/admin-config-catalog-payouts
Nov 27, 2026
Merged

pviti merged 2 commits into
milestone/nextfrom
feature/admin-config-catalog-payouts

Conversation

@pviti

@pviti pviti commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

go.mod requires the released rail0-go v1.12.0 (commercelayer/rail0-go#96, commercelayer/rail0-go#98 and commercelayer/rail0-go#99 are in it).

What

The last three groups under rail0 admin (OP10 and OP12 of the operator proposal).

Command What it does Writes
admin config [group] The configuration the gateway is running with, one setting a row; --overridden no
admin catalog The chain catalogue's snapshot against the database: what a reload would change no
admin catalog reload Rebuild the snapshot from the database, in the process that answers yes
admin catalog chains|tokens|contracts Whole catalogue rows, what is not in service included no
admin payouts (get, events) Every account's payouts no
admin payouts destinations (get, events) Every account's payout destinations no

Refused in agent mode like the rest of the group.

Decisions worth a look

  1. Two names differ from the proposal, to follow how the CLI is already shaped:
    • the catalogue lists are admin catalog chains|tokens|contracts, not admin chains|tokens|contracts: everything about the catalogue is under one command, next to the diff and the reload;
    • destinations are admin payouts destinations, not admin payout-destinations: the merchant's command is rail0 payouts destinations.
  2. admin config prints one setting a row (group, setting, value, env, source, overridden, description) in every output mode, where the gateway answers a nested table. A row is what a person reads and what jq 'select(.overridden)' filters; generated_at is the only thing left out. source is the gateway's own word for where the value comes from (constant, default, override, environment_file, from rail0-gateway#496) and is passed on as it comes; a gateway older than the field leaves it null. For a setting read from the environment's file there is no variable, and overridden means the file gives a value other than the code's.
  3. --overridden keeps the settings whose environment variable is set: what an environment changed from the defaults. An argument selects one group; an unknown one is refused with the list this gateway has.
  4. catalog reload asks first, after reading the diff: the question says how many changes are pending and that it changes one process only. It is not destructive, but it is what puts a database change live (a chain switched on starts taking payments).
  5. Token and contract rows get chain_id and chain_slug added by the command, read from the chain list: the rows carry only the catalogue's internal blockchain_id, and rail0 chains cannot name a chain that is not in service, which is what these lists exist for. One more request.
  6. catalog prints pending: 0: the SDK's type leaves a zero out, and zero is the answer looked for.
  7. A 404 under admin payouts names the feature: with payouts off the routes do not exist, and "the id may be wrong" alone would send the operator after an id.

Tests

gofmt, go vet ./..., go test ./... green; docs/cli and docs/man regenerated.

cmd/admin_catalog_test.go: the configuration as sorted rows with their fields, the source of each kind of setting and a gateway that names none, one group, an unknown group, --overridden for a variable and for the environment's file; the cells (a map of per-chain values, a flag, a null); the diff with and without pending changes; the chain list with a keyed endpoint's placeholder; chain_id and chain_slug added to tokens and contracts, a row whose chain is unknown left as it came; the reload refused without write mode with nothing sent, the diff read before the question, nothing reloaded without an answer, the write-mode token on the request, the question's wording for 0, 1 and several changes; the payout and destination filters, single reads and audit trails, their local refusals; the 404 hint, on these commands only.

Checked against staging (test operator key, session revoked afterwards)

  • admin config: 61 settings in 14 groups, --pretty at 150 and 100 columns, one group, an unknown group, the four settings staging overrides.
  • admin catalog: not stale, pending: 0; chains (10, four not in service), tokens (14), contracts, with out-of-service chains named by slug. Every RPC URL checked: no placeholder to resolve and nothing that looks like a key (staging uses public endpoints).
  • admin catalog reload: write_mode_required without write mode; in write mode the question, answered no; refused in agent mode.
  • admin payouts, destinations, get: 404 with the hint (the payouts feature is off on staging).

Not done live: the catalogue was not reloaded, and no payout row was read (staging has the feature off). Both are covered by the unit tests only.

@pviti pviti added this to the Next release milestone Nov 26, 2026
@pviti
pviti force-pushed the feature/admin-disputes-operators branch from cba6393 to 1f1dc5c Compare November 27, 2026 15:33
@pviti
pviti force-pushed the feature/admin-config-catalog-payouts branch from e445c28 to d62ef7d Compare November 27, 2026 15:34
@pviti
pviti force-pushed the feature/admin-disputes-operators branch from 1f1dc5c to e80104d Compare November 27, 2026 15:49
…hain catalogue and payouts

rail0 admin config [group]                     what the gateway is running with, one setting a row
rail0 admin catalog                            what a reload of the catalogue snapshot would change
rail0 admin catalog reload                     apply it (write mode, asks first, one process)
rail0 admin catalog chains|tokens|contracts    whole rows, what is not in service included
rail0 admin payouts [get|events]               every account's payouts, read-only
rail0 admin payouts destinations [get|events]  every account's payout destinations, read-only

Refused in agent mode like the rest of the group.

rail0-go at the branch of commercelayer/rail0-go#99.
The gateway's configuration report names a source for every setting
(constant, default, override, environment_file) since it reads part of its
settings from a file per environment (rail0-gateway#496). The row carries it
as it comes, the table has a column for it, and the help says what
"overridden" means for a setting that has no variable: the environment's
file gives a value other than the code's. A gateway older than the field
leaves it null.
@pviti
pviti force-pushed the feature/admin-config-catalog-payouts branch from d62ef7d to fe4b8cc Compare November 27, 2026 15:50
@pviti
pviti changed the base branch from feature/admin-disputes-operators to milestone/next November 27, 2026 15:50
@pviti
pviti marked this pull request as ready for review November 27, 2026 15:51
@pviti
pviti merged commit ca8ceb2 into milestone/next Nov 27, 2026
1 check passed
@pviti
pviti deleted the feature/admin-config-catalog-payouts branch November 27, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant