@rehearsal-db/core 0.1.0-beta.1 → 0.1.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +271 -1
  2. package/COMPATIBILITY.md +26 -0
  3. package/README.md +150 -346
  4. package/SECURITY.md +2 -1
  5. package/SUPPORT.md +5 -0
  6. package/docs/README.md +38 -0
  7. package/docs/adapters.md +20 -6
  8. package/docs/architecture.md +58 -0
  9. package/docs/baselines.md +102 -22
  10. package/docs/commands.md +202 -33
  11. package/docs/configuration.md +288 -13
  12. package/docs/getting-started.md +114 -181
  13. package/docs/glossary.md +11 -8
  14. package/docs/index.md +47 -0
  15. package/docs/production-source.md +176 -33
  16. package/docs/releasing.md +28 -38
  17. package/docs/roadmap.md +41 -0
  18. package/docs/runtime-policies.md +253 -0
  19. package/docs/sanitization.md +144 -8
  20. package/docs/security-model.md +34 -9
  21. package/docs/standalone-workflow.md +109 -0
  22. package/docs/troubleshooting.md +127 -2
  23. package/docs/tutorial.md +70 -59
  24. package/package.json +39 -23
  25. package/scripts/install/create_root_config.mjs +36 -0
  26. package/scripts/runtime/manage_database.mjs +18 -0
  27. package/src/README.md +17 -0
  28. package/src/application/session.mjs +435 -0
  29. package/{scripts/lib/rehearsal/baseline_artifact.mjs → src/baseline/artifact.mjs} +142 -17
  30. package/{scripts/lib/rehearsal/baseline_builder.mjs → src/baseline/builder.mjs} +19 -10
  31. package/src/baseline/input_discovery.mjs +155 -0
  32. package/src/baseline/policy_review.mjs +92 -0
  33. package/src/baseline/preparation.mjs +323 -0
  34. package/src/baseline/privacy_engine.mjs +741 -0
  35. package/{scripts/lib/rehearsal → src/baseline}/sanitization_policy.mjs +133 -3
  36. package/{scripts/lib/rehearsal → src/baseline}/schema_snapshot.mjs +1 -1
  37. package/src/cli/arguments.mjs +123 -0
  38. package/src/cli/guided.mjs +812 -0
  39. package/src/cli/init_command.mjs +77 -0
  40. package/src/cli/rehearsal.mjs +952 -0
  41. package/src/cli/renderers.mjs +589 -0
  42. package/src/cli/runtime_commands.mjs +624 -0
  43. package/src/cli/source_commands.mjs +326 -0
  44. package/src/cli/terminal.mjs +275 -0
  45. package/src/identity/claim.mjs +1163 -0
  46. package/src/identity/storage.mjs +165 -0
  47. package/{scripts/lib/rehearsal → src/project}/configuration.d.mts +72 -4
  48. package/src/project/configuration.mjs +1201 -0
  49. package/src/project/install_scaffold.mjs +291 -0
  50. package/src/project/setup.mjs +484 -0
  51. package/src/project/support_report.mjs +105 -0
  52. package/src/runtime/cleanup.mjs +381 -0
  53. package/{scripts/lib/rehearsal → src/runtime}/plan.mjs +118 -20
  54. package/src/runtime/policy.mjs +438 -0
  55. package/{scripts/lib/rehearsal/runtime_restore.mjs → src/runtime/restore.mjs} +46 -27
  56. package/src/runtime/topology.mjs +177 -0
  57. package/{scripts/lib/rehearsal → src/shared}/diagnostics.mjs +10 -3
  58. package/src/shared/human_output.mjs +4 -0
  59. package/src/shared/operation_guard.mjs +162 -0
  60. package/{scripts/lib/rehearsal → src/shared}/process_environment.mjs +5 -1
  61. package/src/source/access.mjs +578 -0
  62. package/src/source/asset_transfer.mjs +177 -0
  63. package/src/source/baseline.mjs +446 -0
  64. package/src/source/postgresql_access.mjs +480 -0
  65. package/src/targets/postgresql.mjs +808 -0
  66. package/{scripts/operations/database/manage_rehearsal_database.mjs → src/targets/supabase.mjs} +66 -20
  67. package/{scripts/lib/environment/local_supabase.mjs → src/targets/supabase_environment.mjs} +60 -28
  68. package/src/targets/target.mjs +66 -0
  69. package/scripts/lib/rehearsal/configuration.mjs +0 -559
  70. package/scripts/operations/rehearsal/rehearsal_cli.mjs +0 -565
  71. /package/{scripts/lib/rehearsal → src/runtime}/migration_history.mjs +0 -0
  72. /package/{scripts/lib/rehearsal → src/runtime}/service_environment.mjs +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,266 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [0.1.0-beta.11] - 2026-10-03
9
+
10
+ ### Added
11
+
12
+ - Privacy policy version 2 now supports hashed approved-owner bindings, conditional
13
+ approved/other-owner transformations, bounded JSON arrays, nested recipes, and
14
+ explicitly optional object fields without consumer sanitizer callbacks.
15
+ - Local npm installs now create a validated, commented project-root
16
+ `rehearsal.config.mjs`, dedicated local runtime configuration, and additive safe ignore
17
+ entries when exactly one consumer application can be proven. Guided setup remains the
18
+ tested recovery path when lifecycle scripts are disabled or a workspace is ambiguous.
19
+ - Copied-account association accepts explicit verified-email provider allowlists and
20
+ hashed provider-subject matchers for supported Supabase identities. Google, GitHub,
21
+ and email sign-in now share one review-and-confirm claim workflow.
22
+
23
+ ### Changed
24
+
25
+ - Setup is idempotent, supported custom config paths are preserved, `.gitignore` updates
26
+ use an exclusive lock and atomic replacement, and `rehearsal init` shows the current
27
+ release template without replacing an existing config.
28
+
29
+ ### Fixed
30
+
31
+ - Identity plan JSON no longer serializes the raw approved email or provider subject;
32
+ only the environment-variable name and reviewed SHA-256 receipt leave the process.
33
+
34
+ ## [0.1.0-beta.10] - 2026-10-03
35
+
36
+ ### Added
37
+
38
+ - `rehearsal open` starts and verifies the configured runtime stack, launches the normal
39
+ application with declared local environment mappings, and keeps it available for
40
+ hands-on testing until interrupted.
41
+ - The guide now offers **Open the sandbox app** after a runtime exists.
42
+
43
+ ### Changed
44
+
45
+ - Persistent application sessions stop only their owned application process group on
46
+ `Ctrl+C`, `Ctrl+Z`, terminal close, or termination. The database and Storage runtime
47
+ stay running with local changes preserved across later sessions.
48
+
49
+ ### Fixed
50
+
51
+ - `rehearsal open` keeps interruption handling active throughout application teardown,
52
+ so an npm-forwarded `Ctrl+C` cannot terminate the CLI early or orphan the app.
53
+
54
+ ## [0.1.0-beta.9] - 2026-10-02
55
+
56
+ ### Added
57
+
58
+ - Primary configurations may declare isolated dependent database targets. Rehearsal
59
+ validates unique ownership boundaries, combines migration approval, orders lifecycle
60
+ actions, runs project-owned preparation and proofs, and previews cleanup across the
61
+ complete stack.
62
+ - A packed-package two-target PostgreSQL fixture proves source-to-read-model preparation,
63
+ positive and negative assertions, reverse shutdown, and exact cleanup without a
64
+ project-owned container engine.
65
+ - A separately opted-in, exact-digest PostgreSQL source-access lifecycle with scoped
66
+ temporary roles/views, deny checks, owner-only credentials, and exact retirement.
67
+ - Bounded coherent baseline refresh with executable privacy policy version 2, stable
68
+ keyed pseudonyms, atomic activation, capacity limits, and drift/interruption safety.
69
+ - Approved Supabase Storage inventory/transfer with bucket-prefix, size, path, version,
70
+ and exact-byte controls.
71
+ - Declarative runtime prerequisites and structural checks, plus exact local identity
72
+ association without application callback patches.
73
+ - Package-owned application startup, local environment mapping, readiness, child-process
74
+ teardown, and meaningful positive/negative HTTP proof orchestration.
75
+ - An exact-preview `refresh` command that builds a verified replacement first, resets the
76
+ complete local runtime stack, rolls back on runtime failure, and only then prunes the
77
+ specifically reviewed old baseline generations.
78
+
79
+ ### Changed
80
+
81
+ - Shipped source, runtime adapters, repository-only verification, and tests now use a
82
+ domain-based layout with documented placement rules and contract checks.
83
+ - Generated configs include a commented dependent-target example, and the documentation
84
+ explains that avoiding server errors is not a sufficient positive-path proof.
85
+ - Generated configs explain the optional standalone policy paths, direct local runtime
86
+ environment mappings, and application readiness contract.
87
+ - Source, privacy, runtime, identity, onboarding, and security documentation now describe
88
+ the package-owned declarative workflow and its separate authorization boundaries.
89
+
90
+ ### Fixed
91
+
92
+ - Supabase restores now install declared schemas and extensions before restoring
93
+ extension-dependent objects, preserve the original `public` schema privilege baseline,
94
+ and add declared triggers only after their functions exist.
95
+ - Supabase runtime environments now include a validated loopback-only database URL and
96
+ standard PostgreSQL variables for package-owned commands.
97
+ - Identity claims can safely replace complete signup defaults, require application role
98
+ references, remap declared text/JSONB and Storage object paths, and verify token-hook
99
+ claims while refusing edited or independent local account data.
100
+ - Baselines and restore checks now identify relations by schema and table, default old
101
+ records to `public`, and restore same-named tables in separate schemas independently.
102
+ - Identity claims can preserve immutable audit authorship while transferring the active
103
+ account, and retain only the synthetic Auth actor required by that history.
104
+ - Storage path transfer now copies through the local Supabase API, verifies exact bytes,
105
+ rolls back staged copies on database failure, and removes the old physical objects
106
+ only after the database commit succeeds.
107
+ - Identity Storage scopes now accept restored objects whose owner is unset, refuse
108
+ conflicting owners, and verify the destination owner before rewriting application
109
+ paths.
110
+ - Runtime-policy seeds may explicitly follow a named identity association, so later
111
+ verification checks the transferred key without recreating an obsolete placeholder
112
+ role.
113
+ - Failed project proofs always report their exit status and bounded output byte counts
114
+ without echoing arbitrary project logs.
115
+ - State-changing commands now use a project-wide operation lock and detect replacement
116
+ of the installed Rehearsal package while an operation is running.
117
+ - Identity claims now refuse to rewrite copied Storage paths when referenced physical
118
+ objects are missing.
119
+
120
+ ## [0.1.0-beta.8] - 2026-10-02
121
+
122
+ ### Fixed
123
+
124
+ - Lifecycle commands now preserve an explicit `--config=<path>` through runtime
125
+ selection and execution. A command cannot silently operate on the default config's
126
+ baseline, runtime identity, ports, or cleanup target instead.
127
+
128
+ ## [0.1.0-beta.7] - 2026-10-02
129
+
130
+ ### Added
131
+
132
+ - A concise roadmap prioritizes real-project acceptance, easier baseline onboarding,
133
+ and another ordinary PostgreSQL project before further database expansion.
134
+ - A preview-first cleanup command for old baseline generations, the current project's
135
+ disposable runtime, and explicitly selected older unused Supabase images. Applying a
136
+ cleanup requires the exact digest from its preview.
137
+ - First-run setup now generates a fully populated, commented configuration that explains
138
+ safe defaults, project-specific checks, and optional local-only settings in place.
139
+
140
+ ### Changed
141
+
142
+ - Rehearsal now respects user-owned Colima CPU, memory, and disk settings. Projects may
143
+ configure Colima auto-start and baseline retention in `rehearsal.config.mjs`.
144
+
145
+ ### Fixed
146
+
147
+ - Beta publishing now updates both npm's `beta` and `latest` tags after registry
148
+ verification, keeping the package page and default install on the newest reviewed
149
+ beta. A protected manual repair path fixes existing tag drift without storing an npm
150
+ token or choosing an arbitrary version.
151
+
152
+ ## [0.1.0-beta.6] - 2026-10-02
153
+
154
+ ### Changed
155
+
156
+ - Beginner documentation now follows one guided path, defines unfamiliar terms where
157
+ they first appear, provides a disposable PostgreSQL tutorial, and keeps advanced detail
158
+ in focused reference pages.
159
+ - Pressing `Ctrl+Z` at an interactive guide prompt now exits Rehearsal cleanly instead
160
+ of suspending the process and leaving it attached to the terminal.
161
+ - Database lifecycle selection now goes through a closed runtime-driver boundary while
162
+ preserving Supabase as the backward-compatible default. This created the safe,
163
+ testable seam used by the PostgreSQL target without changing existing configurations.
164
+ - The installed-package proof now chooses an available local port block and a unique
165
+ project identity, so local verification does not collide with another Rehearsal run.
166
+
167
+ ### Added
168
+
169
+ - An ordinary PostgreSQL runtime target with guided setup, loopback-only Docker
170
+ isolation, exact migration receipts, baseline restore, application proof, lifecycle
171
+ commands, and a separate installed-package integration proof.
172
+ - PostgreSQL setup refuses implicit image downloads and Supabase-only Storage baselines,
173
+ uses a fresh random local password per runtime, and requires exact Rehearsal ownership
174
+ labels before removing resources.
175
+
176
+ ### Fixed
177
+
178
+ - Plain-terminal nested menus now print their choices before asking for a number,
179
+ including database selection, discovered baseline inputs, and runtime management.
180
+
181
+ ## [0.1.0-beta.5] - 2026-10-01
182
+
183
+ ### Added
184
+
185
+ - Scalable policy review with explicit table-level safe defaults, suggested structural
186
+ exceptions, per-table summaries, and real-PTY coverage of the bulk-review journey.
187
+ - Bounded project-local discovery for baseline records, migration ledgers, and optional
188
+ Storage manifests, plus a value-free structural preflight before activation.
189
+ - A guided `Get help` action and scriptable `rehearsal support` report with tool
190
+ versions, readiness statuses, privacy guarantees, and a direct bug-report link.
191
+
192
+ ### Changed
193
+
194
+ - Guided policy review can classify ordinary columns in bulk as synthetic replacements
195
+ while keeping likely identifiers, relationships, and timestamps selected for
196
+ individual review. The saved policy still records every required column decision.
197
+ - The baseline guide offers detected inputs instead of requiring memorized paths,
198
+ validates referenced Storage files up front, previews counts without row values, and
199
+ returns to the guide with an actionable message when validation fails.
200
+ - Beta support no longer requires users to assemble environment details by hand; the
201
+ generated report omits project paths, row values, credentials, migration SQL, and
202
+ baseline identifiers and remains available before setup is complete.
203
+
204
+ ## [0.1.0-beta.4] - 2026-10-01
205
+
206
+ ### Added
207
+
208
+ - A persistent guided session with polished terminal prompts, interactive policy review,
209
+ concise runtime receipts, expandable technical details, and real-PTY regression tests.
210
+
211
+ ### Changed
212
+
213
+ - Guided menus now place the next recommended action first and automatically re-inspect
214
+ project state after every completed step while preserving plain and non-TTY modes.
215
+
216
+ ## [0.1.0-beta.3] - 2026-10-01
217
+
218
+ ### Added
219
+
220
+ - A state-aware interactive home screen that guides setup, baseline preparation,
221
+ migration review, runtime management, verification, and cleanup without requiring
222
+ users to memorize commands.
223
+ - A safe `setup` workflow that previews and creates a dedicated local Supabase config,
224
+ chooses an available port block, updates protective ignore rules, and summarizes
225
+ readiness without overwriting project files.
226
+ - A schema-only `baseline prepare` workflow that generates a fail-closed policy draft
227
+ with explicit `REVIEW REQUIRED` decisions and never prints source row values.
228
+ - Interactive confirmation of the exact candidate migration set plus friendly progress
229
+ and timing while a rehearsal runs.
230
+
231
+ ### Changed
232
+
233
+ - Human output now recommends the next useful action, uses compact first-run readiness
234
+ summaries, respects `NO_COLOR` and `--plain`, and renders singular counts correctly.
235
+ - Bare `rehearsal` opens the guide only in a terminal and remains noninteractive and
236
+ script-safe when standard input or output is redirected.
237
+
238
+ ### Fixed
239
+
240
+ - Setup detects unsupported Node.js versions before writing, ignores ports occupied by
241
+ Docker or SSH forwarding, and rechecks its selected ports immediately before commit.
242
+ - Generated project identifiers are bounded to values accepted by the local runtime.
243
+
244
+ ### Security
245
+
246
+ - Reviewed sanitization policy bytes are checksum-bound to the active baseline and are
247
+ revalidated during planning and runtime restore.
248
+ - Draft or incomplete sanitization policies cannot be activated as baselines.
249
+
250
+ ## [0.1.0-beta.2] - 2026-09-15
251
+
252
+ ### Fixed
253
+
254
+ - Generate `rehearsal.config.mjs` so first-time initialization works in both CommonJS
255
+ and ESM projects instead of failing when a fresh npm project declares CommonJS.
256
+ - Report the exact table and represented-migration counts after creating a synthetic
257
+ baseline instead of rendering missing result fields as `undefined`.
258
+ - Keep the copyable getting-started migration bytes identical to its migration-ledger
259
+ example so the documented runtime replay passes exact-history verification.
260
+ - Install the current prerelease through npm's `beta` tag so new projects do not resolve
261
+ the superseded bootstrap release from npm's historical `latest` tag.
262
+
263
+ ### Security
264
+
265
+ - Removed the completed first-package bootstrap credential path. All future publication
266
+ uses the package's trusted GitHub Actions OIDC publisher and cannot read an npm token.
267
+
8
268
  ## [0.1.0-beta.1] - 2026-09-14
9
269
 
10
270
  ### Changed
@@ -54,6 +314,16 @@ a Changelog, and versions will follow Semantic Versioning after the package exis
54
314
  publication uses short-lived trusted OIDC, and every release tag must already exist on
55
315
  protected `main`.
56
316
 
57
- [Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.1...HEAD
317
+ [Unreleased]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.11...HEAD
318
+ [0.1.0-beta.11]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.10...v0.1.0-beta.11
319
+ [0.1.0-beta.10]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.9...v0.1.0-beta.10
320
+ [0.1.0-beta.9]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.8...v0.1.0-beta.9
321
+ [0.1.0-beta.8]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.7...v0.1.0-beta.8
322
+ [0.1.0-beta.7]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.6...v0.1.0-beta.7
323
+ [0.1.0-beta.6]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.5...v0.1.0-beta.6
324
+ [0.1.0-beta.5]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.4...v0.1.0-beta.5
325
+ [0.1.0-beta.4]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.3...v0.1.0-beta.4
326
+ [0.1.0-beta.3]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.2...v0.1.0-beta.3
327
+ [0.1.0-beta.2]: https://github.com/Ddupasquier/rehearsal-db/compare/v0.1.0-beta.1...v0.1.0-beta.2
58
328
  [0.1.0-beta.1]: https://github.com/Ddupasquier/rehearsal-db/releases/tag/v0.1.0-beta.1
59
329
  [0.1.0-beta.0]: https://github.com/Ddupasquier/rehearsal-db/releases/tag/v0.1.0-beta.0
package/COMPATIBILITY.md CHANGED
@@ -20,3 +20,29 @@ 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 npm install hook may create project scaffolding only when it proves one application
25
+ root. Ordinary npm application installs are covered. A workspace is automatic only when
26
+ one declaring consumer is already visible in its manifest or lockfile; npm can save a
27
+ new `--workspace` declaration after dependency hooks run, so a first workspace install
28
+ may use the guided fallback. pnpm and Yarn install layouts are not yet an
29
+ automatic-generation contract. Run `npx rehearsal` from the application directory for
30
+ all skipped cases. Global, cache, temporary `npx`, and ambiguous multi-application
31
+ workspace installs do not receive files.
32
+
33
+ The PostgreSQL target covers timestamped SQL migrations running in a dedicated local
34
+ `postgres` Docker image. Runtime commands reject hosted connection strings and existing
35
+ unmanaged servers. The separately opted-in PostgreSQL preparation boundary may use a
36
+ reviewed, short-lived source reader; this does not make a hosted database a runtime
37
+ target. ORM-specific nested migration formats remain unsupported. Supabase Storage and
38
+ Auth behavior apply only to the Supabase runtime.
39
+
40
+ A primary config may declare flat dependent PostgreSQL or Supabase targets. Each target
41
+ must have its own complete config, immutable baseline, project ID, ports, environment
42
+ file, and artifact directory. Nested dependency graphs and shared runtime ownership are
43
+ not supported.
44
+
45
+ Executable privacy policy version 2, source-access policy version 1, runtime policy
46
+ version 1, and identity policy version 1 are strict declarative contracts. Unknown
47
+ fields fail closed. They do not imply support for arbitrary transformations, SQL,
48
+ provider administration, consent decisions, or every PostgreSQL extension.