@rehearsal-db/core 0.1.0-beta.5 → 0.1.0-beta.6
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 +31 -1
- package/COMPATIBILITY.md +5 -0
- package/README.md +105 -377
- package/SECURITY.md +2 -1
- package/docs/adapters.md +5 -0
- package/docs/baselines.md +81 -22
- package/docs/commands.md +76 -75
- package/docs/configuration.md +47 -4
- package/docs/getting-started.md +88 -227
- package/docs/glossary.md +7 -8
- package/docs/security-model.md +5 -1
- package/docs/troubleshooting.md +46 -1
- package/docs/tutorial.md +70 -59
- package/package.json +4 -2
- package/scripts/lib/rehearsal/configuration.d.mts +18 -3
- package/scripts/lib/rehearsal/configuration.mjs +227 -56
- package/scripts/lib/rehearsal/diagnostics.mjs +4 -2
- package/scripts/lib/rehearsal/plan.mjs +85 -10
- 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 +790 -0
- package/scripts/operations/database/manage_rehearsal_database.mjs +6 -785
- package/scripts/operations/rehearsal/rehearsal_cli.mjs +138 -30
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
## [0.1.0-beta.6] - 2026-10-02
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Beginner documentation now follows one guided path, defines unfamiliar terms where
|
|
13
|
+
they first appear, provides a disposable PostgreSQL tutorial, and keeps advanced detail
|
|
14
|
+
in focused reference pages.
|
|
15
|
+
- Pressing `Ctrl+Z` at an interactive guide prompt now exits Rehearsal cleanly instead
|
|
16
|
+
of suspending the process and leaving it attached to the terminal.
|
|
17
|
+
- Database lifecycle selection now goes through a closed runtime-driver boundary while
|
|
18
|
+
preserving Supabase as the backward-compatible default. This created the safe,
|
|
19
|
+
testable seam used by the PostgreSQL target without changing existing configurations.
|
|
20
|
+
- The installed-package proof now chooses an available local port block and a unique
|
|
21
|
+
project identity, so local verification does not collide with another Rehearsal run.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- An ordinary PostgreSQL runtime target with guided setup, loopback-only Docker
|
|
26
|
+
isolation, exact migration receipts, baseline restore, application proof, lifecycle
|
|
27
|
+
commands, and a separate installed-package integration proof.
|
|
28
|
+
- PostgreSQL setup refuses implicit image downloads and Supabase-only Storage baselines,
|
|
29
|
+
uses a fresh random local password per runtime, and requires exact Rehearsal ownership
|
|
30
|
+
labels before removing resources.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Plain-terminal nested menus now print their choices before asking for a number,
|
|
35
|
+
including database selection, discovered baseline inputs, and runtime management.
|
|
36
|
+
|
|
8
37
|
## [0.1.0-beta.5] - 2026-10-01
|
|
9
38
|
|
|
10
39
|
### Added
|
|
@@ -141,7 +170,8 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
|
|
|
141
170
|
publication uses short-lived trusted OIDC, and every release tag must already exist on
|
|
142
171
|
protected `main`.
|
|
143
172
|
|
|
144
|
-
[Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.
|
|
173
|
+
[Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.6...HEAD
|
|
174
|
+
[0.1.0-beta.6]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.5...v0.1.0-beta.6
|
|
145
175
|
[0.1.0-beta.5]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.4...v0.1.0-beta.5
|
|
146
176
|
[0.1.0-beta.4]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.3...v0.1.0-beta.4
|
|
147
177
|
[0.1.0-beta.3]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.2...v0.1.0-beta.3
|
package/COMPATIBILITY.md
CHANGED
|
@@ -20,3 +20,8 @@ or successful verification receipt.
|
|
|
20
20
|
The first stable `1.0.0` requires external beta evidence, a support policy, and a settled
|
|
21
21
|
public API. Supporting additional database families, package managers, or operating
|
|
22
22
|
systems is not implied by the 0.x contract.
|
|
23
|
+
|
|
24
|
+
The PostgreSQL target covers timestamped SQL migrations running in a dedicated local
|
|
25
|
+
`postgres` Docker image. It does not imply support for hosted connection strings,
|
|
26
|
+
existing unmanaged servers, ORM-specific nested migration formats, Supabase Storage, or
|
|
27
|
+
Supabase Auth emulation.
|
package/README.md
CHANGED
|
@@ -1,410 +1,138 @@
|
|
|
1
1
|
# Rehearsal
|
|
2
2
|
|
|
3
|
-
Rehearsal tests
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Rehearsal tests PostgreSQL and Supabase migrations on your computer before you run them
|
|
4
|
+
anywhere important. It restores safe test data into a disposable local database, applies
|
|
5
|
+
only the migrations you approve, and runs your project's own test command.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Rehearsal never connects to a hosted database. It is a migration-testing tool, not a
|
|
8
|
+
backup system or a production deployment tool.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
not enable production access.
|
|
10
|
+
> Rehearsal is in public beta. Use it on a branch and keep a working backup of your
|
|
11
|
+
> project.
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## What you need
|
|
15
14
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- [Baselines](docs/baselines.md)
|
|
23
|
-
- [Project adapters](docs/adapters.md)
|
|
24
|
-
- [Security model](docs/security-model.md)
|
|
25
|
-
- [Troubleshooting](docs/troubleshooting.md)
|
|
26
|
-
- [Release process](docs/releasing.md)
|
|
27
|
-
- [Glossary and architecture](docs/glossary.md)
|
|
15
|
+
- Node.js 24 and npm
|
|
16
|
+
- Docker Desktop, Colima, or another Docker-compatible engine
|
|
17
|
+
- timestamped `.sql` migration files
|
|
18
|
+
- a project test command that can prove the migrated application works
|
|
19
|
+
- Supabase CLI 2.117.0 for a Supabase project, or the local
|
|
20
|
+
`postgres:17-alpine` image for a PostgreSQL project
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
No database experience is required to follow the guide, but you should understand what
|
|
23
|
+
your migration is intended to change.
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
a new schema. Rehearsal also proves that:
|
|
25
|
+
## Quick start
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
- historical migration files still match the baseline's digest-addressed prefix;
|
|
36
|
-
- only the exact suffix is treated as candidate work;
|
|
37
|
-
- production-shaped relationships survive restore and migration;
|
|
38
|
-
- optional bounded Storage objects retain exact checksums through local restore;
|
|
39
|
-
- the resulting local application can pass a project-owned proof;
|
|
40
|
-
- unsafe or ambiguous state stops execution.
|
|
27
|
+
From your project directory:
|
|
41
28
|
|
|
42
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npm install --save-dev @rehearsal-db/core@beta
|
|
31
|
+
npx rehearsal
|
|
32
|
+
```
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
The guide shows your progress and offers the next safe action. On first use, choose
|
|
35
|
+
**Set the stage**, select Supabase or PostgreSQL, review the preview, and confirm the files
|
|
36
|
+
it will create. Existing files are never overwritten.
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
| ----------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
-
| Backups and point-in-time recovery | Recover lost production data | A disposable, writable migration test; Rehearsal is not disaster recovery. |
|
|
49
|
-
| Staging | Exercise an integrated deployed application | A local resettable database shaped by reviewed production history, without giving the runtime a hosted target. |
|
|
50
|
-
| Synthetic seed data | Create small, known test scenarios | Sanitized production-shaped relationships and historical edge cases, when the project explicitly authorizes them. |
|
|
51
|
-
| Database branches or preview databases | Isolate hosted database changes | A loopback-only runtime with immutable baseline checks, exact candidate confirmation, and project-owned acceptance proofs. |
|
|
52
|
-
| Migration linters and migration-only test tools | Inspect SQL or prove a migration applies | Restore, migrate, run the real application proof, preserve sandbox edits, and reset to the verified baseline. |
|
|
38
|
+
For PostgreSQL, download the reviewed local image once before running the guide:
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
unmanaged PostgreSQL server.
|
|
40
|
+
```bash
|
|
41
|
+
docker pull postgres:17-alpine
|
|
42
|
+
```
|
|
58
43
|
|
|
59
|
-
|
|
44
|
+
Rehearsal itself never downloads a database image during a rehearsal.
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
local costs are Docker CPU, memory, and disk space for Supabase images, the immutable
|
|
63
|
-
baseline, optional retained Storage assets, and the disposable runtime. Production-shaped
|
|
64
|
-
artifacts can be large: review their manifest size before activation, keep bounded
|
|
65
|
-
retention, and use `rehearsal discard` when the runtime is no longer needed. Deleting the
|
|
66
|
-
runtime does not delete the immutable baseline; baseline retention remains a project-owned
|
|
67
|
-
privacy and disk-management decision.
|
|
46
|
+
## Three terms you will see
|
|
68
47
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
checking the immutable artifact, migration lineage, runtime boundary, and project-owned
|
|
73
|
-
invariants. Reset restores and reproves the exact starting data.
|
|
48
|
+
- **Baseline:** a locked, safe starting copy of your schema and test data.
|
|
49
|
+
- **Candidate migration:** a new migration that is not part of the baseline yet.
|
|
50
|
+
- **Runtime:** the disposable local database where the rehearsal happens.
|
|
74
51
|
|
|
75
|
-
|
|
52
|
+
The baseline may contain synthetic data or properly sanitized production-shaped data.
|
|
53
|
+
Start with synthetic data. Rehearsal does not copy or sanitize production data for you.
|
|
76
54
|
|
|
77
|
-
|
|
55
|
+
## The normal workflow
|
|
78
56
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
1. Run `npx rehearsal`.
|
|
58
|
+
2. Let the guide create the local-only configuration.
|
|
59
|
+
3. Review the sanitization policy and create the baseline.
|
|
60
|
+
4. Review the exact candidate migration list.
|
|
61
|
+
5. Run the rehearsal and your application proof.
|
|
62
|
+
6. Test the local application, then verify, reset, stop, or discard the runtime.
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
Press `Ctrl+Z` at any guided prompt to exit the whole session. Choose **Get help**, or run
|
|
65
|
+
`npx rehearsal support`, to create a privacy-safe diagnostic report.
|
|
85
66
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
npx rehearsal run --dry-run
|
|
99
|
-
npx rehearsal candidates
|
|
100
|
-
npx rehearsal inspect baseline
|
|
101
|
-
npx rehearsal inspect migrations
|
|
102
|
-
npx rehearsal start
|
|
103
|
-
npx rehearsal migrate --confirm-candidates=<sha256>
|
|
104
|
-
npx rehearsal status
|
|
105
|
-
npx rehearsal verify
|
|
106
|
-
npx rehearsal reset
|
|
107
|
-
npx rehearsal stop
|
|
108
|
-
npx rehearsal discard
|
|
109
|
-
```
|
|
67
|
+
## What Rehearsal protects
|
|
68
|
+
|
|
69
|
+
- The database listens only on your computer.
|
|
70
|
+
- Hosted database credentials are removed from child processes.
|
|
71
|
+
- The approved baseline and migration history are checksum-verified.
|
|
72
|
+
- A changed migration produces a new approval digest.
|
|
73
|
+
- Failed migrations cannot leave a runtime marked as trusted.
|
|
74
|
+
- Runtime cleanup targets only resources carrying the exact Rehearsal labels.
|
|
75
|
+
|
|
76
|
+
Rehearsal does not prove that a migration is correct for every user workflow. Your
|
|
77
|
+
project's proof command should test the behavior that matters, not only whether a page
|
|
78
|
+
loads.
|
|
110
79
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
80
|
+
## Supported today
|
|
81
|
+
|
|
82
|
+
| Environment | Support |
|
|
83
|
+
| ------------------------------------------- | ---------------------- |
|
|
84
|
+
| Supabase CLI projects | Supported |
|
|
85
|
+
| Ordinary PostgreSQL in local Docker | Supported |
|
|
86
|
+
| macOS and Linux | Supported |
|
|
87
|
+
| WSL | Experimental |
|
|
88
|
+
| Native Windows | Not yet supported |
|
|
89
|
+
| Hosted database URLs | Intentionally rejected |
|
|
90
|
+
| MySQL, MongoDB, and other database families | Not yet supported |
|
|
91
|
+
|
|
92
|
+
See [COMPATIBILITY.md](COMPATIBILITY.md) for the exact support contract.
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
Start here:
|
|
97
|
+
|
|
98
|
+
- [Getting started](docs/getting-started.md) — set up your own project
|
|
99
|
+
- [Safe hands-on tutorial](docs/tutorial.md) — try the full flow in a disposable project
|
|
100
|
+
- [Troubleshooting](docs/troubleshooting.md) — fix common setup problems
|
|
101
|
+
|
|
102
|
+
Reference:
|
|
103
|
+
|
|
104
|
+
- [CLI commands](docs/commands.md)
|
|
105
|
+
- [Configuration](docs/configuration.md)
|
|
106
|
+
- [Baselines](docs/baselines.md)
|
|
107
|
+
- [Sanitization](docs/sanitization.md)
|
|
108
|
+
- [Security model](docs/security-model.md)
|
|
109
|
+
- [Project adapters](docs/adapters.md)
|
|
110
|
+
- [Production data boundary](docs/production-source.md)
|
|
111
|
+
- [Glossary and architecture](docs/glossary.md)
|
|
112
|
+
- [Release process](docs/releasing.md)
|
|
113
|
+
|
|
114
|
+
## Getting support
|
|
115
|
+
|
|
116
|
+
Run:
|
|
147
117
|
|
|
148
118
|
```bash
|
|
149
|
-
npx rehearsal
|
|
119
|
+
npx rehearsal support
|
|
150
120
|
```
|
|
151
121
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this repository and run `npm ci --ignore-scripts && npm run test:fixture`. It installs
|
|
157
|
-
the exact packed artifact into a clean synthetic Supabase project and proves both
|
|
158
|
-
success and failure.
|
|
159
|
-
|
|
160
|
-
## Configuration
|
|
161
|
-
|
|
162
|
-
Configuration has an explicit schema version. Version 1 rejects unknown versions,
|
|
163
|
-
unknown properties, paths outside the project root, non-loopback targets, duplicate or
|
|
164
|
-
privileged ports, enabled hosted access, and permissive outbound networking.
|
|
165
|
-
|
|
166
|
-
```ts
|
|
167
|
-
import { defineRehearsalConfig } from "@rehearsal-db/core";
|
|
168
|
-
|
|
169
|
-
export default defineRehearsalConfig({
|
|
170
|
-
schemaVersion: 1,
|
|
171
|
-
project: { name: "my-supabase-app" },
|
|
172
|
-
supabase: {
|
|
173
|
-
workdir: ".",
|
|
174
|
-
migrationDirectory: "supabase/migrations",
|
|
175
|
-
rehearsalConfig: "infrastructure/rehearsal/supabase/config.toml",
|
|
176
|
-
runtimeWorkdir: ".rehearsal/runtime",
|
|
177
|
-
serviceEnvironmentFile: ".env.rehearsal-service.local",
|
|
178
|
-
serviceEnvironmentVariables: [
|
|
179
|
-
"LOCAL_IDENTITY_CLIENT_ID",
|
|
180
|
-
"LOCAL_IDENTITY_SECRET",
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
baseline: {
|
|
184
|
-
artifactDirectory: ".rehearsal",
|
|
185
|
-
sanitizationPolicy: "infrastructure/rehearsal/sanitization-policy.json",
|
|
186
|
-
},
|
|
187
|
-
application: {
|
|
188
|
-
startCommand: "npm run dev:rehearsal",
|
|
189
|
-
proofCommand: "npm run test:rehearsal",
|
|
190
|
-
environmentFile: ".rehearsal/runtime.env",
|
|
191
|
-
},
|
|
192
|
-
runtime: {
|
|
193
|
-
applicationUrl: "http://localhost:5175",
|
|
194
|
-
projectId: "my-app-rehearsal",
|
|
195
|
-
apiPort: 58321,
|
|
196
|
-
databasePort: 58322,
|
|
197
|
-
studioPort: 58323,
|
|
198
|
-
},
|
|
199
|
-
safety: {
|
|
200
|
-
allowedHosts: ["127.0.0.1", "::1", "localhost"],
|
|
201
|
-
blockedEnvironmentVariables: [
|
|
202
|
-
"SUPABASE_ACCESS_TOKEN",
|
|
203
|
-
"SUPABASE_DB_PASSWORD",
|
|
204
|
-
"SUPABASE_PROJECT_ID",
|
|
205
|
-
],
|
|
206
|
-
authenticationProviders: ["example-identity-provider"],
|
|
207
|
-
hostedAccess: "disabled",
|
|
208
|
-
outboundNetwork: "deny",
|
|
209
|
-
},
|
|
210
|
-
verification: { commands: ["npm run test:rehearsal"] },
|
|
211
|
-
});
|
|
212
|
-
```
|
|
122
|
+
Review the result, then include it in a
|
|
123
|
+
[GitHub issue](https://github.com/Ddupasquier/rehearsal-db/issues). Never share database
|
|
124
|
+
rows, credentials, connection strings, private migrations, or baseline files. Security
|
|
125
|
+
problems belong in the private process described in [SECURITY.md](SECURITY.md).
|
|
213
126
|
|
|
214
|
-
|
|
215
|
-
| -------------------------------------- | ---------- | -------- | ------------------------- | ------------------------------------------------------------- |
|
|
216
|
-
| `schemaVersion` | `1` | Yes | None | Pins configuration meaning; unknown versions fail. |
|
|
217
|
-
| `project.name` | `string` | Yes | None | Stable lowercase local identifier. |
|
|
218
|
-
| `supabase.workdir` | `string` | Yes | None | Project-owned Supabase workdir; cannot escape the project. |
|
|
219
|
-
| `supabase.migrationDirectory` | `string` | Yes | None | Ordered application migration source. |
|
|
220
|
-
| `supabase.rehearsalConfig` | `string` | Yes | None | Dedicated unlinked local Supabase configuration. |
|
|
221
|
-
| `supabase.runtimeWorkdir` | `string` | Yes | None | Must be `<artifactDirectory>/runtime`; always disposable. |
|
|
222
|
-
| `supabase.serviceEnvironmentFile` | `string` | No | None | Owner-only ignored credentials for the local service stack. |
|
|
223
|
-
| `supabase.serviceEnvironmentVariables` | `string[]` | No | `[]` | Exact variables accepted from the service environment file. |
|
|
224
|
-
| `baseline.artifactDirectory` | `string` | No | `.rehearsal` | Must be named `.rehearsal`; deletion-safe artifact boundary. |
|
|
225
|
-
| `baseline.sanitizationPolicy` | `string` | Yes | None | Exhaustive project-owned classification policy. |
|
|
226
|
-
| `application.startCommand` | `string` | Yes | None | Starts the app against the verified local runtime. |
|
|
227
|
-
| `application.proofCommand` | `string` | Yes | None | Project-owned proof after migration. |
|
|
228
|
-
| `application.environmentFile` | `string` | No | `.rehearsal/runtime.env` | Owner-only generated local runtime variables. |
|
|
229
|
-
| `application.runtimeAdapter` | `string` | No | None | Advanced project-owned post-restore adapter path. |
|
|
230
|
-
| `runtime.applicationUrl` | URL | No | `http://localhost:5175` | Must use an explicitly allowed loopback host. |
|
|
231
|
-
| `runtime.projectId` | `string` | No | `rehearsal-local` | Dedicated local Supabase/Docker identity. |
|
|
232
|
-
| `runtime.apiPort` | TCP port | Yes | None | Dedicated non-privileged API port. |
|
|
233
|
-
| `runtime.databasePort` | TCP port | Yes | None | Dedicated non-privileged PostgreSQL port. |
|
|
234
|
-
| `runtime.studioPort` | TCP port | Yes | None | Dedicated non-privileged Studio port. |
|
|
235
|
-
| `safety.allowedHosts` | `string[]` | No | loopback hosts | Version 1 rejects any non-loopback entry. |
|
|
236
|
-
| `safety.blockedEnvironmentVariables` | `string[]` | No | Supabase hosted variables | Ambient values excluded from child processes. |
|
|
237
|
-
| `safety.authenticationProviders` | `string[]` | No | `[]` | Declared identity-only external exchanges. |
|
|
238
|
-
| `safety.hostedAccess` | `disabled` | No | `disabled` | Cannot be enabled in version 1. |
|
|
239
|
-
| `safety.outboundNetwork` | `deny` | No | `deny` | Cannot be weakened in version 1. |
|
|
240
|
-
| `verification.commands` | `string[]` | No | `[]` | Additional declared project checks; commands remain explicit. |
|
|
241
|
-
|
|
242
|
-
Most projects should not use `runtimeAdapter`. It exists for a project that must create
|
|
243
|
-
synthetic local identities or add application-specific variables after a successful
|
|
244
|
-
restore. The adapter is project-owned, receives only the verified local environment and
|
|
245
|
-
baseline plus a local PostgreSQL executor, and is never bundled into the reusable
|
|
246
|
-
package. Its `configureRuntime` export returns a status message and explicit environment
|
|
247
|
-
variables. It must not read hosted credentials or perform network work.
|
|
248
|
-
|
|
249
|
-
## What each command proves
|
|
250
|
-
|
|
251
|
-
### `rehearsal doctor`
|
|
252
|
-
|
|
253
|
-
Doctor checks Node 24, the Supabase CLI, a running Docker-compatible engine, required
|
|
254
|
-
paths, config/runtime port agreement, baseline checksums and permissions, migration
|
|
255
|
-
prefix integrity, application proof command ownership, and the fail-closed safety
|
|
256
|
-
policy. Ambient hosted credential variables are reported only by name and remain
|
|
257
|
-
quarantined from children.
|
|
258
|
-
|
|
259
|
-
### `rehearsal explain` and `rehearsal run --dry-run`
|
|
260
|
-
|
|
261
|
-
Both return the same plan data. They may read and hash configuration, migrations,
|
|
262
|
-
policy, and baseline metadata. They never start or stop services, restore rows, apply a
|
|
263
|
-
migration, launch the application, write a receipt, change an artifact, or contact a
|
|
264
|
-
hosted resource.
|
|
265
|
-
|
|
266
|
-
### `rehearsal inspect baseline`
|
|
267
|
-
|
|
268
|
-
Inspection prints format and generation identifiers, the migration cutoff, table and
|
|
269
|
-
row counts, and hashes for baseline data and sanitization policy. It never prints source
|
|
270
|
-
rows or baseline values.
|
|
271
|
-
|
|
272
|
-
### `rehearsal inspect migrations`
|
|
273
|
-
|
|
274
|
-
Every local migration receives one interpretation:
|
|
275
|
-
|
|
276
|
-
- `represented_by_baseline`: exact filename and SHA-256 in the baseline prefix;
|
|
277
|
-
- `candidate`: exact suffix after that prefix, not yet proven in the current runtime;
|
|
278
|
-
- `applied_to_current_runtime`: the exact suffix digest has a verified local receipt;
|
|
279
|
-
- `modified`: a prefix filename or digest changed, so planning fails closed;
|
|
280
|
-
- `invalid`: filename, ordering, uniqueness, or source structure is invalid.
|
|
281
|
-
|
|
282
|
-
`rehearsal candidates` is the concise machine-friendly alias for this same migration
|
|
283
|
-
inspection and exact candidate digest. It does not apply a migration.
|
|
284
|
-
|
|
285
|
-
## Machine output and exit codes
|
|
286
|
-
|
|
287
|
-
Commands that report state accept `--json`. The version-1 envelope contains
|
|
288
|
-
`schemaVersion`, `command`, `status`, `startedAt`, `durationMs`, `warnings`, and `data`.
|
|
289
|
-
Failures contain a versioned error with category, stable code, message, expected and
|
|
290
|
-
actual state, context, refused action, suggestions, and a safe diagnostic identifier.
|
|
291
|
-
|
|
292
|
-
| Exit | Category |
|
|
293
|
-
| ---- | ------------------------------ |
|
|
294
|
-
| 0 | Success |
|
|
295
|
-
| 1 | Doctor completed but not ready |
|
|
296
|
-
| 2 | Configuration invalid |
|
|
297
|
-
| 3 | Unsafe environment |
|
|
298
|
-
| 4 | Baseline invalid |
|
|
299
|
-
| 5 | Baseline checksum mismatch |
|
|
300
|
-
| 6 | Migration candidate failure |
|
|
301
|
-
| 7 | Migration verification failure |
|
|
302
|
-
| 8 | Application proof failure |
|
|
303
|
-
| 9 | Runtime or dependency failure |
|
|
304
|
-
| 10 | Unexpected internal failure |
|
|
305
|
-
|
|
306
|
-
Human and JSON output are projections of the same model. `normal`, `--verbose`, and
|
|
307
|
-
`--debug` increase explanation only; none may print secrets or baseline row values.
|
|
308
|
-
|
|
309
|
-
## Guarantees
|
|
310
|
-
|
|
311
|
-
Rehearsal version 1 intends to guarantee:
|
|
312
|
-
|
|
313
|
-
- configuration and runtime targets are local-only;
|
|
314
|
-
- hosted application/database credentials are neither required nor inherited by child processes;
|
|
315
|
-
- application, provider-data, email, and hosted-database side effects fail closed;
|
|
316
|
-
- any declared external identity exchange terminates in the local Auth service and its
|
|
317
|
-
credentials are read from an exact owner-only allowlist;
|
|
318
|
-
- an active baseline verifies before restore;
|
|
319
|
-
- migration identity uses ordered content digests, not timestamps alone;
|
|
320
|
-
- a changed prefix is never silently reinterpreted as a candidate;
|
|
321
|
-
- restore and migration failures cannot leave a runtime marked trusted;
|
|
322
|
-
- reports omit source rows and redact credentials, connection strings, keys, tokens,
|
|
323
|
-
JWTs, passwords, and sensitive environment values.
|
|
324
|
-
|
|
325
|
-
Independent barriers include strict loopback config, a dedicated unlinked Supabase
|
|
326
|
-
workdir/project ID, an allowlisted child environment, and application egress denial.
|
|
327
|
-
A project may explicitly declare an external identity provider, but that does not grant
|
|
328
|
-
hosted application/database access. A single ambient connection string is therefore
|
|
329
|
-
insufficient to redirect an operation.
|
|
330
|
-
|
|
331
|
-
## Non-guarantees and user responsibilities
|
|
332
|
-
|
|
333
|
-
Rehearsal does not prove that a migration is semantically correct for every application
|
|
334
|
-
workflow, replace backups or disaster recovery, authorize production access, or make a
|
|
335
|
-
sanitization policy correct merely because it is exhaustive. Project owners must review
|
|
336
|
-
the policy, protect baseline artifacts, write meaningful application proofs, review the
|
|
337
|
-
candidate digest, and keep production credentials outside the Rehearsal configuration.
|
|
338
|
-
|
|
339
|
-
## Baseline lifecycle
|
|
340
|
-
|
|
341
|
-
The source boundary exposes only reviewed versioned views through a least-privilege
|
|
342
|
-
read-only role. Every included column has an explicit KEEP, PSEUDONYMIZE, REPLACE,
|
|
343
|
-
EXCLUDE, or DERIVE action. Sanitized rows stream into an owner-only build directory.
|
|
344
|
-
Only after exact hashes, counts, migration receipts, and policy metadata exist does an
|
|
345
|
-
atomic pointer activate the generation. Failed builds cannot replace the current
|
|
346
|
-
baseline.
|
|
127
|
+
## For contributors
|
|
347
128
|
|
|
348
|
-
|
|
349
|
-
the disposable local database, restores optional checksummed Storage assets through the
|
|
350
|
-
loopback service, restores normal enforcement, and verifies counts and foreign keys
|
|
351
|
-
before candidate work begins. The package accepts project-owned asset bytes; it does not
|
|
352
|
-
know how to authorize or extract them from a hosted source.
|
|
353
|
-
|
|
354
|
-
Project policies may attach field-aware JSON rules and project-owned identity adapters.
|
|
355
|
-
A consuming project can use those boundaries to preserve reviewed application data
|
|
356
|
-
while sanitizing unrelated private values, without teaching the package its table
|
|
357
|
-
names, identity relationships, or privacy decisions.
|
|
358
|
-
|
|
359
|
-
## CI example
|
|
360
|
-
|
|
361
|
-
The tracked [verification workflow](.github/workflows/verify.yml) is intentionally based
|
|
362
|
-
on the synthetic independent fixture. A real repository should provide its own protected
|
|
363
|
-
sanitized baseline through an approved artifact mechanism; never commit production data
|
|
364
|
-
or credentials just to make CI convenient.
|
|
365
|
-
|
|
366
|
-
## Run the independent proof
|
|
367
|
-
|
|
368
|
-
From this repository on Node.js 24 with Docker running:
|
|
129
|
+
Use Node.js 24, run `npm ci`, then run:
|
|
369
130
|
|
|
370
131
|
```bash
|
|
132
|
+
npm run check
|
|
133
|
+
npm run test:fixture:postgresql
|
|
371
134
|
npm run test:fixture
|
|
372
135
|
```
|
|
373
136
|
|
|
374
|
-
The
|
|
375
|
-
|
|
376
|
-
application proof, verifies the exact Storage byte, then introduces invalid PostgreSQL.
|
|
377
|
-
Success means the valid migration preserved its row and asset, the invalid migration
|
|
378
|
-
received the intended stable failure category, and the untrusted runtime was removed.
|
|
379
|
-
It neither needs nor inherits application-specific or hosted credentials.
|
|
380
|
-
|
|
381
|
-
## Support matrix for the first beta
|
|
382
|
-
|
|
383
|
-
| Runtime or tool | Status | Initial contract |
|
|
384
|
-
| ---------------- | ------------ | ----------------------------------------------------- |
|
|
385
|
-
| Node.js 24 | Supported | Exact maintained major |
|
|
386
|
-
| npm | Supported | Lockfile-backed install and CLI |
|
|
387
|
-
| macOS | Supported | Directly exercised with Docker/Colima |
|
|
388
|
-
| Linux | Supported | Ubuntu x64 CI and Bookworm arm64 Colima proofs |
|
|
389
|
-
| WSL | Experimental | Must be exercised and documented before support claim |
|
|
390
|
-
| Native Windows | Unsupported | Path, Docker, signal, and shell behavior unproven |
|
|
391
|
-
| pnpm | Unsupported | Detection is informational until direct proof exists |
|
|
392
|
-
| Yarn | Unsupported | Detection is informational until direct proof exists |
|
|
393
|
-
| MySQL/Mongo/etc. | Unsupported | Version 1 is PostgreSQL/Supabase only |
|
|
394
|
-
|
|
395
|
-
## Troubleshooting
|
|
396
|
-
|
|
397
|
-
- `NOT READY` after Docker: start Docker Desktop or Colima, then rerun doctor.
|
|
398
|
-
- Baseline checksum mismatch: do not repair the hash manually. Rebuild through the
|
|
399
|
-
reviewed extraction/sanitization workflow.
|
|
400
|
-
- Migration prefix divergence: restore the exact reviewed historical file or create a
|
|
401
|
-
new baseline; never rename the edited file into the candidate suffix.
|
|
402
|
-
- Candidate confirmation mismatch: rerun explain, review the exact ordered candidates,
|
|
403
|
-
and use the new digest only if those files are intended.
|
|
404
|
-
- Hosted target refusal: remove the hosted value. Version 1 has no override.
|
|
405
|
-
- Application proof failure: inspect the project-owned proof output; the database must
|
|
406
|
-
not be treated as verified.
|
|
407
|
-
|
|
408
|
-
Security reporting, compatibility promises, and regression measurements are defined in
|
|
409
|
-
[SECURITY.md](SECURITY.md), [COMPATIBILITY.md](COMPATIBILITY.md), and
|
|
410
|
-
[BENCHMARKS.md](BENCHMARKS.md).
|
|
137
|
+
The fixture commands install the packed package into clean synthetic projects. They do
|
|
138
|
+
not connect to hosted services. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full rules.
|
package/SECURITY.md
CHANGED
|
@@ -12,7 +12,8 @@ Supported security updates cover the latest released 0.x minor during beta. A se
|
|
|
12
12
|
fix may deliberately tighten configuration or refuse a workflow that an earlier beta
|
|
13
13
|
accepted. During beta, reports apply to the latest published release and current `main`.
|
|
14
14
|
|
|
15
|
-
The threat boundary and
|
|
15
|
+
The threat boundary and remaining responsibilities live in
|
|
16
|
+
[docs/security-model.md](docs/security-model.md). Every
|
|
16
17
|
release candidate must pass secret-pattern checks, dependency and package-content
|
|
17
18
|
audits, the installed Linux fixture, and private-reporting verification. The current
|
|
18
19
|
platform evidence covers protected Ubuntu x64 CI and a direct Bookworm arm64 Colima run;
|
package/docs/adapters.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Project runtime adapters
|
|
2
2
|
|
|
3
|
+
These project-owned hooks are different from Rehearsal's database runtime drivers. A
|
|
4
|
+
database driver starts and manages a kind of local database, such as Supabase or plain
|
|
5
|
+
PostgreSQL. A project
|
|
6
|
+
runtime adapter adds narrowly scoped application behavior after that database is ready.
|
|
7
|
+
|
|
3
8
|
Adapters are an advanced escape hatch for project-specific restore behavior. They live
|
|
4
9
|
in the consuming repository and are loaded only from the path declared in config.
|
|
5
10
|
|