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

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