Skip to content

chore: gradual dependency upgrade (P0–P5)#59

Merged
KIvanow merged 15 commits intomasterfrom
chore/deps-gradual-upgrade
Mar 25, 2026
Merged

chore: gradual dependency upgrade (P0–P5)#59
KIvanow merged 15 commits intomasterfrom
chore/deps-gradual-upgrade

Conversation

@jamby77
Copy link
Collaborator

@jamby77 jamby77 commented Mar 24, 2026

Closes #57

Summary

Phased dependency upgrade across the monorepo, targeting all actionable outdated packages while deferring items blocked on upstream ecosystem support.

P0 — Low-risk bumps

  • Patch/minor version bumps across all packages (shared, agent, mcp, semantic-cache)

P1 — API

  • @fastify/static 8 → 9, class-validator 0.14 → 0.15, @types/supertest 6 → 7
  • typescript-eslint patch, ESLint migrated to flat config (eslint.config.mjs)

P2 — CLI

  • commander 12 → 14, esbuild 0.25 → 0.27

P3 — Entitlement (breaking upgrades)

  • Prisma 5 → 7: driver adapters (@prisma/adapter-pg), prisma.config.ts, removed url from schema, updated all import paths to generated client
  • Stripe 14 → 20: removed apiVersion from constructor, current_period_start/end moved to subscription.items.data[0]
  • Jest 29 → Vitest 4: migrated test runner, eliminated ts-jest/@types/jest, native ESM/TS support
  • Nest CLI 10 → 11, reflect-metadata 0.1 → 0.2, @types/node 20 → 22
  • ESM: added "type": "module", updated tsconfig.json (module: ESNext, moduleResolution: bundler)
  • Added integration tests for entitlement validation flow (6 tests against real Postgres)
  • Added scripts/run-integration-tests.sh (Docker checks, schema push, test runner)

P4 — Web

  • Vite 6 → 8 (Rolldown), @vitejs/plugin-react 4 → 6, lucide-react 0.x → 1.x
  • React 18 → 19 types (useRef explicit init, Recharts Tooltip formatter arity)

P5 — Tailwind + ESLint

  • Tailwind CSS 3 → 4: CSS-first config (@import "tailwindcss", @theme directives), @tailwindcss/vite plugin, removed postcss.config.js + tailwind.config.js
  • globals 15 → 17, eslint-plugin-react-hooks flat config fix

Deferred (blocked on upstream)

Package Blocker
@lancedb/lancedb 0.23 → 0.27 apache-arrow peer conflict (needs ≤18.1.0, have 21.x)
@inquirer/prompts 7 → 8 ESM-only; CLI bundles it as CJS external
typescript 5.9 → 6.0 typescript-eslint + ts-jest (api) lack TS 6 support
@types/node 22 → 25 Aligned with TS 6 wave

Verification

  • pnpm build — all packages/apps build clean (Turbo)
  • tsc --noEmit — no type errors in api, web, entitlement, cli
  • pnpm --filter @betterdb/semantic-cache test — passes
  • pnpm --filter @app/entitlement test — 18 tests pass (12 unit + 6 integration)
  • ESLint — clean for web and api
  • Integration tests verified against Docker Postgres (Prisma 7 CRUD, entitlement flow)

Made with Cursor

@jamby77 jamby77 requested a review from KIvanow March 24, 2026 10:32
@jamby77
Copy link
Collaborator Author

jamby77 commented Mar 24, 2026

image

Dev instance after the updates

jamby77 added 8 commits March 24, 2026 20:25
- Upgraded various dependencies in package.json files, including TypeScript, ESLint, Prettier, and several NestJS packages.
- Replaced the old ESLint configuration files with new ones using the modern ES module format.
- Removed outdated ESLint configuration files from apps/api and apps/web.
- Added new tsconfig.eslint.json files for better TypeScript integration with ESLint.
- Updated lock files to reflect the changes in dependencies.
- Enhanced linting commands for improved code quality checks.
- Added peer dependency rules for eslint-plugin-react-hooks in package.json.
- Updated @types/react and @types/react-dom versions to 19.2.14 and 19.2.3 respectively.
- Adjusted globals version to 15.15.0 across multiple package.json files.
- Introduced parser options in ESLint configuration for better TypeScript support.
- Refactored useRef initialization in useVersionCheck.ts for improved type safety.
- Enhanced KeyAnalytics component with better formatting and tooltip handling for charts.
- Updated devDependencies in multiple packages to ensure compatibility with the latest TypeScript and Node types.
- Upgraded lucide-react to version 1.0.1 in apps/web.
- Updated @vitejs/plugin-react to version 6.0.1 in apps/web.
- Bumped typescript-eslint to version 8.57.2 in apps/web, apps/api, and packages/cli.
- Updated class-validator to version 0.15.1 in proprietary/entitlement and apps/api.
- Upgraded @fastify/static to version 9.0.0 in apps/api.
- Updated @types/supertest to version 7.2.0 in apps/api.
- Upgraded commander to version 14.0.3 in packages/cli.
- Updated esbuild to version 0.27.4 in packages/cli.
- Added new peer dependency rule for @nestjs/mapped-types in the root package.json.
- Updated `globals` version to 17.4.0 in apps/api and apps/web.
- Added `@tailwindcss/vite` dependency in apps/web.
- Removed outdated PostCSS and Tailwind configuration files from apps/web.
- Integrated Tailwind CSS into the Vite configuration for apps/web.
- Updated ESLint configuration to use `vitest` instead of `jest` for testing in proprietary/entitlement.
- Refactored tests to utilize `vitest` and updated related imports.
- Added new integration tests for entitlement functionality.
- Updated Prisma client and related configurations for better compatibility.
The entitlement package migrated from Jest to Vitest, but the API's
Jest config includes `../../proprietary` in its roots, causing it to
pick up Vitest-based specs that can't run under Jest/CJS.

Made-with: Cursor
Runs Vitest for entitlement specs (excluding integration tests that
require a running Postgres) alongside the existing API Jest suite.

Made-with: Cursor
Adds vitest ^4.1.1 as devDependency and "test": "vitest run" script.
The 2 existing test files already import from vitest — this just makes
them runnable via pnpm test.

Made-with: Cursor
@jamby77 jamby77 force-pushed the chore/deps-gradual-upgrade branch from c4bd62b to a70ddc8 Compare March 24, 2026 18:25
@KIvanow
Copy link
Member

KIvanow commented Mar 25, 2026

Why are there new models for prisma?

@jamby77
Copy link
Collaborator Author

jamby77 commented Mar 25, 2026

Why are there new models for prisma?

Sorry, config was changed, will revert them back to node_modules based models

@KIvanow
Copy link
Member

KIvanow commented Mar 25, 2026

Why are there new models for prisma?

Sorry, config was changed, will revert them back to node_modules based models

I am not married to either approach. Just trying to figure out what caused the change and why, what are the pros/cons of either approach?

@jamby77
Copy link
Collaborator Author

jamby77 commented Mar 25, 2026

Well, this is more explicit, but to be honest, I can't really see good reason to add 18K rows just for visibility.
I reverted it and it works fine. This PR should be only about package updates and if a change is not required to make new package version to work, it should be part of different PR

jamby77 added 7 commits March 25, 2026 16:44
# Conflicts:
#	apps/api/package.json
#	pnpm-lock.yaml
#	proprietary/entitlement/package.json
Upgraded various dependencies across multiple packages, including TypeScript, ESLint, Prettier, NestJS, and others. Reflects updates in all relevant lockfile versions.
Deleted the unused `class.ts` file generated by Prisma to clean up the proprietary/entitlement module.
Integrated a setup script to initialize Docker containers and prepare Postgres for entitlement integration tests. Updated Vitest config to include `globalSetup`. Refactored alias resolution for path module imports.
…ess function

Updated the 'subdomain' parameter to '_subdomain' to indicate it is unused. No functional changes introduced.
@KIvanow
Copy link
Member

KIvanow commented Mar 25, 2026

Well, this is more explicit, but to be honest, I can't really see good reason to add 18K rows just for visibility. I reverted it and it works fine. This PR should be only about package updates and if a change is not required to make new package version to work, it should be part of different PR

I agree, that's why I asked if it is required or much better for one reason or another (it could've been that the newer versions of Prisma need it for some reason)


// Apply Prisma migrations/schema to the test database
console.log(' Applying Prisma schema to test database...');
execSync('npx prisma db push --force-reset --accept-data-loss', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the --force-reset? Since it is in the global setup, will it impact only integrations or unit tests as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this setup file is used in entitlement tests only and the integration tests only.
The idea is that the database is clean on each test run.
Do you know if any tests rely on persisting data across runs? If so, we can skip this part

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, and even if they were relying on them, it would be an anti pattern. My concern was if the cleaning up with this was happening more often than needed, slowing down the tests.

private readonly logger = new Logger(PrismaService.name);

constructor() {
const adapter = new PrismaPg({ connectionString: process.env.ENTITLEMENT_DATABASE_URL });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the ENTITLEMENT_DATABASE_URL specifically? What does the connectionString expect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pod already has `ENTITLEMENT_DATABASE_URL` configured via the K8s secret.

It seems this is what the connection url is in K8S.
Also prisma 7 requires this sort of setup:
https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/introduction#importing-prisma-client

@KIvanow KIvanow merged commit 3631eaa into master Mar 25, 2026
2 checks passed
@KIvanow KIvanow deleted the chore/deps-gradual-upgrade branch March 25, 2026 19:56
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
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.

Review and update outdated npm packages (check dependabot and security recommendations, resolve the ones that are going to be handled by that)

2 participants