Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

TML-2763: Add telemetry contract hash advance migration - #666

Merged
aqrln merged 1 commit into
mainfrom
tml-2763-fix-migrations-in-pn-telemetry-backend
Jun 1, 2026
Merged

aqrln merged 1 commit into
mainfrom
tml-2763-fix-migrations-in-pn-telemetry-backend

Conversation

@tensordreams

@tensordreams tensordreams commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue

Refs TML-2763

At a glance

{
  "from": "sha256:41700ef5fda97339b39ea345a56aae72a1ff4be11ddc3ffcab7130bfc71c109d",
  "to": "sha256:50aadcf996213451cd2876e3caf50c2752b5b8c9ce1aa55dcae24918518b4ffb",
  "providedInvariants": []
}

ops.json for this migration is [], so this advances the telemetry backend contract marker without running SQL.

Summary

The telemetry-backend deploy failed because production was at the previous contract storage hash and the current emitted contract had no migration graph edge from that marker. This PR adds the missing zero-operation migration edge so prisma-next migrate can reach the current contract during deploy.

Decision

This PR ships a no-op app-space migration package for apps/telemetry-backend that links the production marker hash 41700e… to the current contract hash 50aadcf…. The migration includes start/end contract snapshots, an attested migration.json, and an empty ops.json.

How it fits together

  1. The initial telemetry migration ends at sha256:41700ef5fda97339b39ea345a56aae72a1ff4be11ddc3ffcab7130bfc71c109d.
  2. The current emitted telemetry contract now has storage hash sha256:50aadcf996213451cd2876e3caf50c2752b5b8c9ce1aa55dcae24918518b4ffb.
  3. prisma-next migrate only replays planned graph edges; it does not invent an edge between those hashes at deploy time.
  4. apps/telemetry-backend/migrations/app/20260601T1347_contract_hash_advance/ records the missing edge with no operations, allowing the deploy workflow to advance the stored marker.

Behavior changes & evidence

  • Telemetry deploy migrations can reach the current contract. The migration graph now includes the missing app-space edge from 41700e… to 50aadcf…, avoiding the MIGRATION.PATH_UNREACHABLE failure seen in deploy.

Notes for the reviewer

  • This is intentionally metadata-only: ops.json is empty, so no tables or indexes are changed.
  • The large diff is generated contract snapshot material (start-contract.* / end-contract.*) required for the migration package shape.
  • I could not run the production migration from this workspace because no .env file was present under /home/aqrln.guest and DATABASE_URL is not set in the shell. Running pnpm --dir apps/telemetry-backend run migrate fails before connecting with DATABASE_URL must be set.

Testing performed

  • DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres pnpm --filter @prisma-next/telemetry-backend exec prisma-next migration check --json
  • DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres pnpm --filter @prisma-next/telemetry-backend exec prisma-next migration list --json
  • Attempted real package command: pnpm --dir apps/telemetry-backend run migrate — failed before connecting because DATABASE_URL is not set and no .env file exists in this workspace.

Skill update

n/a — migration artifact only; no user-facing CLI/API/skill surface changed.

Alternatives considered

  • Re-emitting or editing the current contract only: rejected because production already has the old marker; the deploy needs an explicit graph edge from that marker to the current hash.
  • Adding SQL operations: rejected because the physical telemetry schema did not need a schema change for this transition.
  • Bypassing migration application in the deploy workflow: rejected because it would leave production marker state inconsistent with the deployed contract.

Checklist

  • All commits are signed off (git commit -s) per the DCO. The DCO status check will block merge if any commit is missing a Signed-off-by: trailer.
  • I read CONTRIBUTING.md and the change is scoped to one logical concern.
  • Tests are updated (or n/a if the change is doc-only / refactor with no behavioural delta).
  • The PR title is in TML-NNNN: <sentence-case title> form (Linear ticket prefix + concise title naming the concrete deliverable). See .claude/skills/create-pr/SKILL.md for the full convention.
  • The Skill update section above is filled in (or stated n/a — internal only).

@tensordreams
tensordreams requested a review from a team as a code owner June 1, 2026 13:23
@coderabbitai

coderabbitai Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d2d9c977-6d0e-45d5-8425-d12466195830

📥 Commits

Reviewing files that changed from the base of the PR and between c283668 and 7586799.

📒 Files selected for processing (7)
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/end-contract.d.ts
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/end-contract.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/migration.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/migration.ts
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/ops.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/start-contract.d.ts
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/start-contract.json
✅ Files skipped from review due to trivial changes (4)
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/end-contract.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/start-contract.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/end-contract.d.ts
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/start-contract.d.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/migration.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/ops.json
  • apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/migration.ts

📝 Walkthrough

Walkthrough

This PR introduces a new migration for telemetry-backend that records a contract hash advance. The migration declares a from/to hash transition, provides before/after contract snapshots as TypeScript and JSON artifacts, and specifies no actual data operations.

Changes

Contract Hash Advance Migration

Layer / File(s) Summary
Migration class and metadata
apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/migration.ts, migration.json, ops.json
The M class extends Migration and declares a contract hash transition via describe() with empty operations; migration metadata records the from/to SHA256 hashes, creation timestamp, and migration hash in migration.json, while ops.json contains an empty array.
Start contract snapshot (before state)
apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/start-contract.d.ts, start-contract.json
Before-state contract definitions: TypeScript exports StorageHash, ExecutionHash, ProfileHash, codec/query type aliases, FieldOutputTypes/FieldInputTypes for TelemetryEvent, and a Contract type modeling the telemetry_event table schema; JSON defines the model fields (scalar and jsonb), Postgres table/column layout, defaults, indexes, primary key, and query capabilities.
End contract snapshot (after state)
apps/telemetry-backend/migrations/app/20260601T1236_contract_hash_advance/end-contract.d.ts, end-contract.json
After-state contract definitions: TypeScript exports the same hash/codec/field types and updated Contract structure for the telemetry_event table; JSON mirrors the start contract with the new storageHash value and identical field/table definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • prisma/prisma-next#502: Removes inlined fromContract/toContract from migration.json, matching the pared-down hash-only metadata in this PR's migration snapshot.
  • prisma/prisma-next#600: Updates emitted contract typing shape for cross-namespace model references, related to the generated contract artifacts here.
  • prisma/prisma-next#534: Regenerates contract artifacts reflecting per-namespace storage IR and updated namespace/table layout used in these snapshots.

Suggested reviewers

  • wmadden

Poem

🐇 A hash advance hops by, marking time
Before and after snapshots, stored in rhyme
No data shifts, just checksums align
Contracts whisper their new design
The rabbit nods — migration's fine

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a telemetry contract hash advance migration to resolve a deployment issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2763-fix-migrations-in-pn-telemetry-backend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tensordreams
tensordreams force-pushed the tml-2763-fix-migrations-in-pn-telemetry-backend branch from c283668 to f63651e Compare June 1, 2026 13:25
Fixes: TML-2763

Signed-off-by: Alexey Orlenko's AI Agent <[email protected]>
@tensordreams
tensordreams force-pushed the tml-2763-fix-migrations-in-pn-telemetry-backend branch from f63651e to 7586799 Compare June 1, 2026 13:26
@aqrln
aqrln enabled auto-merge (rebase) June 1, 2026 13:26
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 135.93 KB (0%)
postgres / emit 125.59 KB (0%)
mongo / no-emit 75.69 KB (0%)
mongo / emit 70.68 KB (0%)

@pkg-pr-new

pkg-pr-new Bot commented Jun 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/@prisma-next/extension-author-tools@666

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/@prisma-next/mongo-runtime@666

@prisma-next/family-mongo

npm i https://pkg.pr.new/@prisma-next/family-mongo@666

@prisma-next/sql-runtime

npm i https://pkg.pr.new/@prisma-next/sql-runtime@666

@prisma-next/family-sql

npm i https://pkg.pr.new/@prisma-next/family-sql@666

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/@prisma-next/extension-arktype-json@666

@prisma-next/middleware-cache

npm i https://pkg.pr.new/@prisma-next/middleware-cache@666

@prisma-next/mongo

npm i https://pkg.pr.new/@prisma-next/mongo@666

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/@prisma-next/extension-paradedb@666

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/@prisma-next/extension-pgvector@666

@prisma-next/extension-postgis

npm i https://pkg.pr.new/@prisma-next/extension-postgis@666

@prisma-next/postgres

npm i https://pkg.pr.new/@prisma-next/postgres@666

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/@prisma-next/sql-orm-client@666

@prisma-next/sqlite

npm i https://pkg.pr.new/@prisma-next/sqlite@666

@prisma-next/target-mongo

npm i https://pkg.pr.new/@prisma-next/target-mongo@666

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/@prisma-next/adapter-mongo@666

@prisma-next/driver-mongo

npm i https://pkg.pr.new/@prisma-next/driver-mongo@666

@prisma-next/contract

npm i https://pkg.pr.new/@prisma-next/contract@666

@prisma-next/utils

npm i https://pkg.pr.new/@prisma-next/utils@666

@prisma-next/config

npm i https://pkg.pr.new/@prisma-next/config@666

@prisma-next/errors

npm i https://pkg.pr.new/@prisma-next/errors@666

@prisma-next/framework-components

npm i https://pkg.pr.new/@prisma-next/framework-components@666

@prisma-next/operations

npm i https://pkg.pr.new/@prisma-next/operations@666

@prisma-next/ts-render

npm i https://pkg.pr.new/@prisma-next/ts-render@666

@prisma-next/contract-authoring

npm i https://pkg.pr.new/@prisma-next/contract-authoring@666

@prisma-next/ids

npm i https://pkg.pr.new/@prisma-next/ids@666

@prisma-next/psl-parser

npm i https://pkg.pr.new/@prisma-next/psl-parser@666

@prisma-next/psl-printer

npm i https://pkg.pr.new/@prisma-next/psl-printer@666

@prisma-next/cli

npm i https://pkg.pr.new/@prisma-next/cli@666

@prisma-next/cli-telemetry

npm i https://pkg.pr.new/@prisma-next/cli-telemetry@666

@prisma-next/emitter

npm i https://pkg.pr.new/@prisma-next/emitter@666

@prisma-next/migration-tools

npm i https://pkg.pr.new/@prisma-next/migration-tools@666

prisma-next

npm i https://pkg.pr.new/prisma-next@666

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/@prisma-next/vite-plugin-contract-emit@666

@prisma-next/mongo-codec

npm i https://pkg.pr.new/@prisma-next/mongo-codec@666

@prisma-next/mongo-contract

npm i https://pkg.pr.new/@prisma-next/mongo-contract@666

@prisma-next/mongo-value

npm i https://pkg.pr.new/@prisma-next/mongo-value@666

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/@prisma-next/mongo-contract-psl@666

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/@prisma-next/mongo-contract-ts@666

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/@prisma-next/mongo-emitter@666

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/@prisma-next/mongo-schema-ir@666

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/@prisma-next/mongo-query-ast@666

@prisma-next/mongo-orm

npm i https://pkg.pr.new/@prisma-next/mongo-orm@666

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/@prisma-next/mongo-query-builder@666

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/@prisma-next/mongo-lowering@666

@prisma-next/mongo-wire

npm i https://pkg.pr.new/@prisma-next/mongo-wire@666

@prisma-next/sql-contract

npm i https://pkg.pr.new/@prisma-next/sql-contract@666

@prisma-next/sql-errors

npm i https://pkg.pr.new/@prisma-next/sql-errors@666

@prisma-next/sql-operations

npm i https://pkg.pr.new/@prisma-next/sql-operations@666

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/@prisma-next/sql-schema-ir@666

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/@prisma-next/sql-contract-psl@666

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/@prisma-next/sql-contract-ts@666

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/@prisma-next/sql-contract-emitter@666

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/@prisma-next/sql-lane-query-builder@666

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/@prisma-next/sql-relational-core@666

@prisma-next/sql-builder

npm i https://pkg.pr.new/@prisma-next/sql-builder@666

@prisma-next/target-postgres

npm i https://pkg.pr.new/@prisma-next/target-postgres@666

@prisma-next/target-sqlite

npm i https://pkg.pr.new/@prisma-next/target-sqlite@666

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/@prisma-next/adapter-postgres@666

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/@prisma-next/adapter-sqlite@666

@prisma-next/driver-postgres

npm i https://pkg.pr.new/@prisma-next/driver-postgres@666

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/@prisma-next/driver-sqlite@666

commit: 7586799

@aqrln
aqrln merged commit 881031b into main Jun 1, 2026
20 checks passed
@aqrln
aqrln deleted the tml-2763-fix-migrations-in-pn-telemetry-backend branch June 1, 2026 13:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants