@rehearsal-db/core 0.1.0-beta.4 → 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 CHANGED
@@ -5,6 +5,58 @@ 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
+
37
+ ## [0.1.0-beta.5] - 2026-10-01
38
+
39
+ ### Added
40
+
41
+ - Scalable policy review with explicit table-level safe defaults, suggested structural
42
+ exceptions, per-table summaries, and real-PTY coverage of the bulk-review journey.
43
+ - Bounded project-local discovery for baseline records, migration ledgers, and optional
44
+ Storage manifests, plus a value-free structural preflight before activation.
45
+ - A guided `Get help` action and scriptable `rehearsal support` report with tool
46
+ versions, readiness statuses, privacy guarantees, and a direct bug-report link.
47
+
48
+ ### Changed
49
+
50
+ - Guided policy review can classify ordinary columns in bulk as synthetic replacements
51
+ while keeping likely identifiers, relationships, and timestamps selected for
52
+ individual review. The saved policy still records every required column decision.
53
+ - The baseline guide offers detected inputs instead of requiring memorized paths,
54
+ validates referenced Storage files up front, previews counts without row values, and
55
+ returns to the guide with an actionable message when validation fails.
56
+ - Beta support no longer requires users to assemble environment details by hand; the
57
+ generated report omits project paths, row values, credentials, migration SQL, and
58
+ baseline identifiers and remains available before setup is complete.
59
+
8
60
  ## [0.1.0-beta.4] - 2026-10-01
9
61
 
10
62
  ### Added
@@ -118,7 +170,9 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
118
170
  publication uses short-lived trusted OIDC, and every release tag must already exist on
119
171
  protected `main`.
120
172
 
121
- [Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.4...HEAD
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
175
+ [0.1.0-beta.5]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.4...v0.1.0-beta.5
122
176
  [0.1.0-beta.4]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.3...v0.1.0-beta.4
123
177
  [0.1.0-beta.3]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.2...v0.1.0-beta.3
124
178
  [0.1.0-beta.2]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.1...v0.1.0-beta.2
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,401 +1,138 @@
1
1
  # Rehearsal
2
2
 
3
- Rehearsal tests pending Supabase migrations against a verified, sanitized,
4
- production-shaped baseline in a disposable local environment. It is designed for the
5
- historical edge cases that synthetic seed data rarely represents.
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
- Version 0.1 targets Supabase CLI projects running PostgreSQL locally. It does not yet
8
- claim support for arbitrary unmanaged PostgreSQL installations.
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
- Public beta releases are distributed through npm as `@rehearsal-db/core`. Publication is
11
- restricted to reviewed artifacts from protected `main`; source availability alone does
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
- ## Documentation
13
+ ## What you need
15
14
 
16
- - [Getting started](docs/getting-started.md)
17
- - [End-to-end tutorial](docs/tutorial.md)
18
- - [Configuration reference](docs/configuration.md)
19
- - [CLI commands](docs/commands.md)
20
- - [Sanitization policy](docs/sanitization.md)
21
- - [Production source boundary](docs/production-source.md)
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
- ## Why use it?
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
- A migration passing against an empty database proves only that the migration can build
32
- a new schema. Rehearsal also proves that:
25
+ ## Quick start
33
26
 
34
- - the baseline is the exact immutable artifact you reviewed;
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
- ## What Rehearsal is—and is not
29
+ ```bash
30
+ npm install --save-dev @rehearsal-db/core@beta
31
+ npx rehearsal
32
+ ```
43
33
 
44
- Rehearsal complements existing database workflows instead of replacing them:
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
- | Tool or environment | Primary job | What Rehearsal adds |
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
- The package does not extract production data. A project may use Rehearsal entirely with
55
- synthetic data, or build its own least-privilege extraction and sanitization boundary.
56
- The current beta runs local Supabase services and therefore does not support an arbitrary
57
- unmanaged PostgreSQL server.
40
+ ```bash
41
+ docker pull postgres:17-alpine
42
+ ```
58
43
 
59
- ## Local cost and storage
44
+ Rehearsal itself never downloads a database image during a rehearsal.
60
45
 
61
- Rehearsal itself has no hosted-service fee and never creates a cloud database. Normal
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
- The restored runtime is intentionally writable. Exact baseline row counts and foreign
70
- keys are proved during reset before the runtime is accepted; later verification allows
71
- row-level divergence from sandbox interaction or candidate data migrations while still
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
- ## Quick start
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
- Install the current beta from npm:
55
+ ## The normal workflow
78
56
 
79
- ```bash
80
- npm install --save-dev @rehearsal-db/core@beta
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
- Contributors testing an unreleased change can use `npm link` or install the tarball
84
- produced by `npm pack` from a local checkout. In a consuming project, the commands are:
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
- ```bash
87
- npx rehearsal
88
- npx rehearsal setup
89
- npx rehearsal setup --write
90
- npx rehearsal init
91
- npx rehearsal init --write
92
- npx rehearsal baseline prepare --records=<safe.ndjson> --ledger=<ledger.json>
93
- npx rehearsal baseline prepare --records=<safe.ndjson> --ledger=<ledger.json> --write
94
- npx rehearsal baseline create --records=<safe.ndjson> --ledger=<ledger.json>
95
- npx rehearsal doctor
96
- npx rehearsal explain
97
- npx rehearsal run --dry-run
98
- npx rehearsal candidates
99
- npx rehearsal inspect baseline
100
- npx rehearsal inspect migrations
101
- npx rehearsal start
102
- npx rehearsal migrate --confirm-candidates=<sha256>
103
- npx rehearsal status
104
- npx rehearsal verify
105
- npx rehearsal reset
106
- npx rehearsal stop
107
- npx rehearsal discard
108
- ```
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.
79
+
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
109
101
 
110
- Running `npx rehearsal` in a terminal opens a state-aware guide that shows completed
111
- setup steps and recommends available actions. The guide stays open after each action,
112
- re-inspects the project, and advances to the next useful step. It includes an interactive
113
- column-by-column policy reviewer, concise completion receipts, and optional technical
114
- details. The explicit commands remain the stable interface for automation and CI.
115
-
116
- `setup` previews a conservative first-run scaffold: the Rehearsal configuration, a
117
- dedicated local-only Supabase configuration on an available port block, and protective
118
- `.gitignore` entries. It writes only with `--write`, never overwrites project files, and
119
- does not copy enabled external providers from the application's Supabase configuration.
120
- After writing, it runs the same readiness checks as `doctor` and shows the remaining
121
- project-owned inputs. Use `init` when you want to create only the configuration file
122
- manually.
123
-
124
- `baseline prepare` inspects only the shape of explicit local synthetic records and writes
125
- a fail-closed sanitization-policy draft. Every column remains `REVIEW REQUIRED` until a
126
- human classifies its sanitization action, generated/identity behavior, and foreign key.
127
- Drafts cannot be activated, and a reviewed policy is checksum-bound to its baseline.
128
-
129
- `init` previews a type-aware ESM `rehearsal.config.mjs`; it writes only with `--write`
130
- and never overwrites an existing file. The explicit `.mjs` extension makes the generated
131
- configuration executable in both CommonJS and ESM projects. Review all detected values.
132
- Rehearsal intentionally does not detect, copy, or enable a hosted project.
133
-
134
- `doctor` must end with `READY` before execution. `explain` and `run --dry-run` use the
135
- same immutable planner and perform no state-changing operations. In a terminal,
136
- `rehearsal run` displays and confirms the exact candidate set before touching the local
137
- runtime. Automation supplies the digest explicitly:
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:
138
117
 
139
118
  ```bash
140
- npx rehearsal run --confirm-candidates=<sha256>
119
+ npx rehearsal support
141
120
  ```
142
121
 
143
- The `rehearsal` executable is the public command contract. Repository availability does
144
- not itself authorize an npm publication.
145
-
146
- To try the entire workflow without configuring a project or touching hosted data, clone
147
- this repository and run `npm ci --ignore-scripts && npm run test:fixture`. It installs
148
- the exact packed artifact into a clean synthetic Supabase project and proves both
149
- success and failure.
150
-
151
- ## Configuration
152
-
153
- Configuration has an explicit schema version. Version 1 rejects unknown versions,
154
- unknown properties, paths outside the project root, non-loopback targets, duplicate or
155
- privileged ports, enabled hosted access, and permissive outbound networking.
156
-
157
- ```ts
158
- import { defineRehearsalConfig } from "@rehearsal-db/core";
159
-
160
- export default defineRehearsalConfig({
161
- schemaVersion: 1,
162
- project: { name: "my-supabase-app" },
163
- supabase: {
164
- workdir: ".",
165
- migrationDirectory: "supabase/migrations",
166
- rehearsalConfig: "infrastructure/rehearsal/supabase/config.toml",
167
- runtimeWorkdir: ".rehearsal/runtime",
168
- serviceEnvironmentFile: ".env.rehearsal-service.local",
169
- serviceEnvironmentVariables: [
170
- "LOCAL_IDENTITY_CLIENT_ID",
171
- "LOCAL_IDENTITY_SECRET",
172
- ],
173
- },
174
- baseline: {
175
- artifactDirectory: ".rehearsal",
176
- sanitizationPolicy: "infrastructure/rehearsal/sanitization-policy.json",
177
- },
178
- application: {
179
- startCommand: "npm run dev:rehearsal",
180
- proofCommand: "npm run test:rehearsal",
181
- environmentFile: ".rehearsal/runtime.env",
182
- },
183
- runtime: {
184
- applicationUrl: "http://localhost:5175",
185
- projectId: "my-app-rehearsal",
186
- apiPort: 58321,
187
- databasePort: 58322,
188
- studioPort: 58323,
189
- },
190
- safety: {
191
- allowedHosts: ["127.0.0.1", "::1", "localhost"],
192
- blockedEnvironmentVariables: [
193
- "SUPABASE_ACCESS_TOKEN",
194
- "SUPABASE_DB_PASSWORD",
195
- "SUPABASE_PROJECT_ID",
196
- ],
197
- authenticationProviders: ["example-identity-provider"],
198
- hostedAccess: "disabled",
199
- outboundNetwork: "deny",
200
- },
201
- verification: { commands: ["npm run test:rehearsal"] },
202
- });
203
- ```
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).
204
126
 
205
- | Property | Type | Required | Default | Meaning and safety effect |
206
- | -------------------------------------- | ---------- | -------- | ------------------------- | ------------------------------------------------------------- |
207
- | `schemaVersion` | `1` | Yes | None | Pins configuration meaning; unknown versions fail. |
208
- | `project.name` | `string` | Yes | None | Stable lowercase local identifier. |
209
- | `supabase.workdir` | `string` | Yes | None | Project-owned Supabase workdir; cannot escape the project. |
210
- | `supabase.migrationDirectory` | `string` | Yes | None | Ordered application migration source. |
211
- | `supabase.rehearsalConfig` | `string` | Yes | None | Dedicated unlinked local Supabase configuration. |
212
- | `supabase.runtimeWorkdir` | `string` | Yes | None | Must be `<artifactDirectory>/runtime`; always disposable. |
213
- | `supabase.serviceEnvironmentFile` | `string` | No | None | Owner-only ignored credentials for the local service stack. |
214
- | `supabase.serviceEnvironmentVariables` | `string[]` | No | `[]` | Exact variables accepted from the service environment file. |
215
- | `baseline.artifactDirectory` | `string` | No | `.rehearsal` | Must be named `.rehearsal`; deletion-safe artifact boundary. |
216
- | `baseline.sanitizationPolicy` | `string` | Yes | None | Exhaustive project-owned classification policy. |
217
- | `application.startCommand` | `string` | Yes | None | Starts the app against the verified local runtime. |
218
- | `application.proofCommand` | `string` | Yes | None | Project-owned proof after migration. |
219
- | `application.environmentFile` | `string` | No | `.rehearsal/runtime.env` | Owner-only generated local runtime variables. |
220
- | `application.runtimeAdapter` | `string` | No | None | Advanced project-owned post-restore adapter path. |
221
- | `runtime.applicationUrl` | URL | No | `http://localhost:5175` | Must use an explicitly allowed loopback host. |
222
- | `runtime.projectId` | `string` | No | `rehearsal-local` | Dedicated local Supabase/Docker identity. |
223
- | `runtime.apiPort` | TCP port | Yes | None | Dedicated non-privileged API port. |
224
- | `runtime.databasePort` | TCP port | Yes | None | Dedicated non-privileged PostgreSQL port. |
225
- | `runtime.studioPort` | TCP port | Yes | None | Dedicated non-privileged Studio port. |
226
- | `safety.allowedHosts` | `string[]` | No | loopback hosts | Version 1 rejects any non-loopback entry. |
227
- | `safety.blockedEnvironmentVariables` | `string[]` | No | Supabase hosted variables | Ambient values excluded from child processes. |
228
- | `safety.authenticationProviders` | `string[]` | No | `[]` | Declared identity-only external exchanges. |
229
- | `safety.hostedAccess` | `disabled` | No | `disabled` | Cannot be enabled in version 1. |
230
- | `safety.outboundNetwork` | `deny` | No | `deny` | Cannot be weakened in version 1. |
231
- | `verification.commands` | `string[]` | No | `[]` | Additional declared project checks; commands remain explicit. |
232
-
233
- Most projects should not use `runtimeAdapter`. It exists for a project that must create
234
- synthetic local identities or add application-specific variables after a successful
235
- restore. The adapter is project-owned, receives only the verified local environment and
236
- baseline plus a local PostgreSQL executor, and is never bundled into the reusable
237
- package. Its `configureRuntime` export returns a status message and explicit environment
238
- variables. It must not read hosted credentials or perform network work.
239
-
240
- ## What each command proves
241
-
242
- ### `rehearsal doctor`
243
-
244
- Doctor checks Node 24, the Supabase CLI, a running Docker-compatible engine, required
245
- paths, config/runtime port agreement, baseline checksums and permissions, migration
246
- prefix integrity, application proof command ownership, and the fail-closed safety
247
- policy. Ambient hosted credential variables are reported only by name and remain
248
- quarantined from children.
249
-
250
- ### `rehearsal explain` and `rehearsal run --dry-run`
251
-
252
- Both return the same plan data. They may read and hash configuration, migrations,
253
- policy, and baseline metadata. They never start or stop services, restore rows, apply a
254
- migration, launch the application, write a receipt, change an artifact, or contact a
255
- hosted resource.
256
-
257
- ### `rehearsal inspect baseline`
258
-
259
- Inspection prints format and generation identifiers, the migration cutoff, table and
260
- row counts, and hashes for baseline data and sanitization policy. It never prints source
261
- rows or baseline values.
262
-
263
- ### `rehearsal inspect migrations`
264
-
265
- Every local migration receives one interpretation:
266
-
267
- - `represented_by_baseline`: exact filename and SHA-256 in the baseline prefix;
268
- - `candidate`: exact suffix after that prefix, not yet proven in the current runtime;
269
- - `applied_to_current_runtime`: the exact suffix digest has a verified local receipt;
270
- - `modified`: a prefix filename or digest changed, so planning fails closed;
271
- - `invalid`: filename, ordering, uniqueness, or source structure is invalid.
272
-
273
- `rehearsal candidates` is the concise machine-friendly alias for this same migration
274
- inspection and exact candidate digest. It does not apply a migration.
275
-
276
- ## Machine output and exit codes
277
-
278
- Commands that report state accept `--json`. The version-1 envelope contains
279
- `schemaVersion`, `command`, `status`, `startedAt`, `durationMs`, `warnings`, and `data`.
280
- Failures contain a versioned error with category, stable code, message, expected and
281
- actual state, context, refused action, suggestions, and a safe diagnostic identifier.
282
-
283
- | Exit | Category |
284
- | ---- | ------------------------------ |
285
- | 0 | Success |
286
- | 1 | Doctor completed but not ready |
287
- | 2 | Configuration invalid |
288
- | 3 | Unsafe environment |
289
- | 4 | Baseline invalid |
290
- | 5 | Baseline checksum mismatch |
291
- | 6 | Migration candidate failure |
292
- | 7 | Migration verification failure |
293
- | 8 | Application proof failure |
294
- | 9 | Runtime or dependency failure |
295
- | 10 | Unexpected internal failure |
296
-
297
- Human and JSON output are projections of the same model. `normal`, `--verbose`, and
298
- `--debug` increase explanation only; none may print secrets or baseline row values.
299
-
300
- ## Guarantees
301
-
302
- Rehearsal version 1 intends to guarantee:
303
-
304
- - configuration and runtime targets are local-only;
305
- - hosted application/database credentials are neither required nor inherited by child processes;
306
- - application, provider-data, email, and hosted-database side effects fail closed;
307
- - any declared external identity exchange terminates in the local Auth service and its
308
- credentials are read from an exact owner-only allowlist;
309
- - an active baseline verifies before restore;
310
- - migration identity uses ordered content digests, not timestamps alone;
311
- - a changed prefix is never silently reinterpreted as a candidate;
312
- - restore and migration failures cannot leave a runtime marked trusted;
313
- - reports omit source rows and redact credentials, connection strings, keys, tokens,
314
- JWTs, passwords, and sensitive environment values.
315
-
316
- Independent barriers include strict loopback config, a dedicated unlinked Supabase
317
- workdir/project ID, an allowlisted child environment, and application egress denial.
318
- A project may explicitly declare an external identity provider, but that does not grant
319
- hosted application/database access. A single ambient connection string is therefore
320
- insufficient to redirect an operation.
321
-
322
- ## Non-guarantees and user responsibilities
323
-
324
- Rehearsal does not prove that a migration is semantically correct for every application
325
- workflow, replace backups or disaster recovery, authorize production access, or make a
326
- sanitization policy correct merely because it is exhaustive. Project owners must review
327
- the policy, protect baseline artifacts, write meaningful application proofs, review the
328
- candidate digest, and keep production credentials outside the Rehearsal configuration.
329
-
330
- ## Baseline lifecycle
331
-
332
- The source boundary exposes only reviewed versioned views through a least-privilege
333
- read-only role. Every included column has an explicit KEEP, PSEUDONYMIZE, REPLACE,
334
- EXCLUDE, or DERIVE action. Sanitized rows stream into an owner-only build directory.
335
- Only after exact hashes, counts, migration receipts, and policy metadata exist does an
336
- atomic pointer activate the generation. Failed builds cannot replace the current
337
- baseline.
127
+ ## For contributors
338
128
 
339
- Restore replays the immutable historical migration bundle, streams sanitized rows into
340
- the disposable local database, restores optional checksummed Storage assets through the
341
- loopback service, restores normal enforcement, and verifies counts and foreign keys
342
- before candidate work begins. The package accepts project-owned asset bytes; it does not
343
- know how to authorize or extract them from a hosted source.
344
-
345
- Project policies may attach field-aware JSON rules and project-owned identity adapters.
346
- A consuming project can use those boundaries to preserve reviewed application data
347
- while sanitizing unrelated private values, without teaching the package its table
348
- names, identity relationships, or privacy decisions.
349
-
350
- ## CI example
351
-
352
- The tracked [verification workflow](.github/workflows/verify.yml) is intentionally based
353
- on the synthetic independent fixture. A real repository should provide its own protected
354
- sanitized baseline through an approved artifact mechanism; never commit production data
355
- or credentials just to make CI convenient.
356
-
357
- ## Run the independent proof
358
-
359
- From this repository on Node.js 24 with Docker running:
129
+ Use Node.js 24, run `npm ci`, then run:
360
130
 
361
131
  ```bash
132
+ npm run check
133
+ npm run test:fixture:postgresql
362
134
  npm run test:fixture
363
135
  ```
364
136
 
365
- The proof copies the tracked synthetic fixture to a disposable directory, builds its
366
- one-row and one-asset baseline, runs the public CLI through one valid migration and
367
- application proof, verifies the exact Storage byte, then introduces invalid PostgreSQL.
368
- Success means the valid migration preserved its row and asset, the invalid migration
369
- received the intended stable failure category, and the untrusted runtime was removed.
370
- It neither needs nor inherits application-specific or hosted credentials.
371
-
372
- ## Support matrix for the first beta
373
-
374
- | Runtime or tool | Status | Initial contract |
375
- | ---------------- | ------------ | ----------------------------------------------------- |
376
- | Node.js 24 | Supported | Exact maintained major |
377
- | npm | Supported | Lockfile-backed install and CLI |
378
- | macOS | Supported | Directly exercised with Docker/Colima |
379
- | Linux | Supported | Ubuntu x64 CI and Bookworm arm64 Colima proofs |
380
- | WSL | Experimental | Must be exercised and documented before support claim |
381
- | Native Windows | Unsupported | Path, Docker, signal, and shell behavior unproven |
382
- | pnpm | Unsupported | Detection is informational until direct proof exists |
383
- | Yarn | Unsupported | Detection is informational until direct proof exists |
384
- | MySQL/Mongo/etc. | Unsupported | Version 1 is PostgreSQL/Supabase only |
385
-
386
- ## Troubleshooting
387
-
388
- - `NOT READY` after Docker: start Docker Desktop or Colima, then rerun doctor.
389
- - Baseline checksum mismatch: do not repair the hash manually. Rebuild through the
390
- reviewed extraction/sanitization workflow.
391
- - Migration prefix divergence: restore the exact reviewed historical file or create a
392
- new baseline; never rename the edited file into the candidate suffix.
393
- - Candidate confirmation mismatch: rerun explain, review the exact ordered candidates,
394
- and use the new digest only if those files are intended.
395
- - Hosted target refusal: remove the hosted value. Version 1 has no override.
396
- - Application proof failure: inspect the project-owned proof output; the database must
397
- not be treated as verified.
398
-
399
- Security reporting, compatibility promises, and regression measurements are defined in
400
- [SECURITY.md](SECURITY.md), [COMPATIBILITY.md](COMPATIBILITY.md), and
401
- [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 explicit non-guarantees live in [README.md](README.md). Every
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/SUPPORT.md CHANGED
@@ -6,6 +6,11 @@ Docker engine, the failing command, safe diagnostics, and the smallest reproduct
6
6
  The first beta does not yet maintain a separate public discussion or feature-request
7
7
  channel.
8
8
 
9
+ Run `npx rehearsal support` or choose **Get help** in the guide to collect the environment
10
+ and readiness portion without assembling it by hand. The report intentionally excludes
11
+ project paths, row values, credentials, migration SQL, and baseline identifiers. Review
12
+ the report before pasting it into an issue.
13
+
9
14
  Do not include credentials, connection strings, source rows, baseline artifacts, private
10
15
  URLs, or proprietary migrations. Report security problems through private vulnerability
11
16
  reporting as described in [SECURITY.md](SECURITY.md).
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