moose-inventory 2.0 → 2.1

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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +2 -0
  3. data/.gitignore +2 -1
  4. data/.rubocop.yml +21 -0
  5. data/BACKLOG.md +630 -8
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +1 -1
  8. data/README.md +315 -39
  9. data/Rakefile +2 -0
  10. data/bin/moose-inventory +2 -1
  11. data/docs/architecture/architecture-and-trust-boundaries.md +444 -0
  12. data/docs/compatibility/cli-output-compatibility.md +76 -0
  13. data/docs/governance/approval-register.md +37 -0
  14. data/docs/maintenance/database-backup-restore-guidance.md +162 -0
  15. data/docs/maintenance/package-maintenance-and-agent-boundaries.md +260 -0
  16. data/docs/process/conformance-gap-analysis-2026-05-28.md +192 -0
  17. data/docs/product/product-brief.md +161 -0
  18. data/docs/product/requirements-baseline.md +477 -0
  19. data/docs/qa/qa-documentation-and-release-gates.md +283 -0
  20. data/docs/release/package-provenance-hardening.md +126 -0
  21. data/docs/release/publishing.md +11 -3
  22. data/docs/release/release-environment-protection.md +70 -0
  23. data/docs/release/release-readiness.md +23 -4
  24. data/docs/security/accepted-risk-register.md +84 -0
  25. data/docs/security/security-privacy-process.md +287 -0
  26. data/docs/security-audit-2026-05-26-rerun.md +2 -2
  27. data/docs/ux/cli-workflow-notes.md +287 -0
  28. data/examples/ansible/ansible.cfg +3 -0
  29. data/examples/ansible/inventory/moose_inventory.yml +5 -0
  30. data/examples/ansible/inventory_plugins/moose_inventory.py +100 -0
  31. data/examples/ci/README.md +16 -0
  32. data/examples/ci/github-actions/inventory-review.yml +38 -0
  33. data/examples/ci/inventory/example-snapshot.yml +19 -0
  34. data/examples/ci/scripts/validate-inventory-snapshot.sh +30 -0
  35. data/lib/moose_inventory/cli/application.rb +133 -5
  36. data/lib/moose_inventory/cli/association_rendering.rb +74 -0
  37. data/lib/moose_inventory/cli/association_rendering_support.rb +89 -0
  38. data/lib/moose_inventory/cli/audit.rb +62 -0
  39. data/lib/moose_inventory/cli/audit_recording.rb +40 -0
  40. data/lib/moose_inventory/cli/child_relation_rendering.rb +110 -0
  41. data/lib/moose_inventory/cli/console.rb +135 -0
  42. data/lib/moose_inventory/cli/db.rb +64 -0
  43. data/lib/moose_inventory/cli/factory.rb +28 -0
  44. data/lib/moose_inventory/cli/formatter.rb +8 -12
  45. data/lib/moose_inventory/cli/group.rb +5 -2
  46. data/lib/moose_inventory/cli/group_add.rb +11 -9
  47. data/lib/moose_inventory/cli/group_addchild.rb +23 -65
  48. data/lib/moose_inventory/cli/group_addhost.rb +16 -67
  49. data/lib/moose_inventory/cli/group_addvar.rb +27 -47
  50. data/lib/moose_inventory/cli/group_get.rb +8 -42
  51. data/lib/moose_inventory/cli/group_list.rb +7 -40
  52. data/lib/moose_inventory/cli/group_listvars.rb +9 -55
  53. data/lib/moose_inventory/cli/group_rm.rb +12 -10
  54. data/lib/moose_inventory/cli/group_rmchild.rb +26 -82
  55. data/lib/moose_inventory/cli/group_rmhost.rb +18 -53
  56. data/lib/moose_inventory/cli/group_rmvar.rb +30 -41
  57. data/lib/moose_inventory/cli/group_tags.rb +33 -0
  58. data/lib/moose_inventory/cli/helpers.rb +68 -1
  59. data/lib/moose_inventory/cli/host.rb +6 -3
  60. data/lib/moose_inventory/cli/host_add.rb +69 -29
  61. data/lib/moose_inventory/cli/host_addgroup.rb +22 -58
  62. data/lib/moose_inventory/cli/host_addvar.rb +28 -52
  63. data/lib/moose_inventory/cli/host_get.rb +9 -37
  64. data/lib/moose_inventory/cli/host_list.rb +24 -21
  65. data/lib/moose_inventory/cli/host_listvars.rb +9 -62
  66. data/lib/moose_inventory/cli/host_rm.rb +60 -42
  67. data/lib/moose_inventory/cli/host_rmgroup.rb +25 -44
  68. data/lib/moose_inventory/cli/host_rmvar.rb +31 -45
  69. data/lib/moose_inventory/cli/host_tags.rb +33 -0
  70. data/lib/moose_inventory/cli/listvars_support.rb +55 -0
  71. data/lib/moose_inventory/cli/plan_rendering.rb +50 -0
  72. data/lib/moose_inventory/cli/relation_transaction_support.rb +51 -0
  73. data/lib/moose_inventory/cli/tag_support.rb +97 -0
  74. data/lib/moose_inventory/cli/variable_rendering.rb +67 -0
  75. data/lib/moose_inventory/config/config.rb +185 -108
  76. data/lib/moose_inventory/db/db.rb +170 -195
  77. data/lib/moose_inventory/db/exceptions.rb +6 -3
  78. data/lib/moose_inventory/db/models.rb +16 -0
  79. data/lib/moose_inventory/db/schema_migrations.rb +248 -0
  80. data/lib/moose_inventory/inventory_context.rb +68 -2
  81. data/lib/moose_inventory/operations/add_associations.rb +20 -16
  82. data/lib/moose_inventory/operations/add_groups.rb +21 -13
  83. data/lib/moose_inventory/operations/add_hosts.rb +30 -17
  84. data/lib/moose_inventory/operations/add_variables.rb +77 -0
  85. data/lib/moose_inventory/operations/entity_variable_operation_support.rb +46 -0
  86. data/lib/moose_inventory/operations/group_child_relations.rb +23 -16
  87. data/lib/moose_inventory/operations/group_cleanup.rb +23 -8
  88. data/lib/moose_inventory/operations/import_inventory_snapshot.rb +41 -0
  89. data/lib/moose_inventory/operations/inventory_doctor.rb +172 -0
  90. data/lib/moose_inventory/operations/inventory_snapshot.rb +60 -0
  91. data/lib/moose_inventory/operations/inventory_snapshot_applier.rb +112 -0
  92. data/lib/moose_inventory/operations/inventory_snapshot_preview.rb +174 -0
  93. data/lib/moose_inventory/operations/inventory_snapshot_validator.rb +134 -0
  94. data/lib/moose_inventory/operations/operation_event_support.rb +27 -0
  95. data/lib/moose_inventory/operations/query_inventory/base_query.rb +24 -0
  96. data/lib/moose_inventory/operations/query_inventory/group_queries.rb +86 -0
  97. data/lib/moose_inventory/operations/query_inventory/host_queries.rb +106 -0
  98. data/lib/moose_inventory/operations/query_inventory.rb +47 -0
  99. data/lib/moose_inventory/operations/remove_associations.rb +30 -18
  100. data/lib/moose_inventory/operations/remove_groups.rb +12 -12
  101. data/lib/moose_inventory/operations/remove_hosts.rb +68 -0
  102. data/lib/moose_inventory/operations/remove_variables.rb +67 -0
  103. data/lib/moose_inventory/runtime_options.rb +31 -0
  104. data/lib/moose_inventory/version.rb +3 -1
  105. data/lib/moose_inventory.rb +10 -7
  106. data/moose-inventory.gemspec +19 -35
  107. data/scripts/check.sh +1 -0
  108. data/scripts/ci/check_generated_artifacts.sh +41 -0
  109. data/scripts/ci/check_permissions.sh +2 -0
  110. data/scripts/ci/check_rubocop.sh +30 -25
  111. data/scripts/files.rb +5 -4
  112. data/spec/examples/ci_examples_spec.rb +37 -0
  113. data/spec/lib/moose_inventory/ansible_plugin_examples_spec.rb +29 -0
  114. data/spec/lib/moose_inventory/cli/application_doctor_spec.rb +50 -0
  115. data/spec/lib/moose_inventory/cli/application_import_export_spec.rb +100 -0
  116. data/spec/lib/moose_inventory/cli/application_spec.rb +25 -15
  117. data/spec/lib/moose_inventory/cli/audit_spec.rb +56 -0
  118. data/spec/lib/moose_inventory/cli/cli_spec.rb +15 -19
  119. data/spec/lib/moose_inventory/cli/console_spec.rb +98 -0
  120. data/spec/lib/moose_inventory/cli/factory_spec.rb +27 -0
  121. data/spec/lib/moose_inventory/cli/formatter_spec.rb +95 -3
  122. data/spec/lib/moose_inventory/cli/group_add_spec.rb +140 -116
  123. data/spec/lib/moose_inventory/cli/group_addchild_spec.rb +89 -35
  124. data/spec/lib/moose_inventory/cli/group_addhost_spec.rb +81 -84
  125. data/spec/lib/moose_inventory/cli/group_addvar_spec.rb +65 -68
  126. data/spec/lib/moose_inventory/cli/group_get_spec.rb +17 -33
  127. data/spec/lib/moose_inventory/cli/group_list_spec.rb +16 -38
  128. data/spec/lib/moose_inventory/cli/group_listvar_spec.rb +33 -40
  129. data/spec/lib/moose_inventory/cli/group_rm_spec.rb +136 -96
  130. data/spec/lib/moose_inventory/cli/group_rmchild_spec.rb +66 -41
  131. data/spec/lib/moose_inventory/cli/group_rmhost_spec.rb +76 -78
  132. data/spec/lib/moose_inventory/cli/group_rmvar_spec.rb +57 -63
  133. data/spec/lib/moose_inventory/cli/group_spec.rb +2 -0
  134. data/spec/lib/moose_inventory/cli/helpers_spec.rb +146 -0
  135. data/spec/lib/moose_inventory/cli/host_add_spec.rb +170 -116
  136. data/spec/lib/moose_inventory/cli/host_addgroup_spec.rb +100 -83
  137. data/spec/lib/moose_inventory/cli/host_addvar_spec.rb +92 -74
  138. data/spec/lib/moose_inventory/cli/host_get_spec.rb +14 -33
  139. data/spec/lib/moose_inventory/cli/host_list_spec.rb +41 -33
  140. data/spec/lib/moose_inventory/cli/host_listvar_spec.rb +45 -53
  141. data/spec/lib/moose_inventory/cli/host_rm_spec.rb +66 -48
  142. data/spec/lib/moose_inventory/cli/host_rmgroup_spec.rb +73 -83
  143. data/spec/lib/moose_inventory/cli/host_rmvar_spec.rb +56 -63
  144. data/spec/lib/moose_inventory/cli/host_spec.rb +2 -0
  145. data/spec/lib/moose_inventory/cli/tags_spec.rb +81 -0
  146. data/spec/lib/moose_inventory/config/config_spec.rb +41 -3
  147. data/spec/lib/moose_inventory/db/db_spec.rb +396 -36
  148. data/spec/lib/moose_inventory/db/exceptions_spec.rb +18 -0
  149. data/spec/lib/moose_inventory/db/models_spec.rb +7 -3
  150. data/spec/lib/moose_inventory/db_lifecycle_spec.rb +73 -0
  151. data/spec/lib/moose_inventory/inventory_context_spec.rb +10 -0
  152. data/spec/lib/moose_inventory/operations/add_associations_spec.rb +34 -0
  153. data/spec/lib/moose_inventory/operations/add_groups_spec.rb +15 -0
  154. data/spec/lib/moose_inventory/operations/add_hosts_spec.rb +13 -0
  155. data/spec/lib/moose_inventory/operations/add_variables_spec.rb +103 -0
  156. data/spec/lib/moose_inventory/operations/group_child_relations_spec.rb +46 -0
  157. data/spec/lib/moose_inventory/operations/import_inventory_snapshot_spec.rb +226 -0
  158. data/spec/lib/moose_inventory/operations/inventory_doctor_spec.rb +77 -0
  159. data/spec/lib/moose_inventory/operations/inventory_snapshot_spec.rb +50 -0
  160. data/spec/lib/moose_inventory/operations/operation_event_support_spec.rb +78 -0
  161. data/spec/lib/moose_inventory/operations/query_inventory_spec.rb +146 -0
  162. data/spec/lib/moose_inventory/operations/remove_associations_spec.rb +35 -0
  163. data/spec/lib/moose_inventory/operations/remove_groups_spec.rb +21 -0
  164. data/spec/lib/moose_inventory/operations/remove_hosts_spec.rb +55 -0
  165. data/spec/lib/moose_inventory/operations/remove_variables_spec.rb +83 -0
  166. data/spec/shared/shared_config_setup.rb +4 -3
  167. data/spec/spec_helper.rb +50 -40
  168. data/spec/support/cli_harness.rb +33 -0
  169. metadata +80 -41
@@ -0,0 +1,444 @@
1
+ # Moose Inventory Architecture and Trust Boundary Baseline
2
+
3
+ ## Approval status
4
+
5
+ Status: **Approved architecture and trust-boundary baseline**
6
+
7
+ Approval reference: `GOV-ARCH-001` in `docs/governance/approval-register.md` approves this document as the architecture and trust-boundary baseline for Moose Inventory.
8
+
9
+ Approved references:
10
+
11
+ - `GOV-TAILOR-001`: Moose Inventory is approved as Class 4 with target profile Software Library / Package.
12
+ - `GOV-PRODUCT-001`: `docs/product/product-brief.md` is approved as the product-framing baseline.
13
+ - `GOV-REQ-001`: `docs/product/requirements-baseline.md` is approved as the requirements and acceptance criteria baseline.
14
+ - `GOV-UX-001`: `docs/ux/cli-workflow-notes.md` is approved as the CLI UX/workflow baseline.
15
+
16
+ Scope limit: this approval covers architecture and trust boundaries only. It is not security/privacy design approval, release approval, accepted-risk approval, public/compliance-claim approval, RubyGems publishing approval, implementation approval for architecture follow-up backlog items, or repository/package account-management design approval.
17
+
18
+ ## System summary
19
+
20
+ Moose Inventory is a RubyGem and command-line application for managing Ansible-compatible dynamic inventory state in a database. It is packaged as the `moose-inventory` gem and exposes the `moose-inventory` executable.
21
+
22
+ The system is not a hosted service. Users operate it locally or in their own automation environments. Moose Inventory reads configuration, connects to a configured database, performs CLI-requested read/write operations, and emits human-readable or machine-readable output.
23
+
24
+ ## High-level architecture
25
+
26
+ ```text
27
+ Human / CI / Ansible workflow
28
+ |
29
+ v
30
+ bin/moose-inventory
31
+ |
32
+ v
33
+ Moose::Inventory::Cli::Application (Thor command tree)
34
+ |
35
+ +--> CLI command modules
36
+ | host, group, db, audit, console, import/export, doctor
37
+ |
38
+ +--> CLI support modules
39
+ | formatting, dry-run plan rendering, audit recording,
40
+ | relation rendering, variable rendering, tag support
41
+ |
42
+ v
43
+ Operation objects
44
+ add/remove hosts, groups, associations, variables,
45
+ child relations, snapshot import/export, inventory doctor,
46
+ query inventory
47
+ |
48
+ v
49
+ InventoryContext / DB singleton / Sequel models
50
+ |
51
+ v
52
+ SQLite / MySQL-MariaDB / PostgreSQL database
53
+ ```
54
+
55
+ External integration paths:
56
+
57
+ ```text
58
+ Ansible inventory plugin example --> moose-inventory CLI / exported data
59
+ CI examples ---------------------> snapshot validation / inventory review
60
+ GitHub Actions CI ---------------> scripts/check.sh gate
61
+ GitHub Actions release ----------> RubyGems trusted publishing / OIDC
62
+ RubyGems users ------------------> installed gem and executable
63
+ ```
64
+
65
+ ## Main components
66
+
67
+ ### Executable entrypoint
68
+
69
+ - `bin/moose-inventory`
70
+ - Loads the Ruby application and exposes the CLI.
71
+ - Treated as a packaged executable and package-sanity artifact.
72
+
73
+ ### CLI layer
74
+
75
+ Key files:
76
+
77
+ - `lib/moose_inventory/cli/application.rb`
78
+ - `lib/moose_inventory/cli/host*.rb`
79
+ - `lib/moose_inventory/cli/group*.rb`
80
+ - `lib/moose_inventory/cli/db.rb`
81
+ - `lib/moose_inventory/cli/audit.rb`
82
+ - `lib/moose_inventory/cli/console.rb`
83
+ - `lib/moose_inventory/cli/formatter.rb`
84
+ - `lib/moose_inventory/cli/plan_rendering.rb`
85
+ - CLI support modules for tags, variables, relationships, listvars, and audit recording
86
+
87
+ Responsibilities:
88
+
89
+ - Parse commands and options.
90
+ - Select config/environment.
91
+ - Invoke operation objects.
92
+ - Render human-readable and machine-readable output.
93
+ - Preserve documented CLI behavior and output compatibility.
94
+ - Enforce UX constraints such as dry-run/plan option combinations.
95
+
96
+ ### Configuration layer
97
+
98
+ Key file:
99
+
100
+ - `lib/moose_inventory/config/config.rb`
101
+
102
+ Responsibilities:
103
+
104
+ - Discover and parse YAML configuration.
105
+ - Resolve selected environment.
106
+ - Validate database adapter configuration.
107
+ - Prefer environment-variable based passwords through `password_env`.
108
+
109
+ ### Operation layer
110
+
111
+ Key files:
112
+
113
+ - `lib/moose_inventory/operations/add_hosts.rb`
114
+ - `lib/moose_inventory/operations/remove_hosts.rb`
115
+ - `lib/moose_inventory/operations/add_groups.rb`
116
+ - `lib/moose_inventory/operations/remove_groups.rb`
117
+ - `lib/moose_inventory/operations/add_associations.rb`
118
+ - `lib/moose_inventory/operations/remove_associations.rb`
119
+ - `lib/moose_inventory/operations/group_child_relations.rb`
120
+ - `lib/moose_inventory/operations/add_variables.rb`
121
+ - `lib/moose_inventory/operations/remove_variables.rb`
122
+ - `lib/moose_inventory/operations/import_inventory_snapshot*.rb`
123
+ - `lib/moose_inventory/operations/inventory_snapshot.rb`
124
+ - `lib/moose_inventory/operations/inventory_doctor.rb`
125
+ - `lib/moose_inventory/operations/query_inventory*.rb`
126
+
127
+ Responsibilities:
128
+
129
+ - Implement inventory business behavior independently of CLI rendering where practical.
130
+ - Emit structured events for CLI progress, dry-run plans, and review.
131
+ - Validate before writing for snapshot import and safety-sensitive workflows.
132
+ - Use transactions through `InventoryContext` and DB helpers.
133
+
134
+ ### Database and schema layer
135
+
136
+ Key files:
137
+
138
+ - `lib/moose_inventory/db/db.rb`
139
+ - `lib/moose_inventory/db/models.rb`
140
+ - `lib/moose_inventory/db/schema_migrations.rb`
141
+ - `lib/moose_inventory/inventory_context.rb`
142
+
143
+ Responsibilities:
144
+
145
+ - Establish Sequel database connections.
146
+ - Bind models to the active database.
147
+ - Create and migrate schema through explicit ordered migrations.
148
+ - Refuse newer schemas than the code supports.
149
+ - Provide transaction and model access seams to operations.
150
+
151
+ Supported adapters:
152
+
153
+ - SQLite
154
+ - MySQL/MariaDB
155
+ - PostgreSQL
156
+
157
+ ### Release and verification layer
158
+
159
+ Key files:
160
+
161
+ - `scripts/check.sh`
162
+ - `scripts/ci/*.sh`
163
+ - `.github/workflows/ci.yml`
164
+ - `.github/workflows/release.yml`
165
+ - `moose-inventory.gemspec`
166
+ - `docs/release/publishing.md`
167
+ - `docs/release/release-readiness.md`
168
+
169
+ Responsibilities:
170
+
171
+ - Run tests, lint, whitespace checks, permissions checks, dependency security checks, secret scanning, and package sanity checks.
172
+ - Verify release tag/version alignment.
173
+ - Publish to RubyGems through trusted publishing/OIDC when a reviewed release tag is pushed.
174
+
175
+ ## Runtime data model
176
+
177
+ Conceptual inventory entities:
178
+
179
+ - hosts
180
+ - groups
181
+ - host variables
182
+ - group variables
183
+ - host-group associations
184
+ - parent/child group associations
185
+ - host metadata tags
186
+ - group metadata tags
187
+ - schema version records
188
+ - audit/change records
189
+
190
+ Key invariants:
191
+
192
+ - Host/group names are normalized where existing behavior requires it.
193
+ - Join/variable uniqueness is enforced by schema constraints where implemented.
194
+ - Group cycles should be rejected or reported.
195
+ - Automatic `ungrouped` behavior is preserved for host/group association cleanup.
196
+ - Import is additive/update-oriented, not destructive sync.
197
+
198
+ ## Trust boundaries
199
+
200
+ ### Boundary 1: Human or automation caller to CLI
201
+
202
+ Inputs:
203
+
204
+ - command names/options/arguments
205
+ - config path and environment selection
206
+ - snapshot import files
207
+ - shell environment variables
208
+
209
+ Risks:
210
+
211
+ - accidental destructive command
212
+ - malformed arguments
213
+ - secret exposure through shell history or output
214
+ - wrong config/environment selected
215
+
216
+ Controls:
217
+
218
+ - command family structure and help text
219
+ - dry-run and plan output
220
+ - early validation before mutation
221
+ - transactions
222
+ - future destructive-command confirmation backlog item
223
+
224
+ ### Boundary 2: CLI to configuration file/environment
225
+
226
+ Inputs:
227
+
228
+ - YAML config files
229
+ - `password_env` variables
230
+ - legacy plaintext `password`
231
+
232
+ Risks:
233
+
234
+ - committed credentials
235
+ - wrong database target
236
+ - missing or malformed config
237
+
238
+ Controls:
239
+
240
+ - README recommends `password_env`
241
+ - doctor flags plaintext passwords
242
+ - config validation fails before command execution where practical
243
+ - generated/runtime config should stay outside commits
244
+
245
+ ### Boundary 3: Application to database
246
+
247
+ Inputs/outputs:
248
+
249
+ - SQL operations through Sequel
250
+ - schema migration records
251
+ - inventory data
252
+ - audit records
253
+
254
+ Risks:
255
+
256
+ - partial writes
257
+ - schema drift
258
+ - duplicate/corrupt relationships
259
+ - writes by older code against newer DB schema
260
+
261
+ Controls:
262
+
263
+ - transactions for mutating commands where practical
264
+ - explicit ordered migrations
265
+ - future-schema refusal
266
+ - uniqueness/index constraints
267
+ - import validation before writes
268
+ - doctor checks for known consistency issues
269
+
270
+ ### Boundary 4: Snapshot files to application
271
+
272
+ Inputs:
273
+
274
+ - YAML/JSON inventory snapshots
275
+
276
+ Risks:
277
+
278
+ - malformed data
279
+ - unexpected references
280
+ - duplicate normalized keys
281
+ - whitespace-only names
282
+ - cycles in group hierarchy
283
+ - user misunderstanding additive import semantics
284
+
285
+ Controls:
286
+
287
+ - snapshot validation before DB writes
288
+ - additive import only
289
+ - no destructive restore/sync semantics without future approval
290
+ - future preview/diff backlog item
291
+
292
+ ### Boundary 5: Application output to humans/scripts
293
+
294
+ Outputs:
295
+
296
+ - human-readable CLI progress
297
+ - YAML/JSON/pjson output
298
+ - doctor findings
299
+ - dry-run plan events
300
+ - audit list output
301
+
302
+ Risks:
303
+
304
+ - breaking automation by changing formats
305
+ - misleading human output
306
+ - leaking sensitive inventory structure or credentials
307
+
308
+ Controls:
309
+
310
+ - approved UX baseline
311
+ - output compatibility backlog item
312
+ - tests for important output contracts
313
+ - avoid secret output in errors/examples
314
+
315
+ ### Boundary 6: Repository to CI/release infrastructure
316
+
317
+ Inputs/outputs:
318
+
319
+ - pushes and pull requests to GitHub
320
+ - `v*` release tags
321
+ - GitHub Actions jobs
322
+ - RubyGems trusted publishing OIDC token
323
+ - built gem artifact
324
+
325
+ Risks:
326
+
327
+ - publishing wrong version
328
+ - unreviewed release
329
+ - CI bypass
330
+ - compromised dependency/release tooling
331
+ - RubyGems full-index lag causing false negatives
332
+
333
+ Controls:
334
+
335
+ - CI matrix for Ruby 3.2, 3.3, and 3.4
336
+ - release workflow checks tag version against gem version
337
+ - full check gate before publishing
338
+ - trusted publishing, no RubyGems API key in GitHub secrets
339
+ - `await-release: false` plus direct post-release verification guidance
340
+ - human release approval remains required
341
+
342
+ ## Data flows
343
+
344
+ ### Read-only inspection flow
345
+
346
+ ```text
347
+ User/automation -> CLI args/options -> config/env -> DB query -> formatter -> terminal/JSON/YAML
348
+ ```
349
+
350
+ Properties:
351
+
352
+ - no inventory mutation intended
353
+ - should not create audit mutation records
354
+ - machine-readable formats must remain parseable
355
+
356
+ ### Mutating command flow
357
+
358
+ ```text
359
+ User -> CLI command -> validation -> transaction -> operation -> Sequel models -> DB
360
+ | |
361
+ v v
362
+ progress events audit record where applicable
363
+ ```
364
+
365
+ Properties:
366
+
367
+ - writes are transactional where practical
368
+ - output reflects planned or applied changes
369
+ - dry-run follows the planned path without DB mutation
370
+
371
+ ### Snapshot import flow
372
+
373
+ ```text
374
+ Snapshot file -> parser -> validator -> transaction -> applier -> DB -> summary output
375
+ ```
376
+
377
+ Properties:
378
+
379
+ - validation occurs before write
380
+ - failed validation leaves DB unchanged
381
+ - import is additive/update-oriented
382
+
383
+ ### Release flow
384
+
385
+ ```text
386
+ maintainer decision -> version/tag -> GitHub release workflow -> check gate -> RubyGems OIDC -> published gem
387
+ ```
388
+
389
+ Properties:
390
+
391
+ - release tag must match `Moose::Inventory::VERSION`
392
+ - full local check gate runs in release workflow
393
+ - publishing uses RubyGems trusted publishing
394
+ - release approval is a human-owned decision
395
+
396
+ ## Maintainer ownership boundaries
397
+
398
+ Human-owned decisions:
399
+
400
+ - product direction beyond approved baselines
401
+ - architecture baseline approval
402
+ - security/privacy design approval
403
+ - accepted risk
404
+ - public/security/compliance claims
405
+ - release approval
406
+ - RubyGems publishing
407
+ - destructive repository/package actions
408
+
409
+ Agent/automation-appropriate work:
410
+
411
+ - draft docs and process evidence
412
+ - update backlog items
413
+ - implement local code/doc/test changes on branches
414
+ - run local verification gates
415
+ - prepare release evidence and checklists
416
+ - identify gaps and propose remediation
417
+
418
+ Automation must not infer approval from passing tests, drafted docs, or existing process artifacts.
419
+
420
+ ## Architecture decision notes
421
+
422
+ Current notable architecture decisions:
423
+
424
+ 1. Keep Moose Inventory as a Ruby CLI/RubyGem rather than a hosted service.
425
+ 2. Keep Ansible plugin material as examples rather than adding a Python/Ansible runtime dependency to the gem.
426
+ 3. Keep snapshot import additive/update-oriented; destructive restore/sync requires separate design and approval.
427
+ 4. Keep server-backed MySQL/MariaDB and PostgreSQL backup/restore operations user-managed through native database tooling or hosting-platform controls; Moose Inventory documents boundaries but does not run destructive restore commands.
428
+ 5. Keep audit history as evidence only, not rollback/change-set UX.
429
+ 5. Use explicit ordered schema migrations and refuse future schemas.
430
+ 7. Use RubyGems trusted publishing/OIDC as the preferred publishing path.
431
+ 8. Preserve CLI output compatibility unless breaking changes are explicitly approved.
432
+
433
+ ## Architecture decisions recorded from review
434
+
435
+ These decisions were provided by Russ during review on 2026-05-28. They are captured here as architecture direction for future implementation, but this draft architecture baseline still requires explicit approval through `GOV-ARCH-001` before it becomes approved architecture evidence.
436
+
437
+ 1. Architecture baseline approval requires lightweight text diagram review only; richer diagrams are not required by default.
438
+ 2. Release environment protection rules were confirmed, configured, and documented on 2026-05-29 in `docs/release/release-environment-protection.md`. The GitHub `release` environment now requires review by `RusDavies`, has self-review prevention disabled because OpenClaw/automation pushes use Russ's GitHub account, disables admin bypass, and has a custom deployment policy named `v*`. Because GitHub reports the custom deployment policy object as `type: branch`, tag-deployment behavior should be verified on the next real release and the environment policy adjusted if needed.
439
+ 3. Additional package provenance beyond RubyGems trusted publishing is not a current architectural requirement. Trusted publishing remains the baseline. `docs/release/package-provenance-hardening.md` evaluates checksums, GitHub artifact attestations, detached signatures, RubyGems certificate signing, and SBOM publication as future hardening options. The preferred first step, if a consumer or policy later requires stronger provenance, is GitHub artifact attestation plus a published SHA-256 checksum for the exact built `.gem`.
440
+ 4. User database backup/restore guidance is expanded in `docs/maintenance/database-backup-restore-guidance.md`: SQLite has a direct file-copy helper, while MySQL/MariaDB and PostgreSQL remain user-managed through native database tools or hosting-platform backups.
441
+
442
+ ## Open architecture questions
443
+
444
+ No open architecture questions remain in this draft. Future questions should be added here only when they are not already represented as a decision, backlog item, or accepted scope limit.
@@ -0,0 +1,76 @@
1
+ # CLI Output Compatibility Policy
2
+
3
+ Status: documented baseline for Moose Inventory 2.x maintenance work.
4
+
5
+ Moose Inventory treats both machine-readable and documented human-readable CLI output as compatibility surfaces. The project does not promise that every diagnostic sentence is permanent forever, but it does promise that output used by scripts, README examples, release gates, or regression specs changes only deliberately.
6
+
7
+ ## Compatibility version
8
+
9
+ The current CLI output compatibility baseline is **CLI-OUTPUT-v1**.
10
+
11
+ `CLI-OUTPUT-v1` covers the Moose Inventory 2.x command family and remains in force until a release note explicitly declares a replacement baseline such as `CLI-OUTPUT-v2`.
12
+
13
+ The compatibility version lives in:
14
+
15
+ 1. this policy document;
16
+ 2. release notes or release-readiness evidence for releases that preserve or change the baseline;
17
+ 3. backlog or approval evidence for any accepted breaking output change.
18
+
19
+ Existing JSON/YAML output is not retrofitted with a top-level version field only to advertise this policy. Adding such a field to legacy shapes could break strict automation consumers. New machine-readable envelopes may include an explicit `schema_version` field when they are designed from the start with versioning.
20
+
21
+ ## Machine-readable output rules
22
+
23
+ Machine-readable output includes:
24
+
25
+ - `--format json|yaml|pjson` output for list/get/report commands;
26
+ - `export` snapshot output;
27
+ - `doctor --format ...` reports;
28
+ - `audit list --format ...` results;
29
+ - `--dry-run --plan-format json|yaml|pjson` event plans;
30
+ - tag list output emitted with `--format`.
31
+
32
+ Under `CLI-OUTPUT-v1`:
33
+
34
+ - JSON/YAML/pjson must remain parseable in the declared format.
35
+ - Existing top-level keys, nested keys, and event `type` strings should not be renamed or removed without a breaking-change approval.
36
+ - New fields are preferred over renamed fields.
37
+ - Field ordering is not a machine-readable compatibility guarantee unless a specific command documents ordered event semantics.
38
+ - `pjson` is semantically equivalent to `json`; whitespace and indentation are not compatibility guarantees.
39
+ - YAML scalar formatting details are not compatibility guarantees when the parsed structure is unchanged.
40
+
41
+ ## Human-readable output rules
42
+
43
+ Human-readable output includes default progress text, warning summaries, success/failure text, usage errors, README examples, and docs that show command output.
44
+
45
+ Under `CLI-OUTPUT-v1`:
46
+
47
+ - Output locked by regression specs is compatibility-protected.
48
+ - README examples and documented workflows should remain accurate.
49
+ - Refactors should preserve existing wording/newline behavior when practical.
50
+ - Intentional user-visible wording changes require test updates and a release-note or backlog explanation.
51
+ - Typos, grammar, and clarity fixes are allowed when they do not alter documented automation-facing behavior, but they should still be reviewed as compatibility-impacting changes when specs or README examples change.
52
+
53
+ Human-readable output is not a recommended automation interface. Scripts should use `--format`, `export`, `audit --format`, or `--plan-format` whenever possible.
54
+
55
+ ## Breaking-change process
56
+
57
+ A breaking output change is any change that removes, renames, or substantially changes a documented field/event, or intentionally changes protected human-readable output in a way likely to break users or tests.
58
+
59
+ Breaking output changes require:
60
+
61
+ 1. a backlog item or approval note describing the change and reason;
62
+ 2. updated regression coverage for the new behavior;
63
+ 3. README/docs updates;
64
+ 4. release notes naming the old and new compatibility baseline when the change leaves `CLI-OUTPUT-v1`;
65
+ 5. migration guidance for automation consumers when machine-readable output changes.
66
+
67
+ Non-breaking additive fields, new commands, new event types for newly supported behavior, and clearer non-documented diagnostics can ship within `CLI-OUTPUT-v1` when tests and docs are updated.
68
+
69
+ ## Release checklist
70
+
71
+ Before release, reviewers should confirm:
72
+
73
+ - the release preserves `CLI-OUTPUT-v1`, or explicitly documents the next compatibility baseline;
74
+ - changed machine-readable outputs remain parseable;
75
+ - changed human-readable outputs are intentional and covered by specs/docs;
76
+ - release notes call out any compatibility-relevant changes.
@@ -0,0 +1,37 @@
1
+ # Moose Inventory Approval Register
2
+
3
+ This register records durable approvals and explicitly separates prepared evidence from human approval.
4
+
5
+ ## Current status
6
+
7
+ The process tailoring baseline is approved as Class 4 with target profile Software Library / Package.
8
+
9
+ ## Approved decisions
10
+
11
+ | ID | Decision | Approver | Date | Scope | Conditions / limitations |
12
+ | --- | --- | --- | --- | --- | --- |
13
+ | GOV-TAILOR-001 | Tailor Moose Inventory as Class 4, target profile Software Library / Package | Russ / Rusty Frink Desiato | 2026-05-28 | Process baseline for this repository | Approval covers project class and target profile only. It does not approve product brief, requirements, CLI UX, architecture, security/privacy design, release, accepted risk, public/compliance claims, or future RubyGems publishing. Pure software-library target excludes normal hosted-runtime operations unless Moose Inventory later adds an operated runtime component. |
14
+ | GOV-PRODUCT-001 | Approve `docs/product/product-brief.md` as the product-framing baseline | Russ / Rusty Frink Desiato | 2026-05-28 | Product framing for Moose Inventory | Approval covers the product brief as product-framing baseline only. It does not approve detailed requirements, CLI UX, architecture, security/privacy design, release, accepted risk, public/compliance claims, or future RubyGems publishing. Open product questions remain unresolved until separately decided. |
15
+ | GOV-REQ-001 | Approve `docs/product/requirements-baseline.md` as the requirements and acceptance criteria baseline | Russ / Rusty Frink Desiato | 2026-05-28 | Requirements and acceptance criteria for Moose Inventory | Approval covers the requirements and acceptance criteria baseline only. It does not approve CLI UX, architecture, security/privacy design, release, accepted risk, public/compliance claims, future RubyGems publishing, or answers to open requirements questions that require separate decisions. |
16
+ | GOV-UX-001 | Approve `docs/ux/cli-workflow-notes.md` as the CLI UX/workflow baseline | Russ / Rusty Frink Desiato | 2026-05-28 | CLI UX/workflow baseline for Moose Inventory | Approval covers command-line workflows and interaction conventions only. It does not approve architecture, security/privacy design, release, accepted risk, public/compliance claims, future RubyGems publishing, or implementation of the UX follow-up backlog items. |
17
+ | GOV-ARCH-001 | Approve `docs/architecture/architecture-and-trust-boundaries.md` as the architecture and trust-boundary baseline | Russ / Rusty Frink Desiato | 2026-05-28 | Architecture and trust boundaries for Moose Inventory | Approval covers architecture and trust boundaries only. It does not approve security/privacy design, release, accepted risk, public/compliance claims, future RubyGems publishing, implementation of architecture follow-up backlog items, or repository/package account-management design. |
18
+ | GOV-SEC-001 | Approve `docs/security/security-privacy-process.md` as the security and privacy process baseline, with `docs/security/accepted-risk-register.md` approved as the register structure/evidence location | Russ / Rusty Frink Desiato | 2026-05-29 | Security and privacy process for Moose Inventory | Approval covers security/privacy process and the accepted-risk register structure only. It does not approve a release, public/compliance claims, future RubyGems publishing, or acceptance of any proposed/monitored risk. Current accepted-risk register still records no approved accepted risks. |
19
+ | GOV-RISK-REG-001 | Approve `docs/security/accepted-risk-register.md` as the maintained accepted-risk register baseline | Russ / Rusty Frink Desiato | 2026-05-29 | Accepted-risk register baseline for Moose Inventory | Approval covers the risk-register document, structure, rules, review cadence, and current proposed/monitored-risk evidence. It does not approve a release, public/compliance claims, future RubyGems publishing, or acceptance of any proposed/monitored risk. Current accepted-risk register still records no approved accepted risks. |
20
+ | GOV-MAINT-001 | Approve `docs/maintenance/package-maintenance-and-agent-boundaries.md` as the package maintenance and AI-agent operation-boundary baseline | Russ / Rusty Frink Desiato | 2026-05-29 | Package maintenance process and AI-agent operation boundaries for Moose Inventory | Approval covers routine package-maintenance process, release-readiness stewardship, and AI-agent boundaries only. It does not approve publishing, yanking/deprecating RubyGems versions, changing GitHub/RubyGems settings, accepting risk, public/compliance claims, external disclosures, or future RubyGems publishing. |
21
+
22
+ ## Pending approvals
23
+
24
+ _No pending approvals are currently recorded._
25
+
26
+ ## Approval rules
27
+
28
+ Approvals must include:
29
+
30
+ - decision
31
+ - approver
32
+ - date
33
+ - scope
34
+ - conditions or limitations
35
+ - follow-up date where relevant
36
+
37
+ Documents, checklists, audits, and passing tests are evidence. They are not approval unless an approver explicitly records the decision here or in another durable project evidence location.