Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a backend post-build validation step that loads the tsc-compiled TypeORM entities from dist/ and runs TypeORM’s driver-level metadata validation to catch unsupported column types (e.g. BigInt inference) before deployment.
Changes:
- Add
apps/backend/scripts/postbuild-checks.mjsto import compiled entities and runDataSource.buildMetadatas()with the Postgres driver. - Hook the script into the backend build via a new
postbuildnpm lifecycle script.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/backend/scripts/postbuild-checks.mjs | Implements post-build checks that load dist/database/entities/*.entity.js and validate TypeORM metadata against the Postgres driver. |
| apps/backend/package.json | Adds postbuild script to run the validation automatically after nest build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
postbuildscript that validates compiled TypeORM entity metadata against the Postgres driver, catching unsupported column types before deploymentpnpm build— locally, in CI (test.yml), and in Docker image builds (Dockerfile)Problem
PR #186 introduced a
bigintTS type onStorageProvider.providerIdwithout an explicittypein@Column(). TypeORM can't infer a Postgres column type for JSBigInt, so the app throwsDataTypeNotSupportedErrorat startup and crash-loops.Why unit tests didn't catch it
Vitest uses SWC to transpile, which does not emit
emitDecoratorMetadatathe same waytscdoes. TypeORM never sees theBigIntdesign type in tests — only in the productiontscbuild output.Approaches tried
biginttypes missing explicit@Column({ type }). Works but brittle and doesn't cover other validation TypeORM performs.dist/output (chosen) — imports tsc-compiled entities, uses TypeORM'sDataSource.buildMetadatas()to run the same driver-level validation as production startup, without needing a database connection.Test plan
pnpm -C apps/backend buildfails on PR Upgrade to synapse 0.39.0. Closes #170 #186 with:✗ entity-metadata: Data type "BigInt" in "StorageProvider.providerId" is not supported by "postgres" database.@Column({ type: "bigint" })), build passes with:✓ entity-metadatapnpm testunaffected (275 tests pass)Related