@wpmoo/toolkit 0.9.29 → 0.9.30

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.
@@ -42,7 +42,7 @@ Run these from the generated environment root:
42
42
  | `./moo test <module[,module]> --db <db>` | Modules -> Run tests | Yes in prod | Runs Odoo tests for modules. |
43
43
  | `./moo lint` | Modules -> Run environment lint | No | Runs configured environment lint checks. |
44
44
  | `./moo pot <module[,module]> [db] [output]` | Modules -> Generate POT | No | Generates translation template files. |
45
- | `./moo snapshot [db] [name]` | Database -> Create snapshot | No | Creates a database and filestore snapshot. |
45
+ | `./moo snapshot [--list] [db] [name]` | Database -> Create snapshot | No | Creates a database and filestore snapshot, or lists known snapshots with `--list`. |
46
46
  | `./moo restore-snapshot --dry-run <name> [db]` | Database -> Restore snapshot | Preview only | Prints a restore preview without changing data. |
47
47
  | `./moo restore-snapshot <name> [db]` | Database -> Restore snapshot | Yes | Restores database and filestore from a snapshot. |
48
48
  | `./moo resetdb [db] [module[,module]]` | Database -> Reset database | Yes | Destructive database reset. |
@@ -88,6 +88,24 @@ Current JSON contract notes:
88
88
 
89
89
  Process environment values take precedence over `.env` values for safety flags.
90
90
 
91
+ ## Approval Ledger
92
+
93
+ For time-bounded local approvals, add JSONL entries to `.wpmoo/approvals.jsonl`.
94
+ Generated `.gitignore` ignores this file, and it should not be committed.
95
+ Existing `WPMOO_ALLOW_*` flags remain supported; ledger entries are an additive
96
+ way to make short-lived intent explicit.
97
+
98
+ Each line is one JSON object:
99
+
100
+ ```json
101
+ {"scope":"stage-lifecycle","environment":"stage","command":"install","expiresAt":"2026-05-21T12:30:00.000Z","reason":"release rehearsal"}
102
+ ```
103
+
104
+ Supported `scope` values are `stage-lifecycle`, `prod-lifecycle`,
105
+ `destructive`, `no-recent-snapshot`, and `migration-risk`. `environment` must be
106
+ `stage` or `prod`. `command` is optional; omit it only for a deliberately broad
107
+ approval. Expired, malformed, or mismatched entries are ignored.
108
+
91
109
  ## Exit Behavior
92
110
 
93
111
  - Successful commands exit `0`.
@@ -59,6 +59,11 @@ the process environment explicitly sets `WPMOO_ALLOW_PROD_LIFECYCLE=1`.
59
59
  Staging keeps these commands available for release rehearsal while still
60
60
  enforcing the destructive database guard above.
61
61
 
62
+ Generated environments also honor time-bounded local approvals from
63
+ `.wpmoo/approvals.jsonl`. Generated `.gitignore` ignores this ledger and
64
+ can approve the same scopes as the environment flags for a specific stage/prod
65
+ command until `expiresAt`.
66
+
62
67
  For PostgreSQL 18 environments (including `POSTGRES_IMAGE=postgres:18`), ensure db
63
68
  volume and tmpfs mount targets use `/var/lib/postgresql` directly:
64
69
 
@@ -80,12 +85,18 @@ database count, sessions currently running queries where `pg_stat_activity.state
80
85
  is `active`, long transactions / idle-in-transaction sessions, table health
81
86
  signals, unused index advisor signals, WAL and capacity visibility, and
82
87
  slow-query logging readiness (`log_min_duration_statement` and
83
- `pg_stat_statements` visibility). If the database is unavailable, doctor reports
84
- a warning instead of failing the whole environment check.
88
+ `pg_stat_statements` visibility). It also surfaces read-only PostgreSQL
89
+ configuration visibility for `shared_buffers`, `work_mem`,
90
+ `maintenance_work_mem`, `effective_cache_size`, and `shared_preload_libraries`.
91
+ If the database is unavailable, doctor reports a warning instead of failing the
92
+ whole environment check.
85
93
 
86
94
  `doctor --json --postgres` keeps output stable by exposing a versioned PostgreSQL
87
95
  diagnostics contract. The contract is intentionally permissive: fields are optional
88
96
  and omitted or marked unavailable when a running database does not expose them.
97
+ The broader `doctor --json` payload also includes optional `sections` entries
98
+ that group checks, warnings, and errors by generated files, compose, source
99
+ repositories, PostgreSQL, and host tools while preserving the legacy flat arrays.
89
100
 
90
101
  ## Safe reset policy
91
102
 
@@ -114,6 +125,13 @@ odoo/custom/manifests/
114
125
  Run `npx @wpmoo/toolkit reset --dry-run` before writing changes when you need to
115
126
  review the generated file refresh plan.
116
127
 
128
+ Pre-1.0 environments that still use `odoo/custom/src/<repo>` source folders are
129
+ treated as legacy private sources. `doctor` reports the migration path when
130
+ metadata is missing, and safe reset can register those folders in
131
+ `.wpmoo/odoo.json` plus `odoo/custom/manifests/sources.yaml` without deleting the
132
+ existing source folder. Module listing also reads the legacy folder while users
133
+ move it to `odoo/custom/src/private/<repo>` at their own pace.
134
+
117
135
  ## Snapshot policy
118
136
 
119
137
  Use restore preview before a destructive restore:
@@ -122,6 +140,9 @@ Use restore preview before a destructive restore:
122
140
  ./moo restore-snapshot --dry-run <snapshot-name> [db]
123
141
  ```
124
142
 
143
+ Use `./moo snapshot --list` to inspect known snapshot names, created times,
144
+ database hints, dump paths, and filestore presence before selecting one.
145
+
125
146
  `WPMOO_SNAPSHOT_RETENTION_COUNT` may be set to a positive integer to prune old
126
147
  snapshot manifests and their matching dump/filestore files after a new snapshot
127
148
  is written.
package/docs/handoff.md CHANGED
@@ -33,6 +33,10 @@ The optional `wpmoo` short alias is warning-only. If npm returns `E404` or
33
33
  otherwise rejects that alias, the release remains valid when the required
34
34
  scoped packages publish and verify correctly.
35
35
 
36
+ Smoke checks should be deterministic by always pinning the version you are
37
+ verifying, and by using one pinned package entrypoint for each artifact you
38
+ validate.
39
+
36
40
  Verify a tagged release with:
37
41
 
38
42
  ```bash
@@ -57,15 +61,23 @@ Optional short alias rule:
57
61
  Suggested smoke check:
58
62
 
59
63
  ```bash
60
- npm run smoke:published -- "$VERSION"
64
+ WPMOO_PUBLISHED_PACKAGE_SPEC="@wpmoo/toolkit@$VERSION" \
65
+ npm run smoke:published -- "$VERSION"
61
66
  ```
62
67
 
68
+ For full release reproducibility, keep the default package cache behavior and avoid
69
+ pre-existing global `NPM_CONFIG_CACHE` state unless you intentionally reuse it.
70
+
71
+ The smoke script checks `--version`, top-level `--help`, and critical command
72
+ help output before optional generated-environment acceptance smoke.
73
+
63
74
  For a 1.0.0 tag, run generated-environment acceptance smoke with
64
75
  WPMOO_SMOKE_ENVIRONMENT=1. Treat the release as final only after that smoke
65
76
  passes:
66
77
 
67
78
  ```bash
68
- WPMOO_SMOKE_ENVIRONMENT=1 npm run smoke:published -- "$VERSION"
79
+ WPMOO_SMOKE_ENVIRONMENT=1 WPMOO_PUBLISHED_PACKAGE_SPEC="@wpmoo/toolkit@$VERSION" \
80
+ npm run smoke:published -- "$VERSION"
69
81
  ```
70
82
 
71
83
  Current command standard:
@@ -125,6 +125,12 @@ Take a snapshot before risky changes:
125
125
  ./moo snapshot devel before-moo-test-update
126
126
  ```
127
127
 
128
+ List available snapshots before choosing one:
129
+
130
+ ```bash
131
+ ./moo snapshot --list
132
+ ```
133
+
128
134
  Preview a restore:
129
135
 
130
136
  ```bash
@@ -187,4 +193,3 @@ WPMOO_ENV=prod WPMOO_ALLOW_DESTRUCTIVE=1 ./moo restore-snapshot before-change de
187
193
 
188
194
  Do not set production flags globally in a shell profile. Prefer one-command
189
195
  environment variable prefixes so intent is visible in shell history.
190
-
@@ -151,6 +151,33 @@ Use the supported package path in automation:
151
151
  npx @wpmoo/toolkit --version
152
152
  ```
153
153
 
154
+ ## Published Smoke Is Not Reproducible
155
+
156
+ Symptoms:
157
+
158
+ - Smoke succeeds once and fails later, or output differs between runs.
159
+ - The smoke step fails on one environment but not another with the same tag.
160
+
161
+ Use an explicit package spec so each smoke run uses the same published package
162
+ artifact:
163
+
164
+ ```bash
165
+ VERSION="$(node -p "require('./package.json').version")"
166
+ WPMOO_PUBLISHED_PACKAGE_SPEC="@wpmoo/toolkit@$VERSION" \
167
+ npm run smoke:published -- "$VERSION"
168
+ ```
169
+
170
+ That script runs in temporary directories and uses a temporary npm cache when
171
+ `NPM_CONFIG_CACHE` is not already set. Set a fixed cache path only when you need
172
+ to reproduce with a shared cache.
173
+
174
+ For `1.0.0`, include generated-environment acceptance smoke:
175
+
176
+ ```bash
177
+ WPMOO_SMOKE_ENVIRONMENT=1 WPMOO_PUBLISHED_PACKAGE_SPEC="@wpmoo/toolkit@$VERSION" \
178
+ npm run smoke:published -- "$VERSION"
179
+ ```
180
+
154
181
  ## PostgreSQL Diagnostics Are Unavailable
155
182
 
156
183
  Symptoms:
@@ -182,6 +209,8 @@ Expected result when available:
182
209
 
183
210
  - The JSON payload includes `postgres.contractVersion`.
184
211
  - The diagnostics object includes `schemaVersion`.
212
+ - The optional `sections` array groups PostgreSQL warnings under the
213
+ `postgresql` section while preserving the flat `warnings` array.
185
214
  - Missing or malformed metric rows are reported as unavailable diagnostics
186
215
  instead of being treated as success.
187
216
 
@@ -222,4 +251,3 @@ WPMOO_ENV=stage WPMOO_ALLOW_DESTRUCTIVE=1 WPMOO_ALLOW_NO_RECENT_SNAPSHOT=1 ./moo
222
251
  Use the guard flag only when the command is intentional, reviewed, and has an
223
252
  appropriate rollback path. Migration-risk lifecycle commands may also require
224
253
  `WPMOO_ALLOW_MIGRATIONS=1`.
225
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpmoo/toolkit",
3
- "version": "0.9.29",
3
+ "version": "0.9.30",
4
4
  "description": "WPMoo Toolkit for development, staging, and production lifecycle workflows.",
5
5
  "type": "module",
6
6
  "repository": {