Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Customer demo packs

A demo pack is everything one customer's demo needs, in one file: the mocks of their APIs, the portal items that show them, the saved tests, the storyboard and a console title. You apply it before the meeting and tear it down after it, and the instance is what it was before.

A pack is a rustybin.yaml document with a pack: header. Applying it creates a project named after the pack and puts every resource in it, so the teardown removes what that project holds and never has to guess by name.

A pack

# A demo pack: everything the Acme demo needs, in one file.
#   rustybin pack apply acme-pack.yaml --dry-run
#   rustybin pack apply acme-pack.yaml
#   rustybin pack teardown acme
version: 2
pack:
  name: acme
  title: Acme checkout
  customer: Acme Corp
  notes: Thursday 10:00, with their platform team
  console_title: Acme demo
mocks:
  - name: acme-orders
    spec_inline:
      openapi: 3.0.3
      info: { title: Acme Orders, version: "1" }
      paths:
        /orders/{id}:
          get:
            operationId: getOrder
            parameters:
              - { name: id, in: path, required: true, schema: { type: integer } }
            responses:
              "200":
                description: The order
                content:
                  application/json:
                    example: { id: 1, status: paid, total: 42.5 }
portal:
  items:
    - { id: "mock:acme-orders", title: Acme Orders API, tags: [acme] }
tests:
  - name: acme-order-1
    request: { path: /mock/acme-orders/orders/1 }
    assert: [{ status: 200 }, { json: $.status, equals: paid }]
test_schedules:
  - { name: acme-hourly, every: 1h, names: [acme-order-1], enabled: false }
storyboards:
  - name: acme-demo
    title: Acme checkout through the gateway
    steps:
      - title: The Acme Orders API
        talk_track: This is **your** Orders API, mocked from your spec.
        action: { type: open_view, route: "#/mocks/acme-orders" }
      - title: An order
        action: { type: run_test, name: acme-order-1 }
      - title: Questions
pack:
nameThe pack's name and its project's: letters, digits, ., _, -
title, customer, notesWho it is for and what to remember; shown with the applied pack
console_titleThe console's title while the pack is applied. The teardown puts back what was there

A pack carries these sections and no others:

SectionIn a pack
mocksThe mocks, each with its spec inline (spec_inline). They go to the pack's project
portalPortal items of the pack's own mocks (mock:<name>)
testsSaved tests, in the pack's project
test_schedulesSchedules that name the pack's own tests (names:, no prefix)
storyboardsStoryboards, in the pack's project

Anything else is refused by name: settings, secrets, users, roles, projects, registry, agents, harness, instance, health. A pack never carries a secret value: a test's or a storyboard's credential is a {{VARIABLE}}, as everywhere.

Preview, then apply

Send the pack as the body, or as {"document": ..., "dry_run": true}. The preview runs the same checks as the apply (the specs are compiled, the tests and storyboards validated) and changes nothing:

POST {{base_url}}/_rustybin/packs/apply?dry_run=true
Authorization: Bearer {{admin_token}}
Content-Type: application/yaml
file,acme-pack.yaml;
HTTP 200
[Asserts]
jsonpath "$.dry_run" == true
jsonpath "$.project" == "acme"
jsonpath "$.would_create.mocks[0]" == "acme-orders"
jsonpath "$.would_create.storyboards[0]" == "acme-demo"
jsonpath "$.console_title" == "Acme demo"
POST {{base_url}}/_rustybin/packs/apply
Authorization: Bearer {{admin_token}}
Content-Type: application/yaml
file,acme-pack.yaml;
HTTP 201
[Asserts]
jsonpath "$.dry_run" == false
jsonpath "$.created.mocks[0]" == "acme-orders"
jsonpath "$.created.portal_items[0]" == "mock:acme-orders"
jsonpath "$.created.tests[0]" == "acme-order-1"
jsonpath "$.created.test_schedules[0]" == "acme-hourly"

The mock is deployed, the project holds everything, and the storyboard runs:

GET {{base_url}}/mock/acme-orders/orders/1
HTTP 200
[Asserts]
jsonpath "$.status" == "paid"

GET {{base_url}}/_rustybin/projects/acme
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.resources.mocks[0]" == "acme-orders"
jsonpath "$.resources.storyboards[0]" == "acme-demo"

POST {{base_url}}/_rustybin/storyboards/acme-demo/steps/2/run
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.ok" == true

An apply is a unit:

  • A name that is taken is refused, never overwritten: the project, a mock, a portal item, a saved test, a schedule or a storyboard of that name. The answer is 409 with reason: name_taken and the collisions.
  • A pack with a problem is refused whole (422, reason: invalid_pack, the problems): a spec that does not compile, a test that does not validate. Nothing is left behind.
POST {{base_url}}/_rustybin/packs/apply
Authorization: Bearer {{admin_token}}
Content-Type: application/yaml
file,acme-pack.yaml;
HTTP 409
[Asserts]
jsonpath "$.reason" == "name_taken"
jsonpath "$.collisions[0].kind" == "project"
jsonpath "$.collisions[1].name" == "acme-orders"
POST {{base_url}}/_rustybin/packs/apply
Authorization: Bearer {{admin_token}}
{
  "document": "pack: {name: sneaky}\nusers:\n  - {name: mallory, roles: [admin]}\n",
  "dry_run": true
}
HTTP 400
[Asserts]
jsonpath "$.error" contains "not users"

Applying needs config.apply and users.manage (a project is created), and settings.write with settings.security for a console_title. At most 20 packs are applied at once.

A pack from someone you do not vouch for is applied with untrusted: true (?untrusted=true, --untrusted), which holds it to what a document from a repository may do: a test or a storyboard step cannot point at a gateway, and a schedule cannot name a webhook.

What is applied

GET {{base_url}}/_rustybin/packs
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.packs[0].name" == "acme"
jsonpath "$.packs[0].customer" == "Acme Corp"
jsonpath "$.packs[0].holds.mocks[0]" == "acme-orders"

holds is what the pack's project holds now, which is what a teardown would remove.

Tear it down

A dry run lists it first:

DELETE {{base_url}}/_rustybin/packs/acme?dry_run=true
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.would_remove.mocks[0]" == "acme-orders"
jsonpath "$.would_remove.test_schedules[0]" == "acme-hourly"
jsonpath "$.console_title" == "would be restored"
DELETE {{base_url}}/_rustybin/packs/acme
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.ok" == true
jsonpath "$.removed.storyboards[0]" == "acme-demo"
jsonpath "$.console_title" == "restored"

GET {{base_url}}/mock/acme-orders/orders/1
HTTP 404

GET {{base_url}}/_rustybin/projects/acme
Authorization: Bearer {{admin_token}}
HTTP 404

The teardown removes what the project holds now: the mocks with their portal items, the saved tests, the storyboards and any checkpoint saved in the project, then the pack's schedules and the project itself. It follows the project, not the document:

  • a mock or test somebody added to the project during the demo goes with it;
  • a resource somebody moved out of the project stays;
  • the console title is put back only when it is still the one the pack set.

After a teardown an export of the instance is byte for byte what it was before the apply.

A demo built by hand becomes a pack

Any project exports as a pack: its mocks (specs inline) with their portal items, its saved tests, the schedules that run only those tests, and its storyboards.

GET {{base_url}}/_rustybin/packs/acme/export
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
header "Content-Type" contains "yaml"
body contains "customer: Acme Corp"
body contains "name: acme-orders"
body not contains "project:"

Build the demo in the console in a project, export it, and apply the file on the instance you present from.

From the command line

rustybin pack apply acme-pack.yaml --dry-run
rustybin pack apply acme-pack.yaml
rustybin pack list
rustybin pack export acme --output acme-pack.yaml
rustybin pack teardown acme --dry-run
rustybin pack teardown acme

pack apply also takes a directory: its rustybin.yaml, with each mock's spec: file (a path inside the directory) read on your machine and sent inline. An instance reads no files, so a pack sent to the API with a spec: path is refused.

acme-pack/
  rustybin.yaml        # pack: {name: acme}, mocks: [{name: acme-orders, spec: specs/orders.yaml}]
  specs/orders.yaml

An agent does the same with the management MCP prompt prepare_customer_demo: it previews the pack, applies it when you agree, rehearses its storyboard and tells you how to tear it down.

On every surface

SurfaceWhere
APIPOST /_rustybin/packs/apply (dry_run, untrusted; JSON, or the pack as application/yaml), GET /_rustybin/packs, DELETE /_rustybin/packs/{name} (?dry_run=true), GET /_rustybin/packs/{name}/export (?format=json)
ConsoleManagement, Packs: choose a file or paste a pack, Preview, Apply; the applied packs with What it holds, export and Tear down (confirmed)
CLI`rustybin pack apply <file
Management MCPapply_pack (dry_run, untrusted), list_packs, teardown_pack (confirmed; dry_run is not), export_pack; the prompt prepare_customer_demo (agent page)
rustybin.yamlThe pack: header marks a pack; an export of the instance never has one, and POST /_rustybin/config/apply does not take one