Skip to content

Commit a0072e3

Browse files
chore(integration): the sign-the-database journey names its steps by behavior
The journey header, describe title, and step comments describe what each step does — sign a foreign database as-is, then transition one index and one policy to managed naming via exactly two renames — instead of pointing at planning checklist coordinates. Behavior and assertions unchanged. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
1 parent f64b82d commit a0072e3

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

test/integration/test/cli-journeys/sign-the-database.e2e.test.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/**
2-
* Project DoD-2 and DoD-3 — the emitted contract is the database's
3-
* signature.
2+
* The emitted contract is the database's signature.
43
*
5-
* DoD-2: a database created "by another tool" carries an expression index, a
4+
* First half: a database created "by another tool" carries an expression index, a
65
* partial index, a unique expression index, and two RLS policies (one
76
* PERMISSIVE, one RESTRICTIVE) on an RLS-enabled table. `contract infer` →
87
* emit → `db verify` reports ZERO issues → `db update --dry-run` plans ZERO
98
* operations.
109
*
11-
* DoD-3: from that signed contract, one index and one policy transition
10+
* Second half: from that signed contract, one index and one policy transition
1211
* from `map:` to the managed spelling (bodies verbatim) → the widening plan
1312
* contains EXACTLY two ops, both renames (byte-asserted) → apply → verify
1413
* clean under the wire names.
@@ -85,7 +84,7 @@ function readPlannedOps(ctx: JourneyContext): readonly PlannedOp[] {
8584
}
8685

8786
withTempDir(({ createTempDir }) => {
88-
describe('DoD-2/3: sign a database this toolchain has never seen, then transition to managed', () => {
87+
describe('sign a database this toolchain has never seen, then transition to managed', () => {
8988
const db = useDevDatabase({
9089
onReady: (cs) => withClient(cs, (client) => client.query(FOREIGN_TOOL_SCHEMA)),
9190
});
@@ -99,7 +98,7 @@ withTempDir(({ createTempDir }) => {
9998
contractMode: 'psl',
10099
});
101100

102-
// DoD-2.1: infer captures the full surface.
101+
// Infer captures the full surface.
103102
const infer = await runContractInfer(ctx);
104103
expect(infer.exitCode, `2.1: contract infer\n${stripAnsi(infer.stderr)}`).toBe(0);
105104
const inferredPsl = readFileSync(join(ctx.testDir, 'contract.prisma'), 'utf-8');
@@ -118,7 +117,7 @@ withTempDir(({ createTempDir }) => {
118117
expect(inferredPsl).toContain('permissive = false');
119118
expect(inferredPsl).toContain('@@rls');
120119

121-
// DoD-2.2: emit → verify ZERO issues.
120+
// Emit → verify ZERO issues.
122121
const emit = await runContractEmit(ctx);
123122
expect(emit.exitCode, `2.2: contract emit\n${stripAnsi(emit.stderr)}`).toBe(0);
124123
const schemaVerify = await runDbVerify(ctx, ['--schema-only', '--json']);
@@ -128,7 +127,7 @@ withTempDir(({ createTempDir }) => {
128127
schema: { issues: [] },
129128
});
130129

131-
// DoD-2.3: sign; a dry-run update plans ZERO operations.
130+
// Sign; a dry-run update plans ZERO operations.
132131
const sign = await runDbSign(ctx);
133132
expect(sign.exitCode, `2.3: db sign\n${stripAnsi(sign.stderr)}`).toBe(0);
134133
const verify = await runDbVerify(ctx);
@@ -140,7 +139,7 @@ withTempDir(({ createTempDir }) => {
140139
plan: { operations: [] },
141140
});
142141

143-
// DoD-3.1: baseline migration so migration plan diffs from the
142+
// Baseline migration so migration plan diffs from the
144143
// adopted contract; a fresh migrate is a no-op against the live DB.
145144
const planBaseline = await runMigrationPlanAndEmit(ctx, ['--name', 'baseline']);
146145
expect(planBaseline.exitCode, `3.1: plan baseline\n${stripAnsi(planBaseline.stderr)}`).toBe(
@@ -155,7 +154,7 @@ withTempDir(({ createTempDir }) => {
155154
migrationsApplied: 0,
156155
});
157156

158-
// DoD-3.2: transition ONE index and ONE policy to managed spellings,
157+
// Transition ONE index and ONE policy to managed spellings,
159158
// bodies verbatim.
160159
const transitioned = inferredPsl
161160
.replace(
@@ -168,7 +167,7 @@ withTempDir(({ createTempDir }) => {
168167
const emitManaged = await runContractEmit(ctx);
169168
expect(emitManaged.exitCode, `3.2: emit managed\n${stripAnsi(emitManaged.stderr)}`).toBe(0);
170169

171-
// DoD-3.3: the widening plan is EXACTLY the two renames.
170+
// The widening plan is EXACTLY the two renames.
172171
const plan = await runMigrationPlanAndEmit(ctx, ['--name', 'adopt-managed-names']);
173172
expect(plan.exitCode, `3.3: migration plan\n${stripAnsi(plan.stderr)}`).toBe(0);
174173
const ops = readPlannedOps(ctx);
@@ -194,7 +193,7 @@ withTempDir(({ createTempDir }) => {
194193
},
195194
]);
196195

197-
// DoD-3.4: apply; verify clean under the wire names.
196+
// Apply; verify clean under the wire names.
198197
const apply = await runMigrate(ctx);
199198
expect(apply.exitCode, `3.4: migration apply\n${stripAnsi(apply.stderr)}`).toBe(0);
200199
const verifyManaged = await runDbVerify(ctx);

0 commit comments

Comments
 (0)