@rehearsal-db/core 0.1.0-beta.5 → 0.1.0-beta.7
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.
- package/CHANGELOG.md +56 -1
- package/COMPATIBILITY.md +5 -0
- package/README.md +112 -377
- package/SECURITY.md +2 -1
- package/docs/adapters.md +5 -0
- package/docs/baselines.md +81 -22
- package/docs/commands.md +105 -75
- package/docs/configuration.md +109 -8
- package/docs/getting-started.md +88 -227
- package/docs/glossary.md +7 -8
- package/docs/releasing.md +10 -1
- package/docs/roadmap.md +39 -0
- package/docs/security-model.md +5 -1
- package/docs/troubleshooting.md +69 -1
- package/docs/tutorial.md +70 -59
- package/package.json +4 -2
- package/scripts/lib/environment/local_supabase.mjs +8 -8
- package/scripts/lib/rehearsal/baseline_artifact.mjs +32 -3
- package/scripts/lib/rehearsal/cleanup.mjs +381 -0
- package/scripts/lib/rehearsal/configuration.d.mts +24 -3
- package/scripts/lib/rehearsal/configuration.mjs +337 -59
- package/scripts/lib/rehearsal/diagnostics.mjs +4 -2
- package/scripts/lib/rehearsal/plan.mjs +89 -14
- package/scripts/lib/rehearsal/runtime_restore.mjs +6 -2
- package/scripts/lib/rehearsal/setup.mjs +60 -28
- package/scripts/lib/runtime/postgresql_runtime.mjs +772 -0
- package/scripts/lib/runtime/runtime_target.mjs +41 -0
- package/scripts/lib/runtime/supabase_runtime.mjs +792 -0
- package/scripts/operations/database/manage_rehearsal_database.mjs +6 -785
- package/scripts/operations/rehearsal/rehearsal_cli.mjs +330 -31
package/docs/getting-started.md
CHANGED
|
@@ -1,290 +1,151 @@
|
|
|
1
1
|
# Getting started
|
|
2
2
|
|
|
3
|
-
This guide
|
|
4
|
-
|
|
3
|
+
This guide sets up Rehearsal in an existing project. It creates a disposable database on
|
|
4
|
+
your computer and never connects to a hosted database.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Want to experiment first? Use the [safe hands-on tutorial](tutorial.md).
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- npm
|
|
10
|
-
- Supabase CLI 2.117.0 (the version proved by package CI)
|
|
11
|
-
- Docker Desktop, Colima, or another Docker-compatible engine
|
|
12
|
-
- a Supabase project with timestamped SQL migrations
|
|
8
|
+
## 1. Check the required tools
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
You need Node.js 24, npm, and a running Docker-compatible engine:
|
|
15
11
|
|
|
16
12
|
```bash
|
|
17
13
|
node --version
|
|
18
14
|
npm --version
|
|
19
|
-
supabase --version
|
|
20
15
|
docker info
|
|
21
16
|
```
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
`node --version` must begin with `v24`. If `docker info` fails, start Docker Desktop,
|
|
19
|
+
Colima, or your usual Docker engine.
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
npm ci --ignore-scripts
|
|
28
|
-
npm run test:fixture
|
|
29
|
-
```
|
|
21
|
+
Choose the extra requirement for your project:
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
its labeled local runtime. It does not need a hosted Supabase project or credentials.
|
|
23
|
+
- **Supabase:** install Supabase CLI 2.117.0 and run `supabase --version`.
|
|
24
|
+
- **PostgreSQL:** download the local database image once:
|
|
34
25
|
|
|
35
|
-
|
|
26
|
+
```bash
|
|
27
|
+
docker pull postgres:17-alpine
|
|
28
|
+
```
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
Rehearsal will use that image with downloads disabled.
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
## 2. Install and open the guide
|
|
33
|
+
|
|
34
|
+
Run these commands from the directory containing your project's `package.json`:
|
|
42
35
|
|
|
43
36
|
```bash
|
|
44
37
|
npm install --save-dev @rehearsal-db/core@beta
|
|
45
38
|
npx rehearsal
|
|
46
39
|
```
|
|
47
40
|
|
|
48
|
-
Choose **Set
|
|
49
|
-
|
|
50
|
-
`.gitignore` entries before asking permission to write. The guide remains open afterward
|
|
51
|
-
and recommends the next incomplete stage.
|
|
41
|
+
Choose **Set the stage**, then choose Supabase or PostgreSQL. Rehearsal previews every file
|
|
42
|
+
before asking to create it. It will not replace an existing file.
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
Review the generated `rehearsal.config.mjs`, especially:
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Rehearsal never overwrites an existing configuration. For config-only/manual setup, use
|
|
61
|
-
`npx rehearsal init` followed by `npx rehearsal init --write`.
|
|
62
|
-
|
|
63
|
-
The generated configuration is intentionally incomplete until you review its ports,
|
|
64
|
-
project ID, application commands, and project-owned input paths. Do not run `doctor`
|
|
65
|
-
until the next section's files exist.
|
|
46
|
+
- the migration directory;
|
|
47
|
+
- the application start and proof commands;
|
|
48
|
+
- the local ports.
|
|
66
49
|
|
|
67
|
-
|
|
50
|
+
The proof command should check behavior changed by the migration. A test that only checks
|
|
51
|
+
whether the home page loads is usually too weak.
|
|
68
52
|
|
|
69
|
-
|
|
53
|
+
## 3. Prepare safe baseline inputs
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- an active baseline below `.rehearsal/`;
|
|
74
|
-
- an application proof command that exits nonzero when the restored app is wrong.
|
|
55
|
+
A **baseline** is the locked starting point restored before each rehearsal. Start with a
|
|
56
|
+
small synthetic dataset. Do not use raw production data.
|
|
75
57
|
|
|
76
|
-
|
|
58
|
+
Rehearsal needs:
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
| Input | What it contains |
|
|
61
|
+
| ------------------- | ---------------------------------------------------- |
|
|
62
|
+
| Records | Safe rows in NDJSON format: one JSON object per line |
|
|
63
|
+
| Migration ledger | The historical migrations represented by those rows |
|
|
64
|
+
| Sanitization policy | A decision for every included table and column |
|
|
65
|
+
| Storage manifest | Optional Supabase Storage files only |
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
port, and Studio port used by `rehearsal.config.mjs`. Disable services your proof does
|
|
85
|
-
not need. This must remain an unlinked local config; never run `supabase link` from it.
|
|
67
|
+
A record looks like this:
|
|
86
68
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
restored relationship and the candidate schema—not merely that `/` returns 200.
|
|
90
|
-
|
|
91
|
-
Start with synthetic rows shaped like your schema. Do not start onboarding with
|
|
92
|
-
production data. The following SQL, policy, row, and ledger form one matched example;
|
|
93
|
-
do not mix them with differently shaped snippets.
|
|
94
|
-
|
|
95
|
-
If you already have the safe NDJSON rows and migration ledger, Rehearsal can enumerate
|
|
96
|
-
their table and column shape into a fail-closed policy draft without printing values:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
npx rehearsal baseline prepare \
|
|
100
|
-
--records=rehearsal/synthetic-data.ndjson \
|
|
101
|
-
--ledger=rehearsal/migration-ledger.json
|
|
102
|
-
npx rehearsal baseline prepare \
|
|
103
|
-
--records=rehearsal/synthetic-data.ndjson \
|
|
104
|
-
--ledger=rehearsal/migration-ledger.json \
|
|
105
|
-
--write
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Running `npx rehearsal` instead discovers structurally matching project-local inputs and
|
|
109
|
-
offers them in the guide. Discovery is bounded, ignores generated/runtime directories,
|
|
110
|
-
and returns paths only. Before a policy draft or immutable baseline is written, Rehearsal
|
|
111
|
-
validates the selected files and presents a value-free shape and count summary.
|
|
112
|
-
|
|
113
|
-
After creating the draft, choose **Review the script** in the guide. For each table,
|
|
114
|
-
choose between reviewing every column or applying the displayed safe defaults and
|
|
115
|
-
reviewing only exceptions. Rehearsal suggests identifiers, relationship columns, and
|
|
116
|
-
timestamps as exceptions. Every saved column still records sanitization action,
|
|
117
|
-
generated status, identity status, and optional foreign-key metadata. The complete
|
|
118
|
-
policy is validated before writing, and the original draft is replaced only if it did
|
|
119
|
-
not change during review.
|
|
120
|
-
|
|
121
|
-
For noninteractive workflows, review every `REVIEW REQUIRED` field directly and remove
|
|
122
|
-
`"draft": true` only after that review. Rehearsal refuses to activate a draft.
|
|
123
|
-
|
|
124
|
-
Historical migration `supabase/migrations/20260101000000_create_widgets.sql`:
|
|
125
|
-
|
|
126
|
-
```sql
|
|
127
|
-
create table public.widgets (
|
|
128
|
-
id bigint generated by default as identity primary key,
|
|
129
|
-
name text not null,
|
|
130
|
-
created_at timestamptz not null default now()
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
insert into storage.buckets (id, name, public)
|
|
134
|
-
values ('fixture-assets', 'fixture-assets', false);
|
|
69
|
+
```json
|
|
70
|
+
{ "table": "widgets", "row": { "id": 1, "name": "Synthetic Widget" } }
|
|
135
71
|
```
|
|
136
72
|
|
|
137
|
-
|
|
73
|
+
Put your safe records and ledger inside the project. Conventional names such as
|
|
74
|
+
`rehearsal/sanitized-data.ndjson` and `rehearsal/migration-ledger.json` are discovered
|
|
75
|
+
automatically. The guide inspects their structure but does not print row values.
|
|
138
76
|
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
"policyVersion": 1,
|
|
142
|
-
"migrationCutoff": "20260101000000",
|
|
143
|
-
"tables": [
|
|
144
|
-
{
|
|
145
|
-
"name": "widgets",
|
|
146
|
-
"group": "synthetic",
|
|
147
|
-
"sourceRows": "STREAM AND SANITIZE",
|
|
148
|
-
"columns": [
|
|
149
|
-
{
|
|
150
|
-
"name": "id",
|
|
151
|
-
"action": "KEEP EXACTLY",
|
|
152
|
-
"generated": "NEVER",
|
|
153
|
-
"identity": "YES",
|
|
154
|
-
"foreignKey": null
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"name": "name",
|
|
158
|
-
"action": "REPLACE WITH SYNTHETIC",
|
|
159
|
-
"generated": "NEVER",
|
|
160
|
-
"identity": "NO",
|
|
161
|
-
"foreignKey": null
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"name": "created_at",
|
|
165
|
-
"action": "DERIVE",
|
|
166
|
-
"generated": "NEVER",
|
|
167
|
-
"identity": "NO",
|
|
168
|
-
"foreignKey": null
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
```
|
|
77
|
+
Follow the guide's recommended actions:
|
|
175
78
|
|
|
176
|
-
|
|
79
|
+
1. **Prepare the script** creates a draft sanitization policy.
|
|
80
|
+
2. **Review the script** asks you to classify every table and column.
|
|
81
|
+
3. **Create the baseline** validates and activates the reviewed inputs.
|
|
177
82
|
|
|
178
|
-
|
|
179
|
-
{
|
|
180
|
-
"table": "widgets",
|
|
181
|
-
"row": {
|
|
182
|
-
"id": 1,
|
|
183
|
-
"name": "Synthetic Widget",
|
|
184
|
-
"created_at": "2026-01-01T00:00:00.000Z"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
```
|
|
83
|
+
Rehearsal will not activate a policy containing undecided fields.
|
|
188
84
|
|
|
189
|
-
|
|
85
|
+
The ledger must describe the exact historical SQL included in the baseline. Do not type
|
|
86
|
+
years of migration history by hand for a real project. Generate it through reviewed
|
|
87
|
+
project tooling. The [tutorial](tutorial.md) contains a complete synthetic example, and
|
|
88
|
+
[Baselines](baselines.md) explains the file formats.
|
|
190
89
|
|
|
191
|
-
|
|
192
|
-
[
|
|
193
|
-
{
|
|
194
|
-
"version": "20260101000000",
|
|
195
|
-
"name": "create_widgets",
|
|
196
|
-
"statements": [
|
|
197
|
-
"create table public.widgets (\n\tid bigint generated by default as identity primary key,\n\tname text not null,\n\tcreated_at timestamptz not null default now()\n)",
|
|
198
|
-
"insert into storage.buckets (id, name, public)\nvalues ('fixture-assets', 'fixture-assets', false)"
|
|
199
|
-
]
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
```
|
|
90
|
+
## 4. Reach READY
|
|
203
91
|
|
|
204
|
-
The
|
|
205
|
-
|
|
206
|
-
that is merely equivalent is rejected. For a production-shaped baseline, generate this
|
|
207
|
-
ledger through the project's reviewed source/export tooling; do not reconstruct years of
|
|
208
|
-
history by hand.
|
|
92
|
+
The guide displays four setup stages. Continue with its recommended action until all
|
|
93
|
+
checks are complete and the project reports `READY`.
|
|
209
94
|
|
|
210
|
-
|
|
95
|
+
You can run the same check directly:
|
|
211
96
|
|
|
212
97
|
```bash
|
|
213
|
-
npx rehearsal
|
|
214
|
-
--records=rehearsal/synthetic-data.ndjson \
|
|
215
|
-
--ledger=rehearsal/migration-ledger.json
|
|
98
|
+
npx rehearsal doctor
|
|
216
99
|
```
|
|
217
100
|
|
|
218
|
-
|
|
101
|
+
If it reports `NOT READY`, fix the listed item and run it again. Do not bypass a check or
|
|
102
|
+
add a hosted connection string.
|
|
219
103
|
|
|
220
|
-
|
|
104
|
+
## 5. Run the rehearsal
|
|
221
105
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
```
|
|
106
|
+
Choose **Run a rehearsal**. Rehearsal shows the exact candidate migrations and asks for
|
|
107
|
+
confirmation before it changes the disposable runtime.
|
|
225
108
|
|
|
226
|
-
|
|
109
|
+
A successful run:
|
|
227
110
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
111
|
+
1. restores the baseline;
|
|
112
|
+
2. applies only the migrations you approved;
|
|
113
|
+
3. verifies the local database;
|
|
114
|
+
4. runs your application proof.
|
|
231
115
|
|
|
232
|
-
|
|
233
|
-
dependencies, artifact integrity, migration lineage, ports, and project commands.
|
|
116
|
+
Your original baseline remains unchanged.
|
|
234
117
|
|
|
235
|
-
|
|
236
|
-
check or copy a hosted connection string into the generated runtime environment.
|
|
118
|
+
## 6. Test and clean up
|
|
237
119
|
|
|
238
|
-
|
|
120
|
+
Use the guide for normal runtime tasks:
|
|
239
121
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
npx rehearsal inspect migrations
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
The plan prints an exact candidate digest. It does not start services or change data.
|
|
122
|
+
- **Verify** checks the current runtime.
|
|
123
|
+
- **Reset** discards runtime edits and restores the baseline.
|
|
124
|
+
- **Stop** stops the runtime but keeps its local state.
|
|
125
|
+
- **Discard** removes this project's disposable runtime and volume.
|
|
248
126
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
```bash
|
|
252
|
-
npx rehearsal run --confirm-candidates=<sha256>
|
|
253
|
-
```
|
|
127
|
+
Press `Ctrl+Z` at any prompt to exit the entire guide. It will not leave a suspended
|
|
128
|
+
process behind.
|
|
254
129
|
|
|
255
|
-
|
|
256
|
-
verifies the runtime, and runs the project-owned application proof. The resulting local
|
|
257
|
-
database is writable, so you can test real application changes without mutating the
|
|
258
|
-
baseline.
|
|
130
|
+
## Command-line setup
|
|
259
131
|
|
|
260
|
-
|
|
132
|
+
The guide is recommended for people. Scripts and CI can use explicit commands:
|
|
261
133
|
|
|
262
134
|
```bash
|
|
263
|
-
npx rehearsal
|
|
264
|
-
npx rehearsal
|
|
265
|
-
npx rehearsal
|
|
266
|
-
npx rehearsal
|
|
267
|
-
npx rehearsal stop
|
|
135
|
+
npx rehearsal setup --target=postgresql --write
|
|
136
|
+
npx rehearsal doctor
|
|
137
|
+
npx rehearsal candidates
|
|
138
|
+
npx rehearsal run --confirm-candidates=PASTE_DIGEST_HERE
|
|
268
139
|
```
|
|
269
140
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
stops only this project's runtime.
|
|
273
|
-
|
|
274
|
-
## Next steps
|
|
275
|
-
|
|
276
|
-
- Follow [the full tutorial](tutorial.md).
|
|
277
|
-
- Read [the security model](security-model.md) before designing a production export.
|
|
278
|
-
- Define an exhaustive [sanitization policy](sanitization.md).
|
|
279
|
-
- Learn the [baseline lifecycle](baselines.md).
|
|
141
|
+
Replace `postgresql` with `supabase` when needed. See [CLI commands](commands.md) for the
|
|
142
|
+
complete reference and [Troubleshooting](troubleshooting.md) when a check fails.
|
|
280
143
|
|
|
281
|
-
##
|
|
144
|
+
## Files Rehearsal creates
|
|
282
145
|
|
|
283
|
-
- `rehearsal.config.mjs`
|
|
284
|
-
|
|
285
|
-
- `.rehearsal/
|
|
286
|
-
-
|
|
287
|
-
- `.rehearsal/runtime/` contains the disposable local Supabase project and receipts.
|
|
288
|
-
- `.rehearsal/runtime.env` contains generated loopback-only application credentials.
|
|
146
|
+
- `rehearsal.config.mjs` — reviewed project configuration
|
|
147
|
+
- `.rehearsal/` — ignored baselines, runtime files, and receipts
|
|
148
|
+
- `.rehearsal/runtime.env` — generated local-only application variables
|
|
149
|
+
- `infrastructure/rehearsal/supabase/config.toml` — Supabase-only local configuration
|
|
289
150
|
|
|
290
|
-
|
|
151
|
+
Keep `.rehearsal/` out of source control, even when its data is synthetic.
|
package/docs/glossary.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Glossary
|
|
1
|
+
# Glossary
|
|
2
2
|
|
|
3
3
|
**Baseline** — immutable sanitized starting artifact.
|
|
4
4
|
|
|
@@ -19,13 +19,12 @@ baseline.
|
|
|
19
19
|
|
|
20
20
|
```mermaid
|
|
21
21
|
flowchart LR
|
|
22
|
-
A[
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
E --> F
|
|
27
|
-
F --> G[
|
|
28
|
-
G --> H[Verified local receipt]
|
|
22
|
+
A[Safe rows] --> B[Locked baseline]
|
|
23
|
+
C[Migration files] --> D[Reviewed plan]
|
|
24
|
+
B --> E[Disposable local database]
|
|
25
|
+
D --> E
|
|
26
|
+
E --> F[Application proof]
|
|
27
|
+
F --> G[Verified result]
|
|
29
28
|
```
|
|
30
29
|
|
|
31
30
|
The reusable package owns the path from a completed baseline plus migration directory to
|
package/docs/releasing.md
CHANGED
|
@@ -52,7 +52,16 @@ publication must change and prove the workflow before narrowing that permission.
|
|
|
52
52
|
protected integration branches and rerun their complete verification.
|
|
53
53
|
|
|
54
54
|
The workflow publishes prereleases under the `beta` dist-tag and refuses a stable
|
|
55
|
-
version.
|
|
55
|
+
version. While Rehearsal has no stable release, the workflow also moves `latest` to the
|
|
56
|
+
same reviewed beta. This keeps the npm package page and the ordinary
|
|
57
|
+
`npm install @rehearsal-db/core` command current. When Rehearsal gains a stable release,
|
|
58
|
+
`latest` must switch to the stable line while `beta` continues to identify prereleases.
|
|
59
|
+
|
|
60
|
+
The trusted publisher allows `npm dist-tag` only so this workflow can maintain those two
|
|
61
|
+
tags without a stored npm token. A manual workflow run from `main` can repair the tags
|
|
62
|
+
for the exact prerelease version currently recorded in `package.json`; it cannot publish
|
|
63
|
+
a package or select a different version. The protected `npm` environment still supplies
|
|
64
|
+
the human approval gate.
|
|
56
65
|
|
|
57
66
|
Creating the repository, passing CI, extracting the engine, merging a release branch,
|
|
58
67
|
or creating a tag does not authorize npm publication. Publication requires explicit
|
package/docs/roadmap.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Next steps
|
|
2
|
+
|
|
3
|
+
The current Rehearsal beta supports guided Supabase and ordinary PostgreSQL rehearsals.
|
|
4
|
+
The next work should be driven by real project use before adding more database targets.
|
|
5
|
+
|
|
6
|
+
## 1. Complete the first real-project acceptance run
|
|
7
|
+
|
|
8
|
+
Update an existing Supabase application to `@rehearsal-db/core@beta` on its own clean
|
|
9
|
+
branch, then prove:
|
|
10
|
+
|
|
11
|
+
- `doctor` reports `READY`;
|
|
12
|
+
- the intended candidate migrations are the only candidates;
|
|
13
|
+
- a complete rehearsal and the application proof pass;
|
|
14
|
+
- verify, reset, stop, and restart behave as expected.
|
|
15
|
+
|
|
16
|
+
Record any confusing instruction or unnecessary manual step. Those findings should guide
|
|
17
|
+
the next usability changes.
|
|
18
|
+
|
|
19
|
+
## 2. Simplify baseline onboarding
|
|
20
|
+
|
|
21
|
+
Make safe records, migration evidence, and sanitization-policy review easier for a new
|
|
22
|
+
developer. Reduce manual file preparation without weakening review, checksum, or
|
|
23
|
+
local-only safety rules.
|
|
24
|
+
|
|
25
|
+
## 3. Validate another ordinary PostgreSQL project
|
|
26
|
+
|
|
27
|
+
Use a non-Supabase application with real migration history and a synthetic baseline.
|
|
28
|
+
Fix general PostgreSQL problems before adding provider-specific behavior.
|
|
29
|
+
|
|
30
|
+
## 4. Consider PostgreSQL service compatibility
|
|
31
|
+
|
|
32
|
+
Only after the ordinary PostgreSQL workflow is reliable, evaluate compatibility needs
|
|
33
|
+
for individual PostgreSQL services. Keep rehearsals disposable and local; hosted database
|
|
34
|
+
execution remains outside the current safety model.
|
|
35
|
+
|
|
36
|
+
## Later
|
|
37
|
+
|
|
38
|
+
MySQL, MongoDB, and unrelated database families require different migration and restore
|
|
39
|
+
behavior. They remain out of scope until the PostgreSQL experience is proven and stable.
|
package/docs/security-model.md
CHANGED
|
@@ -13,12 +13,16 @@ changed migration history, incomplete artifacts, or an unverified runtime.
|
|
|
13
13
|
## Independent barriers
|
|
14
14
|
|
|
15
15
|
- loopback-only application and service URLs;
|
|
16
|
-
- a dedicated unlinked Supabase workdir and
|
|
16
|
+
- a dedicated unlinked Supabase workdir, or an exactly named and labeled PostgreSQL
|
|
17
|
+
container and volume;
|
|
17
18
|
- exact non-overlapping local ports;
|
|
18
19
|
- a clean child-process environment that omits hosted credentials;
|
|
19
20
|
- immutable baseline files and checksums;
|
|
20
21
|
- exact migration-prefix and candidate digests;
|
|
21
22
|
- local runtime labels used for bounded stop/removal;
|
|
23
|
+
- PostgreSQL images must already exist locally and are never pulled implicitly;
|
|
24
|
+
- plain PostgreSQL receives a fresh random password per disposable runtime, retained
|
|
25
|
+
only in owner-readable ignored runtime files;
|
|
22
26
|
- successful receipts written only after verification.
|
|
23
27
|
|
|
24
28
|
No single environment variable or config edit should redirect the tool to production.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
+
Start with:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx rehearsal doctor
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Doctor names each missing or unsafe item. If you still need help, run
|
|
10
|
+
`npx rehearsal support`, review the report, and attach it to a GitHub issue.
|
|
11
|
+
|
|
12
|
+
## `npx rehearsal` cannot find the command
|
|
13
|
+
|
|
14
|
+
Confirm you are in the project directory and install the beta locally:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install --save-dev @rehearsal-db/core@beta
|
|
18
|
+
npx rehearsal --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Do not use `sudo` or require a global install.
|
|
22
|
+
|
|
3
23
|
## Setup says Node.js 24 is required
|
|
4
24
|
|
|
5
25
|
Rehearsal intentionally supports one maintained Node.js major in its first beta. Switch
|
|
@@ -19,12 +39,55 @@ writes setup files.
|
|
|
19
39
|
Start Docker Desktop or Colima, confirm `docker info`, then rerun `rehearsal doctor`.
|
|
20
40
|
Restarting the computer is rarely necessary.
|
|
21
41
|
|
|
42
|
+
## Docker or Colima is out of disk space
|
|
43
|
+
|
|
44
|
+
Preview what Rehearsal can safely remove:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx rehearsal cleanup --include-images
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Review the list, then add `--write` and the printed `--confirm-cleanup` digest. Rehearsal
|
|
51
|
+
keeps the newest Supabase image for each service, refuses images used by any running or
|
|
52
|
+
stopped container, and never runs a global Docker or volume prune. Add
|
|
53
|
+
`--include-runtime` only when this project's disposable database may also be removed.
|
|
54
|
+
|
|
55
|
+
For example, copy the full digest from your preview:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx rehearsal cleanup --include-images --write --confirm-cleanup=PASTE_FULL_DIGEST_HERE
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For Colima, disk capacity belongs to the user rather than the project. Increase it with
|
|
62
|
+
`colima stop` followed by a larger `colima start --disk <GiB>` value. Rehearsal respects
|
|
63
|
+
that configuration and does not choose a disk size.
|
|
64
|
+
|
|
65
|
+
## The guide does not show styled menus
|
|
66
|
+
|
|
67
|
+
Rehearsal uses numbered menus when terminal styling is unavailable, `NO_COLOR` is set, or
|
|
68
|
+
`--plain` is used. Enter the number beside your choice. This is the same workflow and has
|
|
69
|
+
the same safety checks.
|
|
70
|
+
|
|
71
|
+
If bare `npx rehearsal` prints help, the command is not connected to an interactive
|
|
72
|
+
terminal. Run it directly in a terminal rather than through a pipe or background task.
|
|
73
|
+
|
|
74
|
+
## Doctor says the PostgreSQL image is unavailable
|
|
75
|
+
|
|
76
|
+
Rehearsal will not download an image during a rehearsal. Pull and review the exact image
|
|
77
|
+
declared in `rehearsal.config.mjs`, then rerun Doctor:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
docker pull postgres:17-alpine
|
|
81
|
+
npx rehearsal doctor
|
|
82
|
+
```
|
|
83
|
+
|
|
22
84
|
## A port is already in use
|
|
23
85
|
|
|
24
86
|
Rerun `rehearsal setup` to select a different available block. Setup checks both active
|
|
25
87
|
listeners and whether every selected port can be bound, then checks again before writing.
|
|
26
88
|
For an existing configuration, choose unique non-privileged ports and mirror them in the
|
|
27
|
-
dedicated Supabase config. Do not stop an unrelated database to make
|
|
89
|
+
dedicated Supabase config when using Supabase. Do not stop an unrelated database to make
|
|
90
|
+
defaults fit.
|
|
28
91
|
|
|
29
92
|
## Baseline checksum mismatch
|
|
30
93
|
|
|
@@ -62,5 +125,10 @@ is the local Auth callback. Do not paste provider secrets into config or termina
|
|
|
62
125
|
`reset` deliberately restores the immutable baseline. `stop` should preserve Docker
|
|
63
126
|
state, but runtime removal or a failed migration discards untrusted state.
|
|
64
127
|
|
|
128
|
+
## `Ctrl+Z` exits instead of suspending
|
|
129
|
+
|
|
130
|
+
This is intentional inside the guided interface. It exits the entire Rehearsal session
|
|
131
|
+
and restores the terminal. Choose **Exit** for the same result.
|
|
132
|
+
|
|
65
133
|
Use `--debug` only after ordinary output is insufficient. Diagnostics are redacted, but
|
|
66
134
|
you should still review output before sharing it publicly.
|