Vai al contenuto principale
BlueForge
Inizia gratis

Agent pack

Probes: proving a server-to-server chain end to end

How to prove a service-to-service chain works — the probe method and its failure modes.

Rendered from docs/agent-pack/probes.mdrelease v0.2.0Edit on forge-git

Source: the forge-biz session, 2026-10-11 (its tags kept; this is its final account and supersedes earlier versions, including one that named a wrong cause). Status of the only example, tenant-probe: MERGED in forge-biz (#392; fix #393 merged; a small follow-up PR open). Not published, no version: it is repo scripts. It has run live against production, scratch tenants only, with the operator's approval, and passed. Everything about conventions is one build's experience, an opinion, not a verified fleet standard.

Why a probe, not an audit

Screen-audit, user-audit (user-flows) and verify-flows are browser or file checks. They cannot prove a chain of API calls between services, or that a running container loaded its config. A probe is a scripted assertion chain with a read-back and cleanup, run from a terminal (no browser login). Name it <thing>-probe; avoid "audit" (read-only browser tools) and "flow" (UI specs). No central probe store exists. A probe reports to stdout only; test.run into app-dev-db is possible but needs an operator-provisioned producer secret (app-dev-db.md) and nobody has asked for one.

Example: tenant-probe (forge-biz scripts/ops/tenant-probe.mjs)

  • Covers (taskmaster leg): POST /federation/users twice (same user+workspace both times), mint a short-lived projects:write key, create a project with it, read it back, delete it, revoke the key, then confirm the revoked key gets 401/403.
  • Second leg, --via-api (14 vitest cases against a fake API, mutation-checked once; later PASSED live, below): drives forge-biz's own onboarding API (POST /v1/onboarding/org for a scratch tenant, then POST .../projects) and passes only if the saga's taskmaster-project step is done, which is what proves the deployed container loaded TASKMASTER_ADMIN_KEY. Credential $BIZ_ONBOARDING_TOKEN or a 0600 file in ~/.forge-secrets; it never reads the workspace-store tokens in the responses. It leaves a scratch tenant row (forge-biz has no tenant-delete route). The report carries leg: 'taskmaster' | 'forge-biz-api' (additive; schema id unchanged).
  • Interface: node scripts/ops/tenant-probe.mjs [--confirm] [--slug s] [--url u] [--key-file p] [--json]; no config file.
  • Output: stdout table, or --json with {schema:'blueforge.forge-biz.tenant-probe/1', mode:'dry-run'|'live', base, slug, ok, steps:[{name, ok, status, detail}], leftover?}. A test asserts no key string appears in the report.
  • Exit codes: 0 ok (and every dry run), 1 a step failed, 2 usage/unsafe config, 3 no credential or key rejected at provision. (Exit 2 was run; 1 and 3 are covered only indirectly: UNVERIFIED as process exit codes.)

Safety model to copy

  • Dry run by default (no network; prints the plan). A write needs an explicit --confirm. The plan list doubles as the dry run.
  • Never a real target: use an allowlist. Act only on a scratch slug (default probe-<yyyymmdd>); the example now requires the slug to start probe- (verified: ran the refusal, tests). Its first version used a denylist of two known tenants, which was weak (a new real tenant was unprotected); do not copy that.
  • Refuse plain http (except localhost) and a credential file wider than 0600. Read credentials from an env var or a 0600 file, never argv, never printed; read the key file only under --confirm.
  • Cleanup in finally: the minted key is always revoked and the probe project deleted, even when an earlier step fails; report what it could not clean up (leftover). Here the scratch tenant's user and workspace cannot be deleted (no route), so reruns reuse them through an idempotent external ref.
  • Inject fetch so tests use a fake server that can bend one rule per test. Mutation-check the assertions: break one check and confirm its test fails.

Live results (VERIFIED by the forge-biz session; production, scratch tenants only)

  • Taskmaster leg PASSED in full: provision (201, then 200 idempotent), mint into the tenant user, create project, read back, delete project, revoke, revoked key refused with 401.
  • --via-api PASSED (forge-biz's own onboarding API, the deployed container): the taskmaster-project step was done, first on the old saga, then on the fixed build with no revoke warning.

What the probe found (this is the value):

  1. taskmaster prod users lacked password_hash (migration 0003; 0008's columns were present), so POST /federation/users answered 500. Fixed by the taskmaster session. The forge-biz session's first two guesses at the cause were wrong; the database's own error line named the column.
  2. Revoke asymmetry: a key minted into a tenant user can be revoked only by that user (the key itself) or federation:admin; the minter (the provisioner) gets 403. forge-biz's saga swallowed that error, leaving live 7-day write keys. Fixed in forge-biz#393; taskmaster#75 (open, not required) would let the provisioner revoke too.
  3. The deployed container did not have TASKMASTER_ADMIN_KEY although the env store did: env is read at container creation, so a redeploy was needed. Only the --via-api leg could see this.

Lessons: read the database's error, not the query text. Run the probe through the deployed path (--via-api), not only the downstream service. Fail on warnings that signal a live credential (a swallowed revoke error is a live key). A write probe leaves residue when the service has no delete route: say so in the report (leftover, leftoverKey).

Logic in scripts/lib/<name>/, a thin CLI in scripts/ops/<name>.mjs, tests beside the repo's other script tests. runProbe({base, key, fetch, confirm}) returns a schema-tagged report. Exit codes 0/1/2/3 as above, --json carries a schema id. CI: none from the author, and do not run a write probe in CI without a dedicated scratch tenant and a scoped key.

Reuse

The code is specific to forge-biz and taskmaster (endpoints hardcoded); nothing is shared or published; there is no central reporting (no app-dev-db or mission-control) and it is not run in CI. The reusable part is the shape (plan list, report schema, fake-server harness). UNVERIFIED that it generalises: it has not been tried in a second repo. A second repo copies the three files and rewrites the step list for its own service.

Rules for agents

  • Do not run a probe with --confirm against production, create tenants/projects, or mint keys unless the operator approved that exact run (this one ran in production only with that approval). Dry run is always fine.
  • Never point a probe at a real tenant. If you write a new probe, copy the safety model above, including cleanup and the leftover report.
  • Say plainly when a probe has only run against a fake, and what a failed live run actually showed.

Resta aggiornato

Note di rilascio e accesso anticipato

Una sola email quando esce qualcosa: nuove funzionalità della piattaforma, nuove app e inviti ai lanci. Iscriviti alla lista d'attesa per ottenere l'accesso anticipato alla registrazione self-service e ai siti promozionali.

Nessuno spam. Puoi annullare l'iscrizione con un clic.