business: the human adds and changes role instances from the CLI and the Console (row 165, Q171, #1662)

`mosaic business instances BUSINESS` reads the role instances, and
`mosaic business instance add|set` writes one add or change through the
broker's new human-only `instances` and `instances.set` verbs. The writer is
packages/business/src/instance-settings.mjs. It takes the caller's revision,
validates the next document, refuses a definition that declares credentials
(organization-credentials-out-of-scope), keeps protected instances as they
are, logs the human as the actor, and says when the running bus needs a
restart. Neither command restarts the bus.

The writer refuses the instance ids human and tester with invalid-request,
because the broker refuses a business whose roles use either name when the
bus starts.

The Console's Settings view shows the instances and, under --send only,
posts to POST /api/instances with the exact Origin and same-origin Fetch
Metadata. A refusal keeps the draft. An answer without the view's shape is
outcome-unknown (503). The page's public/ diff carries the decision 123 go
in mos-0832.

Neither verb is in ORGANIZATION_KEYS, so no agent tool reaches them.

Owner Darkwing, brief in row 165 (#1662). Round 3 rebases round 2 onto
4f45cadc0 (row 156). The public/ +/- digest is 939ecd28...9444, unchanged
at landing. Reviewers on candidate manifest e30b54da...f580: Dewey
approve 29052, Filbert approve 29053. Seat run on 4f45cadc0: 1436/0
singles, 37/37 mutants killed. Sage gate on e8b09735a: GATE_PASSED 25/25,
packages 2282/0, queue node 156/0, script selftests 422/0, 23:59:13Z to
00:05:35Z. Rebased onto 50a57e454 over two SESSIONS-only commits.

Nothing live.
This commit is contained in:
jason.woltje committed 2026-10-18 19:10:20 -05:00
1 parent 50a57e454b
commit 9466f3e5ed
24 files changed
+1343 -18

No files matched your search

+17
View File
@@ -221,6 +221,9 @@ abandon it) · `4` usage. Details: `packages/queue/README.md`.
```bash
scripts/mosaic business validate <business>
scripts/mosaic business resolve <business> <instance> [--project <id>]
scripts/mosaic business instances <business> [--json]
scripts/mosaic business instance add <business> <instance> --definition <def> [--vars <file>] [--launch] --revision <rev>
scripts/mosaic business instance set <business> <instance> [--definition <def>] [--vars <file>] [--launch | --no-launch] --revision <rev>
```
Reads `businesses/<business>.json` next to the system config
@@ -235,6 +238,20 @@ Exit codes: `0` ok · `2` invalid file or credential reference · `3` system
config problem · `4` usage or a required file missing. Details:
`packages/business/README.md`.
`instances` and `instance add|set` (row 165) go to `packages/cli` and the
bus's human-only `instances` and `instances.set` verbs, so they need a live
bus host and refuse inside an agent session. `instances` prints the revision,
each instance and the definitions `add` and `set` accept. `add` and `set`
write the business file under that revision and log the change with you as
the actor. They bind no credentials: a definition that declares credentials,
or a definition change on an instance that holds them, is refused with
`organization-credentials-out-of-scope` and stays a hand edit. After an add
or a definition change the output says a bus restart is needed; the restart
needs Mos's go or Jason's hand, and the command doesn't run it. Exit codes:
`0` ok · `2` refused, nothing written · `3` human proof refused · `4` usage.
The Console's Settings page has the same two forms. Details:
`packages/cli/README.md`.
## Inbox, decisions and the bus host (`scripts/mosaic`)
```bash
+16 -3
View File
@@ -25,9 +25,22 @@ bus schema.
- `mosaic inbox` shows no open decision. If one is open, resolve or
supersede it first, so step 6 starts from an empty inbox.
- The business has security-reviewer and merge-gate instances, and both
are in `launch.instances`. No verb adds an instance today, so Jason adds
them by editing the business file, then runs
`scripts/mosaic business validate <business>`.
are in `launch.instances`. Jason adds them with the row 165 command (or
the Console's Settings page), reading the revision first, then runs
`scripts/mosaic business validate <business>`:
```
scripts/mosaic business instances <business>
scripts/mosaic business instance add <business> security-reviewer --definition security-reviewer --launch --revision <rev>
scripts/mosaic business instances <business>
scripts/mosaic business instance add <business> merge-gate --definition merge-gate --launch --revision <rev>
scripts/mosaic business validate <business>
```
Each add prints the new revision, so the second add can take it instead
of a second read. Both adds say a bus restart is needed. The running bus
only learns the new instances at restart, which needs Mos's go or Jason's
hand.
- `arbiters.technical` is `cto`, which step 5 assumes.
## Steps