@bongos/core 1.19.184 → 1.19.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.bongos-core.json +59 -54
  2. package/clients/bongos-client/bongos-client.global.js +19 -19
  3. package/clients/bongos-client/index.cjs +19 -19
  4. package/clients/bongos-client/index.d.ts +29 -29
  5. package/clients/bongos-client/index.mjs +19 -19
  6. package/docs/adr/0157-archon-is-rank-and-identity-only.md +2 -2
  7. package/docs/api/openapi.json +117 -117
  8. package/docs/api-reference.md +10 -10
  9. package/docs/canonical-permissions.md +6 -6
  10. package/modules/dev-box/app/src/vendor/bongos-client.cjs +19 -19
  11. package/modules/government/catalog.js +7 -7
  12. package/modules/government/db.js +8 -8
  13. package/modules/government/migrations/government_002_rename_permission_keys.sql +112 -0
  14. package/modules/government/module.json +1 -1
  15. package/modules/government/protected-surfaces.json +0 -1
  16. package/modules/government/ranks.js +13 -13
  17. package/modules/government/routes/{governance.js → government.js} +105 -80
  18. package/modules/hall-ui/public/gate.js +1 -1
  19. package/modules/hall-ui/public/governance.js +38 -38
  20. package/modules/hall-ui/public/harbor.js +2 -2
  21. package/modules/hall-ui/public/shell.js +3 -3
  22. package/modules/hall-ui/public/watch.js +1 -1
  23. package/modules/lifecycle/routes/gate-approvals.js +1 -1
  24. package/package-lock.json +2 -2
  25. package/package.json +1 -1
  26. package/scripts/gds/publish-manifest.js +0 -2
  27. package/scripts/gds/seed-governance-tasks.js +1 -1
  28. package/src/bongos/auth.js +7 -7
  29. package/src/bongos/module-scope-map.js +7 -22
  30. package/src/bongos/route-rank-check.js +12 -18
  31. package/src/bongos/serve-internal.js +2 -2
  32. package/src/module-api.js +4 -2
  33. package/tests/governance_abuse_matrix.mjs +32 -32
  34. package/tests/governance_catalog.mjs +3 -3
  35. package/tests/governance_fold.mjs +2 -2
  36. package/tests/governance_fold_bench.mjs +2 -2
  37. package/tests/governance_live_proof.mjs +4 -4
  38. package/tests/governance_ownership_scope.mjs +1 -1
  39. package/tests/governance_page_gates.mjs +4 -4
  40. package/tests/governance_principals.mjs +2 -2
  41. package/tests/governance_protected_surfaces.mjs +41 -16
  42. package/tests/governance_require_permission.mjs +5 -5
  43. package/tests/governance_resolver.mjs +2 -2
  44. package/tests/governance_role_sync.mjs +23 -23
  45. package/tests/governance_routes.mjs +94 -94
  46. package/tests/governance_seed.mjs +24 -9
  47. package/tests/governance_session_scope.mjs +4 -4
  48. package/tests/hall_page_gate_map.mjs +2 -2
@@ -334,25 +334,25 @@ export function createClient(opts = {}) {
334
334
  // POST /goals/reorder — rank: metic+archon — POST /goals/reorder
335
335
  postGoalsReorder: (args) => request("POST", "/goals/reorder", { hasBody: true }, args),
336
336
  },
337
- "governance": {
338
- // GET /governance/assignments — rank: archon — GET /governance/assignments
339
- getGovernanceAssignments: (args) => request("GET", "/governance/assignments", { hasBody: false }, args),
340
- // POST /governance/assignments — rank: archon — POST /governance/assignments
341
- postGovernanceAssignments: (args) => request("POST", "/governance/assignments", { hasBody: true }, args),
342
- // DELETE /governance/assignments/{builderId}/{roleKey} — rank: archon — DELETE /governance/assignments/:builderId/:roleKey
343
- deleteGovernanceAssignmentsBuilderIdRoleKey: (args) => request("DELETE", "/governance/assignments/{builderId}/{roleKey}", { hasBody: false }, args),
344
- // GET /governance/permissions — rank: archon — GET /governance/permissions
345
- getGovernancePermissions: (args) => request("GET", "/governance/permissions", { hasBody: false }, args),
346
- // GET /governance/roles — rank: archon — GET /governance/roles
347
- getGovernanceRoles: (args) => request("GET", "/governance/roles", { hasBody: false }, args),
348
- // POST /governance/roles — rank: archon — POST /governance/roles
349
- postGovernanceRoles: (args) => request("POST", "/governance/roles", { hasBody: true }, args),
350
- // DELETE /governance/roles/{roleKey}/permissions/{permissionKey} — rank: archon — DELETE /governance/roles/:roleKey/permissions/:permissionKey
351
- deleteGovernanceRolesRoleKeyPermissionsPermissionKey: (args) => request("DELETE", "/governance/roles/{roleKey}/permissions/{permissionKey}", { hasBody: false }, args),
352
- // PUT /governance/roles/{roleKey}/permissions/{permissionKey} — rank: archon — PUT /governance/roles/:roleKey/permissions/:permissionKey
353
- putGovernanceRolesRoleKeyPermissionsPermissionKey: (args) => request("PUT", "/governance/roles/{roleKey}/permissions/{permissionKey}", { hasBody: true }, args),
354
- // POST /governance/roles/{roleKey}/reset — rank: archon — POST /governance/roles/:roleKey/reset
355
- postGovernanceRolesRoleKeyReset: (args) => request("POST", "/governance/roles/{roleKey}/reset", { hasBody: true }, args),
337
+ "government": {
338
+ // GET /government/assignments — rank: archon — GET /government/assignments
339
+ getGovernmentAssignments: (args) => request("GET", "/government/assignments", { hasBody: false }, args),
340
+ // POST /government/assignments — rank: archon — POST /government/assignments
341
+ postGovernmentAssignments: (args) => request("POST", "/government/assignments", { hasBody: true }, args),
342
+ // DELETE /government/assignments/{builderId}/{rankKey} — rank: archon — DELETE /government/assignments/:builderId/:rankKey
343
+ deleteGovernmentAssignmentsBuilderIdRankKey: (args) => request("DELETE", "/government/assignments/{builderId}/{rankKey}", { hasBody: false }, args),
344
+ // GET /government/permissions — rank: archon — GET /government/permissions
345
+ getGovernmentPermissions: (args) => request("GET", "/government/permissions", { hasBody: false }, args),
346
+ // GET /government/ranks — rank: archon — GET /government/ranks
347
+ getGovernmentRanks: (args) => request("GET", "/government/ranks", { hasBody: false }, args),
348
+ // POST /government/ranks — rank: archon — POST /government/ranks
349
+ postGovernmentRanks: (args) => request("POST", "/government/ranks", { hasBody: true }, args),
350
+ // DELETE /government/ranks/{rankKey}/permissions/{permissionKey} — rank: archon — DELETE /government/ranks/:rankKey/permissions/:permissionKey
351
+ deleteGovernmentRanksRankKeyPermissionsPermissionKey: (args) => request("DELETE", "/government/ranks/{rankKey}/permissions/{permissionKey}", { hasBody: false }, args),
352
+ // PUT /government/ranks/{rankKey}/permissions/{permissionKey} — rank: archon — PUT /government/ranks/:rankKey/permissions/:permissionKey
353
+ putGovernmentRanksRankKeyPermissionsPermissionKey: (args) => request("PUT", "/government/ranks/{rankKey}/permissions/{permissionKey}", { hasBody: true }, args),
354
+ // POST /government/ranks/{rankKey}/reset — rank: archon — POST /government/ranks/:rankKey/reset
355
+ postGovernmentRanksRankKeyReset: (args) => request("POST", "/government/ranks/{rankKey}/reset", { hasBody: true }, args),
356
356
  },
357
357
  "grades": {
358
358
  // GET /grades/by-builder — rank: metic+archon — GET /grades/by-builder
@@ -22,7 +22,7 @@ Lars's directive (2026-08-05): **"Move all of these to metic, and make archon ju
22
22
 
23
23
  The literal reading of that directive — edit 41 `requireRank('archon')` call sites — was the wrong shape, and briefly the plan. BV1.R104/R105 (jaxri, tasks [1001846](https://cloudbongos.com/builders#/task/1001846)/[1001847](https://cloudbongos.com/builders#/task/1001847)) had migrated the route gates to `requirePermission(...)` and were sitting at `confirmed` — graded, verified, unmerged — for five days. They landed mid-session.
24
24
 
25
- Once every gate reads `requirePermission('<atom>')`, the rank floor is declared in exactly one place: `floor:` in [`modules/governance/catalog.js`](../../modules/governance/catalog.js). The delegation collapses from 41 call-site edits to **20 one-word floor changes in one table**. That is the ADR 0151 payoff arriving in practice, and it is worth recording as the concrete return on that refactor: the same owner decision was a 41-file diff on Monday and a 1-file diff on Tuesday.
25
+ Once every gate reads `requirePermission('<atom>')`, the rank floor is declared in exactly one place: `floor:` in [`modules/governance/catalog.js`](../../modules/government/catalog.js). The delegation collapses from 41 call-site edits to **20 one-word floor changes in one table**. That is the ADR 0151 payoff arriving in practice, and it is worth recording as the concrete return on that refactor: the same owner decision was a 41-file diff on Monday and a 1-file diff on Tuesday.
26
26
 
27
27
  ## Decision
28
28
 
@@ -82,7 +82,7 @@ Left alone, a Metic would open `/gate` and get a page rendering nothing but a 40
82
82
  1. **The exploit cookbook widened.** `security.report.adjudicate` guards `/security/docs` — the engagement-report store holding attacker-usable exploit detail — so that is now Metic-readable. Every other delegated atom widens who may *act*; this one widens who may *read*. If unwanted, the fix mirrors §4: split a `security.docs.read` at archon and let adjudication delegate. Recorded in `tests/security_docs.mjs` at the assertion that used to guard it.
83
83
  2. **The backward ratchet delegated.** [ADR 0154](<redacted>.md) made "unsatisfy stays Archon" the explicit safety argument for delegating criterion *create* — the forward ratchet moved, the backward one did not. `criterion.unsatisfy` is neither rank/identity nor an escalation key, so under this directive it moved, superseding that carve-out. What still holds is the part that never depended on rank: satisfy and unsatisfy remain **separate atoms**, so confirming a criterion never confers the power to un-confirm one.
84
84
 
85
- **A floor change needs a migration.** `governance_002`'s compat seed is run-once, so an edited `floor:` never reaches an already-migrated database. [`<redacted>.sql`](../../modules/governance/migrations/<redacted>.sql) grants the 20 to `metic` (+ `gate_approval.read` to both, since it is new). Lowering a floor is additive, so `tests/governance_seed.mjs`'s union model handles it and revokes nothing.
85
+ **A floor change needs a migration.** `governance_002`'s compat seed is run-once, so an edited `floor:` never reaches an already-migrated database. [`<redacted>.sql`](../../modules/government/migrations/<redacted>.sql) grants the 20 to `metic` (+ `gate_approval.read` to both, since it is new). Lowering a floor is additive, so `tests/governance_seed.mjs`'s union model handles it and revokes nothing.
86
86
 
87
87
  **`requireArchonPage` is now a misnomer** — it resolves `page.view.governance`, floor metic. Renaming it touches serve-internal, auth, and several test files; left deliberately to keep this diff small in authz code, and filed separately. The hall nav group was relabelled **Archon → Governance**, because a header reading "Archon" over items a Metic can open misdescribes the ladder to exactly the builders still learning it.
88
88
 
@@ -102,8 +102,8 @@
102
102
  "description": "Endpoints under `/api/bongos/goals`."
103
103
  },
104
104
  {
105
- "name": "governance",
106
- "description": "Endpoints under `/api/bongos/governance`."
105
+ "name": "government",
106
+ "description": "Endpoints under `/api/bongos/government`."
107
107
  },
108
108
  {
109
109
  "name": "grades",
@@ -3559,7 +3559,7 @@
3559
3559
  "gate-approvals"
3560
3560
  ],
3561
3561
  "summary": "GET /gate-approvals",
3562
- "description": "GET /gate-approvals — open PRs awaiting owner approval (gate-review red), with the verdict + per-file reasons + changed files + diff link. rank: metic+archon. BV1.R105 left this on requireRank because `gate_approval.decide` was declared over the /approve WRITE only and no atom named the read. ADR 0157 extends the catalog with exactly that atom — `gate_approval.read`, floor metic — so the mapping is now one the catalog makes. The split is load-bearing, not cosmetic: `page.view.governance` opens /gate to Metic, and without a Metic-readable data endpoint that page would render nothing but a 403. Approving a held PR stays archon (`.decide`, system).\n\n**Rank:** `metic+archon` — Metic or Archon rank (review/triage powers).\n\n**Permissions:** `gate_approval.read` (all required).",
3562
+ "description": "GET /gate-approvals — open PRs awaiting owner approval (gate-review red), with the verdict + per-file reasons + changed files + diff link. rank: metic+archon. BV1.R105 left this on requireRank because `gate_approval.decide` was declared over the /approve WRITE only and no atom named the read. ADR 0157 extends the catalog with exactly that atom — `gate_approval.read`, floor metic — so the mapping is now one the catalog makes. The split is load-bearing, not cosmetic: `page.view.government` opens /gate to Metic, and without a Metic-readable data endpoint that page would render nothing but a 403. Approving a held PR stays archon (`.decide`, system).\n\n**Rank:** `metic+archon` — Metic or Archon rank (review/triage powers).\n\n**Permissions:** `gate_approval.read` (all required).",
3563
3563
  "x-rank": "metic+archon",
3564
3564
  "x-source": "modules/lifecycle/routes/gate-approvals.js",
3565
3565
  "x-permissions": [
@@ -5101,18 +5101,18 @@
5101
5101
  ]
5102
5102
  }
5103
5103
  },
5104
- "/governance/assignments": {
5104
+ "/government/assignments": {
5105
5105
  "get": {
5106
- "operationId": "get_governance_assignments",
5106
+ "operationId": "get_government_assignments",
5107
5107
  "tags": [
5108
- "governance"
5108
+ "government"
5109
5109
  ],
5110
- "summary": "GET /governance/assignments",
5111
- "description": "governance.manage — every builder↔role assignment row.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5110
+ "summary": "GET /government/assignments",
5111
+ "description": "government.manage — every builder↔role assignment row.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5112
5112
  "x-rank": "archon",
5113
- "x-source": "modules/government/routes/governance.js",
5113
+ "x-source": "modules/government/routes/government.js",
5114
5114
  "x-permissions": [
5115
- "governance.manage"
5115
+ "government.manage"
5116
5116
  ],
5117
5117
  "responses": {
5118
5118
  "200": {
@@ -5120,7 +5120,7 @@
5120
5120
  "content": {
5121
5121
  "application/json": {
5122
5122
  "schema": {
5123
- "$ref": "#/components/schemas/GetGovernanceAssignmentsResponse"
5123
+ "$ref": "#/components/schemas/GetGovernmentAssignmentsResponse"
5124
5124
  }
5125
5125
  }
5126
5126
  }
@@ -5142,23 +5142,23 @@
5142
5142
  ]
5143
5143
  },
5144
5144
  "post": {
5145
- "operationId": "post_governance_assignments",
5145
+ "operationId": "post_government_assignments",
5146
5146
  "tags": [
5147
- "governance"
5147
+ "government"
5148
5148
  ],
5149
- "summary": "POST /governance/assignments",
5150
- "description": "governance.manage — assign a CUSTOM role to a builder. assigned_by is ALWAYS the session builder, never input (the audit trail's \"who did this\" must be the authenticated actor).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5149
+ "summary": "POST /government/assignments",
5150
+ "description": "government.manage — assign a CUSTOM role to a builder. assigned_by is ALWAYS the session builder, never input (the audit trail's \"who did this\" must be the authenticated actor).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5151
5151
  "x-rank": "archon",
5152
- "x-source": "modules/government/routes/governance.js",
5152
+ "x-source": "modules/government/routes/government.js",
5153
5153
  "x-permissions": [
5154
- "governance.manage"
5154
+ "government.manage"
5155
5155
  ],
5156
5156
  "requestBody": {
5157
5157
  "required": true,
5158
5158
  "content": {
5159
5159
  "application/json": {
5160
5160
  "schema": {
5161
- "$ref": "#/components/schemas/PostGovernanceAssignmentsRequest"
5161
+ "$ref": "#/components/schemas/PostGovernmentAssignmentsRequest"
5162
5162
  }
5163
5163
  }
5164
5164
  },
@@ -5185,18 +5185,18 @@
5185
5185
  ]
5186
5186
  }
5187
5187
  },
5188
- "/governance/assignments/{builderId}/{roleKey}": {
5188
+ "/government/assignments/{builderId}/{rankKey}": {
5189
5189
  "delete": {
5190
- "operationId": "delete_governance_assignments_builderId_roleKey",
5190
+ "operationId": "delete_government_assignments_builderId_rankKey",
5191
5191
  "tags": [
5192
- "governance"
5192
+ "government"
5193
5193
  ],
5194
- "summary": "DELETE /governance/assignments/:builderId/:roleKey",
5195
- "description": "governance.manage — remove a custom-role assignment. Idempotent: `removed` says whether a row went away.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5194
+ "summary": "DELETE /government/assignments/:builderId/:rankKey",
5195
+ "description": "government.manage — remove a custom-role assignment. Idempotent: `removed` says whether a row went away.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5196
5196
  "x-rank": "archon",
5197
- "x-source": "modules/government/routes/governance.js",
5197
+ "x-source": "modules/government/routes/government.js",
5198
5198
  "x-permissions": [
5199
- "governance.manage"
5199
+ "government.manage"
5200
5200
  ],
5201
5201
  "parameters": [
5202
5202
  {
@@ -5209,13 +5209,13 @@
5209
5209
  "description": "Path parameter `builderId`."
5210
5210
  },
5211
5211
  {
5212
- "name": "roleKey",
5212
+ "name": "rankKey",
5213
5213
  "in": "path",
5214
5214
  "required": true,
5215
5215
  "schema": {
5216
5216
  "type": "string"
5217
5217
  },
5218
- "description": "Path parameter `roleKey`."
5218
+ "description": "Path parameter `rankKey`."
5219
5219
  }
5220
5220
  ],
5221
5221
  "responses": {
@@ -5224,7 +5224,7 @@
5224
5224
  "content": {
5225
5225
  "application/json": {
5226
5226
  "schema": {
5227
- "$ref": "#/components/schemas/DeleteGovernanceAssignmentsBuilderIdRoleKeyResponse"
5227
+ "$ref": "#/components/schemas/DeleteGovernmentAssignmentsBuilderIdRankKeyResponse"
5228
5228
  }
5229
5229
  }
5230
5230
  }
@@ -5249,18 +5249,18 @@
5249
5249
  ]
5250
5250
  }
5251
5251
  },
5252
- "/governance/permissions": {
5252
+ "/government/permissions": {
5253
5253
  "get": {
5254
- "operationId": "get_governance_permissions",
5254
+ "operationId": "get_government_permissions",
5255
5255
  "tags": [
5256
- "governance"
5256
+ "government"
5257
5257
  ],
5258
- "summary": "GET /governance/permissions",
5259
- "description": "governance.manage — the permission catalog + principals, straight from code (the catalog is CODE, not a table); no DB read. Principals are read-only by construction. Three flags the tab renders its locks from, and the tab must read all three rather than just `grantable`, because since ADR 0172 grantability depends on WHICH role is selected: • `grantable` — the CUSTOM-role answer (system:false). Unchanged meaning. • `system` — an in-app Archon power: locked on a custom role, togglable on a sub-Archon rank-role. • `substrate` — locked EVERYWHERE, on every role, forever (ADR 0043).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5258
+ "summary": "GET /government/permissions",
5259
+ "description": "government.manage — the permission catalog + principals, straight from code (the catalog is CODE, not a table); no DB read. Principals are read-only by construction. Three flags the tab renders its locks from, and the tab must read all three rather than just `grantable`, because since ADR 0172 grantability depends on WHICH role is selected: • `grantable` — the CUSTOM-role answer (system:false). Unchanged meaning. • `system` — an in-app Archon power: locked on a custom role, togglable on a sub-Archon rank-role. • `substrate` — locked EVERYWHERE, on every role, forever (ADR 0043).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5260
5260
  "x-rank": "archon",
5261
- "x-source": "modules/government/routes/governance.js",
5261
+ "x-source": "modules/government/routes/government.js",
5262
5262
  "x-permissions": [
5263
- "governance.manage"
5263
+ "government.manage"
5264
5264
  ],
5265
5265
  "responses": {
5266
5266
  "200": {
@@ -5268,7 +5268,7 @@
5268
5268
  "content": {
5269
5269
  "application/json": {
5270
5270
  "schema": {
5271
- "$ref": "#/components/schemas/GetGovernancePermissionsResponse"
5271
+ "$ref": "#/components/schemas/GetGovernmentPermissionsResponse"
5272
5272
  }
5273
5273
  }
5274
5274
  }
@@ -5290,18 +5290,18 @@
5290
5290
  ]
5291
5291
  }
5292
5292
  },
5293
- "/governance/roles": {
5293
+ "/government/ranks": {
5294
5294
  "get": {
5295
- "operationId": "get_governance_roles",
5295
+ "operationId": "get_government_ranks",
5296
5296
  "tags": [
5297
- "governance"
5297
+ "government"
5298
5298
  ],
5299
- "summary": "GET /governance/roles",
5300
- "description": "governance.manage — the full role list with each role's grants.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5299
+ "summary": "GET /government/ranks",
5300
+ "description": "government.manage — the full role list with each role's grants.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5301
5301
  "x-rank": "archon",
5302
- "x-source": "modules/government/routes/governance.js",
5302
+ "x-source": "modules/government/routes/government.js",
5303
5303
  "x-permissions": [
5304
- "governance.manage"
5304
+ "government.manage"
5305
5305
  ],
5306
5306
  "responses": {
5307
5307
  "200": {
@@ -5309,7 +5309,7 @@
5309
5309
  "content": {
5310
5310
  "application/json": {
5311
5311
  "schema": {
5312
- "$ref": "#/components/schemas/GetGovernanceRolesResponse"
5312
+ "$ref": "#/components/schemas/GetGovernmentRanksResponse"
5313
5313
  }
5314
5314
  }
5315
5315
  }
@@ -5331,23 +5331,23 @@
5331
5331
  ]
5332
5332
  },
5333
5333
  "post": {
5334
- "operationId": "post_governance_roles",
5334
+ "operationId": "post_government_ranks",
5335
5335
  "tags": [
5336
- "governance"
5336
+ "government"
5337
5337
  ],
5338
- "summary": "POST /governance/roles",
5339
- "description": "governance.manage — create a CUSTOM role (is_system false, no seeded_rank — the seeded four exist only via governance_002). Grants are added one at a time via the toggle below, so creation carries none.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5338
+ "summary": "POST /government/ranks",
5339
+ "description": "government.manage — create a CUSTOM role (is_system false, no seeded_rank — the seeded four exist only via governance_002). Grants are added one at a time via the toggle below, so creation carries none.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5340
5340
  "x-rank": "archon",
5341
- "x-source": "modules/government/routes/governance.js",
5341
+ "x-source": "modules/government/routes/government.js",
5342
5342
  "x-permissions": [
5343
- "governance.manage"
5343
+ "government.manage"
5344
5344
  ],
5345
5345
  "requestBody": {
5346
5346
  "required": true,
5347
5347
  "content": {
5348
5348
  "application/json": {
5349
5349
  "schema": {
5350
- "$ref": "#/components/schemas/PostGovernanceRolesRequest"
5350
+ "$ref": "#/components/schemas/PostGovernmentRanksRequest"
5351
5351
  }
5352
5352
  }
5353
5353
  },
@@ -5359,7 +5359,7 @@
5359
5359
  "content": {
5360
5360
  "application/json": {
5361
5361
  "schema": {
5362
- "$ref": "#/components/schemas/PostGovernanceRolesResponse"
5362
+ "$ref": "#/components/schemas/PostGovernmentRanksResponse"
5363
5363
  }
5364
5364
  }
5365
5365
  }
@@ -5381,28 +5381,28 @@
5381
5381
  ]
5382
5382
  }
5383
5383
  },
5384
- "/governance/roles/{roleKey}/permissions/{permissionKey}": {
5384
+ "/government/ranks/{rankKey}/permissions/{permissionKey}": {
5385
5385
  "put": {
5386
- "operationId": "put_governance_roles_roleKey_permissions_permissionKey",
5386
+ "operationId": "put_government_ranks_rankKey_permissions_permissionKey",
5387
5387
  "tags": [
5388
- "governance"
5388
+ "government"
5389
5389
  ],
5390
- "summary": "PUT /governance/roles/:roleKey/permissions/:permissionKey",
5391
- "description": "governance.manage — grant one permission to a role (the toggle's ON half). The order of refusals is the authority order: role exists → role is not the Archon one → the key exists → the key is grantable TO THIS ROLE.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5390
+ "summary": "PUT /government/ranks/:rankKey/permissions/:permissionKey",
5391
+ "description": "government.manage — grant one permission to a role (the toggle's ON half). The order of refusals is the authority order: role exists → role is not the Archon one → the key exists → the key is grantable TO THIS ROLE.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5392
5392
  "x-rank": "archon",
5393
- "x-source": "modules/government/routes/governance.js",
5393
+ "x-source": "modules/government/routes/government.js",
5394
5394
  "x-permissions": [
5395
- "governance.manage"
5395
+ "government.manage"
5396
5396
  ],
5397
5397
  "parameters": [
5398
5398
  {
5399
- "name": "roleKey",
5399
+ "name": "rankKey",
5400
5400
  "in": "path",
5401
5401
  "required": true,
5402
5402
  "schema": {
5403
5403
  "type": "string"
5404
5404
  },
5405
- "description": "Path parameter `roleKey`."
5405
+ "description": "Path parameter `rankKey`."
5406
5406
  },
5407
5407
  {
5408
5408
  "name": "permissionKey",
@@ -5420,7 +5420,7 @@
5420
5420
  "content": {
5421
5421
  "application/json": {
5422
5422
  "schema": {
5423
- "$ref": "#/components/schemas/PutGovernanceRolesRoleKeyPermissionsPermissionKeyResponse"
5423
+ "$ref": "#/components/schemas/PutGovernmentRanksRankKeyPermissionsPermissionKeyResponse"
5424
5424
  }
5425
5425
  }
5426
5426
  }
@@ -5445,26 +5445,26 @@
5445
5445
  ]
5446
5446
  },
5447
5447
  "delete": {
5448
- "operationId": "delete_governance_roles_roleKey_permissions_permissionKey",
5448
+ "operationId": "delete_government_ranks_rankKey_permissions_permissionKey",
5449
5449
  "tags": [
5450
- "governance"
5450
+ "government"
5451
5451
  ],
5452
- "summary": "DELETE /governance/roles/:roleKey/permissions/:permissionKey",
5453
- "description": "governance.manage — revoke a grant (the toggle's OFF half). Deliberately NOT validated against the catalog: a grant whose key the catalog since retired is exactly the row an Archon most needs to remove (the resolver already drops it — this is hygiene, not authority).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5452
+ "summary": "DELETE /government/ranks/:rankKey/permissions/:permissionKey",
5453
+ "description": "government.manage — revoke a grant (the toggle's OFF half). Deliberately NOT validated against the catalog: a grant whose key the catalog since retired is exactly the row an Archon most needs to remove (the resolver already drops it — this is hygiene, not authority).\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5454
5454
  "x-rank": "archon",
5455
- "x-source": "modules/government/routes/governance.js",
5455
+ "x-source": "modules/government/routes/government.js",
5456
5456
  "x-permissions": [
5457
- "governance.manage"
5457
+ "government.manage"
5458
5458
  ],
5459
5459
  "parameters": [
5460
5460
  {
5461
- "name": "roleKey",
5461
+ "name": "rankKey",
5462
5462
  "in": "path",
5463
5463
  "required": true,
5464
5464
  "schema": {
5465
5465
  "type": "string"
5466
5466
  },
5467
- "description": "Path parameter `roleKey`."
5467
+ "description": "Path parameter `rankKey`."
5468
5468
  },
5469
5469
  {
5470
5470
  "name": "permissionKey",
@@ -5482,7 +5482,7 @@
5482
5482
  "content": {
5483
5483
  "application/json": {
5484
5484
  "schema": {
5485
- "$ref": "#/components/schemas/DeleteGovernanceRolesRoleKeyPermissionsPermissionKeyResponse"
5485
+ "$ref": "#/components/schemas/DeleteGovernmentRanksRankKeyPermissionsPermissionKeyResponse"
5486
5486
  }
5487
5487
  }
5488
5488
  }
@@ -5507,28 +5507,28 @@
5507
5507
  ]
5508
5508
  }
5509
5509
  },
5510
- "/governance/roles/{roleKey}/reset": {
5510
+ "/government/ranks/{rankKey}/reset": {
5511
5511
  "post": {
5512
- "operationId": "post_governance_roles_roleKey_reset",
5512
+ "operationId": "post_government_ranks_rankKey_reset",
5513
5513
  "tags": [
5514
- "governance"
5514
+ "government"
5515
5515
  ],
5516
- "summary": "POST /governance/roles/:roleKey/reset",
5517
- "description": "governance.manage — restore a SEEDED rank-role to its catalog default (ADR 0172). The counterweight to making the rank-roles editable: a rank's grant set is ~60 rows, so an owner who drifts one has no practical way back by clicking, and \"what does Trusted mean by default\" is a question only the catalog can answer. Restores catalog.seedForRank(role.seeded_rank) — the same derivation governance_002 seeded from, so the answer cannot drift from the floors even after later catalog edits. Deliberately NOT offered for a CUSTOM role: a custom role has no catalog default to return to (its \"default\" is the empty set it was created with), so the honest verb there is revoking the grants, which the toggle already does.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `governance.manage` (all required).",
5516
+ "summary": "POST /government/ranks/:rankKey/reset",
5517
+ "description": "government.manage — restore a SEEDED rank-role to its catalog default (ADR 0172). The counterweight to making the rank-roles editable: a rank's grant set is ~60 rows, so an owner who drifts one has no practical way back by clicking, and \"what does Trusted mean by default\" is a question only the catalog can answer. Restores catalog.seedForRank(role.seeded_rank) — the same derivation governance_002 seeded from, so the answer cannot drift from the floors even after later catalog edits. Deliberately NOT offered for a CUSTOM role: a custom role has no catalog default to return to (its \"default\" is the empty set it was created with), so the honest verb there is revoking the grants, which the toggle already does.\n\n**Rank:** `archon` — Archon only (rank and identity management + the escalation keys — the trust boundary).\n\n**Permissions:** `government.manage` (all required).",
5518
5518
  "x-rank": "archon",
5519
- "x-source": "modules/government/routes/governance.js",
5519
+ "x-source": "modules/government/routes/government.js",
5520
5520
  "x-permissions": [
5521
- "governance.manage"
5521
+ "government.manage"
5522
5522
  ],
5523
5523
  "parameters": [
5524
5524
  {
5525
- "name": "roleKey",
5525
+ "name": "rankKey",
5526
5526
  "in": "path",
5527
5527
  "required": true,
5528
5528
  "schema": {
5529
5529
  "type": "string"
5530
5530
  },
5531
- "description": "Path parameter `roleKey`."
5531
+ "description": "Path parameter `rankKey`."
5532
5532
  }
5533
5533
  ],
5534
5534
  "responses": {
@@ -5537,7 +5537,7 @@
5537
5537
  "content": {
5538
5538
  "application/json": {
5539
5539
  "schema": {
5540
- "$ref": "#/components/schemas/PostGovernanceRolesRoleKeyResetResponse"
5540
+ "$ref": "#/components/schemas/PostGovernmentRanksRankKeyResetResponse"
5541
5541
  }
5542
5542
  }
5543
5543
  }
@@ -12536,36 +12536,36 @@
12536
12536
  "ok"
12537
12537
  ]
12538
12538
  },
12539
- "DeleteGovernanceAssignmentsBuilderIdRoleKeyResponse": {
12539
+ "DeleteGovernmentAssignmentsBuilderIdRankKeyResponse": {
12540
12540
  "type": "object",
12541
12541
  "properties": {
12542
12542
  "ok": {
12543
12543
  "type": "boolean"
12544
12544
  },
12545
12545
  "builder_id": {},
12546
- "role_key": {},
12546
+ "rank_key": {},
12547
12547
  "removed": {}
12548
12548
  },
12549
12549
  "required": [
12550
12550
  "ok",
12551
12551
  "builder_id",
12552
- "role_key",
12552
+ "rank_key",
12553
12553
  "removed"
12554
12554
  ]
12555
12555
  },
12556
- "DeleteGovernanceRolesRoleKeyPermissionsPermissionKeyResponse": {
12556
+ "DeleteGovernmentRanksRankKeyPermissionsPermissionKeyResponse": {
12557
12557
  "type": "object",
12558
12558
  "properties": {
12559
12559
  "ok": {
12560
12560
  "type": "boolean"
12561
12561
  },
12562
- "role_key": {},
12562
+ "rank_key": {},
12563
12563
  "permission_key": {},
12564
12564
  "removed": {}
12565
12565
  },
12566
12566
  "required": [
12567
12567
  "ok",
12568
- "role_key",
12568
+ "rank_key",
12569
12569
  "permission_key",
12570
12570
  "removed"
12571
12571
  ]
@@ -12977,7 +12977,7 @@
12977
12977
  "goals"
12978
12978
  ]
12979
12979
  },
12980
- "GetGovernanceAssignmentsResponse": {
12980
+ "GetGovernmentAssignmentsResponse": {
12981
12981
  "type": "object",
12982
12982
  "properties": {
12983
12983
  "assignments": {}
@@ -12986,7 +12986,7 @@
12986
12986
  "assignments"
12987
12987
  ]
12988
12988
  },
12989
- "GetGovernancePermissionsResponse": {
12989
+ "GetGovernmentPermissionsResponse": {
12990
12990
  "type": "object",
12991
12991
  "properties": {
12992
12992
  "permissions": {},
@@ -12997,7 +12997,7 @@
12997
12997
  "principals"
12998
12998
  ]
12999
12999
  },
13000
- "GetGovernanceRolesResponse": {
13000
+ "GetGovernmentRanksResponse": {
13001
13001
  "type": "object",
13002
13002
  "properties": {
13003
13003
  "roles": {}
@@ -15646,14 +15646,14 @@
15646
15646
  "succeeds_goal_id"
15647
15647
  ]
15648
15648
  },
15649
- "PostGovernanceAssignmentsRequest": {
15649
+ "PostGovernmentAssignmentsRequest": {
15650
15650
  "type": "object",
15651
15651
  "properties": {
15652
15652
  "builder_id": {
15653
15653
  "type": "integer",
15654
15654
  "minimum": 1
15655
15655
  },
15656
- "role_key": {
15656
+ "rank_key": {
15657
15657
  "type": "string",
15658
15658
  "minLength": 2,
15659
15659
  "maxLength": 64
@@ -15661,14 +15661,31 @@
15661
15661
  },
15662
15662
  "required": [
15663
15663
  "builder_id",
15664
- "role_key"
15664
+ "rank_key"
15665
15665
  ],
15666
15666
  "additionalProperties": false
15667
15667
  },
15668
- "PostGovernanceRolesRequest": {
15668
+ "PostGovernmentRanksRankKeyResetResponse": {
15669
15669
  "type": "object",
15670
15670
  "properties": {
15671
- "role_key": {
15671
+ "ok": {
15672
+ "type": "boolean"
15673
+ },
15674
+ "rank_key": {},
15675
+ "seeded_rank": {},
15676
+ "permission_count": {}
15677
+ },
15678
+ "required": [
15679
+ "ok",
15680
+ "rank_key",
15681
+ "seeded_rank",
15682
+ "permission_count"
15683
+ ]
15684
+ },
15685
+ "PostGovernmentRanksRequest": {
15686
+ "type": "object",
15687
+ "properties": {
15688
+ "rank_key": {
15672
15689
  "type": "string",
15673
15690
  "minLength": 2,
15674
15691
  "maxLength": 64
@@ -15684,12 +15701,12 @@
15684
15701
  }
15685
15702
  },
15686
15703
  "required": [
15687
- "role_key",
15704
+ "rank_key",
15688
15705
  "label"
15689
15706
  ],
15690
15707
  "additionalProperties": false
15691
15708
  },
15692
- "PostGovernanceRolesResponse": {
15709
+ "PostGovernmentRanksResponse": {
15693
15710
  "type": "object",
15694
15711
  "properties": {
15695
15712
  "role": {}
@@ -15698,23 +15715,6 @@
15698
15715
  "role"
15699
15716
  ]
15700
15717
  },
15701
- "PostGovernanceRolesRoleKeyResetResponse": {
15702
- "type": "object",
15703
- "properties": {
15704
- "ok": {
15705
- "type": "boolean"
15706
- },
15707
- "role_key": {},
15708
- "seeded_rank": {},
15709
- "permission_count": {}
15710
- },
15711
- "required": [
15712
- "ok",
15713
- "role_key",
15714
- "seeded_rank",
15715
- "permission_count"
15716
- ]
15717
- },
15718
15718
  "PostInboxIdRatifyRequest": {
15719
15719
  "type": "object",
15720
15720
  "properties": {
@@ -17264,19 +17264,19 @@
17264
17264
  "criteria"
17265
17265
  ]
17266
17266
  },
17267
- "PutGovernanceRolesRoleKeyPermissionsPermissionKeyResponse": {
17267
+ "PutGovernmentRanksRankKeyPermissionsPermissionKeyResponse": {
17268
17268
  "type": "object",
17269
17269
  "properties": {
17270
17270
  "ok": {
17271
17271
  "type": "boolean"
17272
17272
  },
17273
- "role_key": {},
17273
+ "rank_key": {},
17274
17274
  "permission_key": {},
17275
17275
  "granted": {}
17276
17276
  },
17277
17277
  "required": [
17278
17278
  "ok",
17279
- "role_key",
17279
+ "rank_key",
17280
17280
  "permission_key",
17281
17281
  "granted"
17282
17282
  ]