Skip to content

refactor: Migrate Vitest global setup from single merged file to individual files per generator#713

Merged
kingston merged 2 commits into
mainfrom
kingston/eng-942-split-test-global-setup-scripts-into-separate-files
Dec 23, 2025
Merged

refactor: Migrate Vitest global setup from single merged file to individual files per generator#713
kingston merged 2 commits into
mainfrom
kingston/eng-942-split-test-global-setup-scripts-into-separate-files

Conversation

@kingston

@kingston kingston commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

Release Notes

  • Tests

    • Reorganized global test setup from a single script into modular scripts for environment, database, and cache initialization, improving test isolation and configuration clarity.
  • New Features

    • Project synchronization now tracks and exposes per-package synchronization results for better visibility into sync operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Dec 23, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
baseplate-project-builder-web Ready Ready Preview, Comment Dec 23, 2025 11:30am

@changeset-bot

changeset-bot Bot commented Dec 23, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9eeaa6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@baseplate-dev/core-generators Patch
@baseplate-dev/fastify-generators Patch
@baseplate-dev/project-builder-server Patch
@baseplate-dev/react-generators Patch
@baseplate-dev/plugin-auth Patch
@baseplate-dev/plugin-queue Patch
@baseplate-dev/plugin-storage Patch
@baseplate-dev/project-builder-cli Patch
@baseplate-dev/project-builder-common Patch
@baseplate-dev/project-builder-test Patch
@baseplate-dev/project-builder-web Patch
@baseplate-dev/create-project Patch
@baseplate-dev/code-morph Patch
@baseplate-dev/project-builder-lib Patch
@baseplate-dev/sync Patch
@baseplate-dev/tools Patch
@baseplate-dev/ui-components Patch
@baseplate-dev/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 23, 2025

Copy link
Copy Markdown

Walkthrough

Migrates Vitest global setup from a single merged file to per-generator global setup files. Replaces globalSetupOperations (Map) with globalSetupFiles (Array) in the Vitest config provider. Each generator (Redis, Prisma) now produces its own global setup file. Vitest config exposes globalSetup as an array with the environment file first, followed by others in sorted order.

Changes

Cohort / File(s) Summary
Core generator configuration
packages/core-generators/src/generators/node/vitest/extractor.json, packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
Renamed template global-setupglobal-setup-env; updated paths and removed TPL_OPERATIONS variables; template now contains comment-only setup body
Core generator runtime
packages/core-generators/src/generators/node/vitest/vitest.generator.ts
Replaced globalSetupOperations (Map) with globalSetupFiles (Array); refactored to always render env file first via renderers.globalSetupEnv.render(), then construct array of sorted additional files for Vitest config
Fastify Redis generator
packages/fastify-generators/src/generators/core/fastify-redis/extractor.json, packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
Added new global-setup-redis template; exports setup function that sets REDIS_KEY_PREFIX environment variable for test isolation
Fastify Redis generator runtime
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
Added renderers dependency; replaced inline template code with renderer-based renderers.globalSetupRedis.render() and push result path into vitestConfig.globalSetupFiles
Fastify Prisma generator configuration
packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
Added new global-setup-prisma template with reference to db-test-helper template; specifies generated file path and empty variables
Fastify Prisma generator runtime
packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
Removed inline vitest config task and prismaVitestImportsProvider; added vitestConfig dependency to main task; render globalSetupPrisma and push path into vitestConfig.globalSetupFiles
Fastify Prisma generator template
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
New async setup function that imports from $dbTestHelper, validates DATABASE_URL, creates test database, and updates environment variables; skips for TEST_MODE=unit
Blog-with-auth example project
examples/blog-with-auth/apps/backend/baseplate/file-id-map.json, examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json, examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts, examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts, examples/blog-with-auth/apps/backend/vitest.config.ts
Renamed global-setup.tsglobal-setup-env.ts with env loading only; added global-setup-prisma.ts with Prisma database setup; changed Vitest config globalSetup from string to array of two files
Todo-with-auth0 example project
examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json, examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json, examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts, examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts, examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts, examples/todo-with-auth0/apps/backend/vitest.config.ts
Renamed global-setup.tsglobal-setup-env.ts; added global-setup-prisma.ts (Prisma setup) and global-setup-redis.ts (Redis prefix isolation); changed Vitest config globalSetup from string to array of three files in order: env, prisma, redis
Project sync actions
packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts, packages/project-builder-server/src/actions/sync/sync-project.action.ts, packages/project-builder-server/src/sync/sync-project.ts
Added packageSyncResults field (Record of per-package sync results) to sync action outputs and SyncProjectResult type; passed through from sync completion to action return
Migration changelog
.changeset/migrate-vitest-global-setup-to-individual-files.md
Documents migration of Vitest global setup from single merged file to per-generator setup files with new configuration structure

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically summarizes the main change: migrating Vitest global setup from a single merged file to individual files per generator, matching the core refactoring objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kingston/eng-942-split-test-global-setup-scripts-into-separate-files

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts (1)

1-5: Add JSDoc documentation for the exported setup function.

The coding guidelines require JSDoc comments for all exported functions in the examples/todo-with-auth0 directory, including documentation of the function's purpose, parameters, return value, and behavior.

📝 Suggested JSDoc
+/**
+ * Vitest global setup for Redis.
+ * Sets the Redis key prefix to "test:" for test isolation.
+ *
+ * @returns {void}
+ */
 export default function setup(): void {
   // Set Redis key prefix for test isolation
   process.env.REDIS_KEY_PREFIX = 'test:';
   console.info('Redis key prefix set to "test:" for isolation');
 }

Based on coding guidelines.

examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts (1)

5-7: Add JSDoc documentation for the exported setup function.

The coding guidelines require JSDoc comments for all exported functions in the examples/blog-with-auth directory, including documentation of the function's purpose, parameters, and return value.

📝 Suggested JSDoc
+/**
+ * Vitest global setup for environment variables.
+ * Note: The .env file is loaded at module evaluation time (line 3).
+ *
+ * @returns {Promise<void>} A promise that resolves when setup is complete.
+ */
 export default async function setup(): Promise<void> {
   // Environment loaded
 }

Based on coding guidelines.

examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts (1)

5-7: Add JSDoc documentation for the exported setup function.

The coding guidelines require JSDoc comments for all exported functions in the examples/todo-with-auth0 directory, including documentation of the function's purpose, parameters, and return value.

📝 Suggested JSDoc
+/**
+ * Vitest global setup for environment variables.
+ * Note: The .env file is loaded at module evaluation time (line 3).
+ *
+ * @returns {Promise<void>} A promise that resolves when setup is complete.
+ */
 export default async function setup(): Promise<void> {
   // Environment loaded
 }

Based on coding guidelines.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bde61e3 and c9eeaa6.

⛔ Files ignored due to path filters (16)
  • examples/blog-with-auth/apps/backend/baseplate/generated/src/tests/scripts/global-setup-env.ts is excluded by !**/generated/**, !**/generated/**
  • examples/blog-with-auth/apps/backend/baseplate/generated/src/tests/scripts/global-setup-prisma.ts is excluded by !**/generated/**, !**/generated/**
  • examples/blog-with-auth/apps/backend/baseplate/generated/vitest.config.ts is excluded by !**/generated/**, !**/generated/**
  • examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-env.ts is excluded by !**/generated/**, !**/generated/**
  • examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-prisma.ts is excluded by !**/generated/**, !**/generated/**
  • examples/todo-with-auth0/apps/backend/baseplate/generated/src/tests/scripts/global-setup-redis.ts is excluded by !**/generated/**, !**/generated/**
  • examples/todo-with-auth0/apps/backend/baseplate/generated/vitest.config.ts is excluded by !**/generated/**, !**/generated/**
  • packages/core-generators/src/generators/node/vitest/generated/template-paths.ts is excluded by !**/generated/**, !**/generated/**
  • packages/core-generators/src/generators/node/vitest/generated/template-renderers.ts is excluded by !**/generated/**, !**/generated/**
  • packages/core-generators/src/generators/node/vitest/generated/typed-templates.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/core/fastify-redis/generated/template-paths.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/core/fastify-redis/generated/template-renderers.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/core/fastify-redis/generated/typed-templates.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/template-paths.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/template-renderers.ts is excluded by !**/generated/**, !**/generated/**
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/generated/typed-templates.ts is excluded by !**/generated/**, !**/generated/**
📒 Files selected for processing (24)
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/extractor.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
  • packages/project-builder-server/src/actions/sync/sync-project.action.ts
  • packages/project-builder-server/src/sync/sync-project.ts
💤 Files with no reviewable changes (2)
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{ts,tsx}: Use TypeScript with strict type checking enabled
Always include return types on top-level functions including React components (React.ReactElement)
Include absolute paths in import statements via tsconfig paths (@src/ is the alias for src/)
If a particular interface or type is not exported, change the file so it is exported
If caught on a typing loop where forcing the any type is necessary, do not iterate too much - leave the typing as broken and let the user fix it

If target code is not easily testable, refactor it to be more testable (e.g., export types or functions)

**/*.{ts,tsx}: Import components from '@baseplate-dev/ui-components' package for UI development (e.g., Button, Input, Card, Dialog, etc.)
Use form components with React Hook Form controller variants (InputField, TextareaField, SelectField, CheckboxField, SwitchField, ComboboxField, MultiComboboxField, ColorPickerField, DatePickerField, DateTimePickerField)
Use SidebarLayout, Card, Breadcrumb, NavigationMenu, and NavigationTabs components for consistent layout structure from @baseplate-dev/ui-components
Use Dialog, ConfirmDialog, and useConfirmDialog from @baseplate-dev/ui-components for modal dialogs and confirmation interactions
Always use compareStrings from @baseplate-dev/utils instead of String.prototype.localeCompare() for code generation, file sorting, and internal data structures
If a particular interface or type is not exported, modify the file to export it
Use TsCodeFragment for composable code pieces and TsCodeUtils for manipulating fragments when generating TypeScript code
Create generators using createGenerator with configuration via descriptor schema (Zod), organizing into one or more tasks created with createGeneratorTask
Tasks should have run (initialization) and build (code generation) phases, export and consume providers, and may be organized into phases for ordered execution
Use provider scopes to control visibility and prevent collisions be...

Files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • packages/project-builder-server/src/sync/sync-project.ts
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/project-builder-server/src/actions/sync/sync-project.action.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/code-style.mdc)

**/*.{ts,tsx,js}: Node 16 module resolution - include file extensions in imports (.js)
Sort imports by group: external libs first, then local imports
Use camelCase for variables/functions, PascalCase for types/classes
Order functions such that functions are placed below the variables/functions they use
Prefer using nullish coalescing operator (??) instead of logical or (||), enforced via ESLint rule
Prefer barrel exports e.g. export * from './foo.js' instead of individual named exports
Use console.info/warn/error instead of console.log

Files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • packages/project-builder-server/src/sync/sync-project.ts
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/project-builder-server/src/actions/sync/sync-project.action.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
examples/todo-with-auth0/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)

Always use .js extensions in import statements, even for TypeScript files. Example: import { getSystemInfo } from '@src/system-info.js';

Files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
examples/todo-with-auth0/**/*.{ts,tsx}

📄 CodeRabbit inference engine (examples/todo-with-auth0/CLAUDE.md)

examples/todo-with-auth0/**/*.{ts,tsx}: Use import type for type-only imports
Always specify explicit return types for functions
Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields

Files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
examples/blog-with-auth/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)

examples/blog-with-auth/**/*.{ts,tsx,js,jsx}: Always use .js extensions in import statements, even for TypeScript files (e.g., import { getSystemInfo } from '@src/system-info.js';)
Follow ESM module resolution with TypeScript's NodeNext setting
Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields

Files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
examples/blog-with-auth/**/*.{ts,tsx}

📄 CodeRabbit inference engine (examples/blog-with-auth/CLAUDE.md)

examples/blog-with-auth/**/*.{ts,tsx}: Use import type for type-only imports in TypeScript
Always specify explicit return types for functions in TypeScript

Files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Add a new Changeset in the .changeset/ directory for new features or changes, with format 'package-name': patch and description of the feature or change

Files:

  • .changeset/migrate-vitest-global-setup-to-individual-files.md
🧠 Learnings (47)
📓 Common learnings
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Always import vitest globals explicitly (describe, it, expect)
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Import test functions explicitly from 'vitest' instead of using globals. Example: `import { describe, expect, it } from 'vitest';`

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.test-helper.{ts,tsx} : Extract common setup code into test helpers in `*.test-helper.ts` files

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.test.ts : Import test functions explicitly from 'vitest' instead of relying on globals (e.g., `import { describe, expect, it } from 'vitest';`)

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:01.582Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/code-style.mdc:0-0
Timestamp: 2025-11-24T19:45:01.582Z
Learning: Applies to **/*.{unit.test.ts,int.test.ts} : Always import vitest globals explicitly (describe, it, expect)

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Structure tests with Arrange-Act-Assert: clear setup, execution, and verification phases

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/templates/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{unit,int}.test.ts : Use `.unit.test.ts` or `.int.test.ts` suffixes for test files in TypeScript

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-redis.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-06-03T09:11:29.651Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 562
File: plugins/plugin-auth/package.json:32-36
Timestamp: 2025-06-03T09:11:29.651Z
Learning: With TypeScript project references, TypeScript compilation is watched from the root level using "watch:tsc:root" script, so individual packages no longer need to include their "tsc:watch" scripts in their local "watch" commands. The local "tsc:watch" scripts are renamed from "watch:tsc" but are not meant to be run as part of the package's watch command since TypeScript watching is handled centrally at the workspace root.

Applied to files:

  • packages/project-builder-server/src/sync/sync-project.ts
  • packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
📚 Learning: 2025-05-08T12:56:11.723Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 539
File: scripts/check-changesets.ts:70-79
Timestamp: 2025-05-08T12:56:11.723Z
Learning: In the check-changesets.ts script for monorepo validation, `npm pack ${pkg.name}latest` is intentionally used to pack the most recently published version (not local changes) for comparison purposes to determine if changes require new changesets.

Applied to files:

  • packages/project-builder-server/src/sync/sync-project.ts
📚 Learning: 2025-04-23T16:39:07.742Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 511
File: packages/project-builder-server/src/service/builder-service.ts:158-183
Timestamp: 2025-04-23T16:39:07.742Z
Learning: The `writeMetadata` method in the `SyncMetadataController` class returns void and is synchronous, not a Promise.

Applied to files:

  • packages/project-builder-server/src/sync/sync-project.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{ts,tsx} : Add JSDocs to all exported functions, interfaces, and classes with documentation of the function, its parameters, return value, and all fields

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Create generators using `createGenerator` with configuration via descriptor schema (Zod), organizing into one or more tasks created with `createGeneratorTask`

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/extractor.json
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Always use `compareStrings` from `baseplate-dev/utils` instead of `String.prototype.localeCompare()` for code generation, file sorting, and internal data structures

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use Dynamic Tasks for data-driven generation where code generation is driven by data

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.int.test.{ts,tsx} : Integration tests use `.int.test.ts` suffix

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to src/tests/**/*.{ts,tsx} : Test helpers are located in `src/tests/` directory

Applied to files:

  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Leverage TypeScript for type-safe mocking in tests

Applied to files:

  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.unit.test.{ts,tsx} : Unit tests are colocated with source files using `.unit.test.ts` suffix

Applied to files:

  • packages/fastify-generators/src/generators/vitest/prisma-vitest/extractor.json
  • examples/blog-with-auth/apps/backend/src/tests/scripts/.templates-info.json
  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/core-generators/src/generators/node/vitest/extractor.json
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Enable `isolatedModules` in TypeScript configuration

Applied to files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.{ts,tsx,js,jsx} : Follow ESM module resolution with TypeScript's `NodeNext` setting

Applied to files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Use `NodeNext` module resolution in TypeScript configuration

Applied to files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/tsconfig.json : Use strict type checking in TypeScript configuration

Applied to files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-11-24T19:44:33.994Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/blog-with-auth/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:33.994Z
Learning: Applies to examples/blog-with-auth/**/*.{ts,tsx} : Use `import type` for type-only imports in TypeScript

Applied to files:

  • examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Baseplate development follows a code-first approach: make changes directly in working codebases, extract those changes into reusable templates, update generators to use the new templates, then validate and sync the generated code

Applied to files:

  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-07-07T18:24:17.522Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 592
File: plugins/plugin-auth/src/auth0/generators/react/auth0-hooks/templates/src/hooks/use-required-user-id.ts:1-2
Timestamp: 2025-07-07T18:24:17.522Z
Learning: Files under templates/** directories can use `// ts-nocheck` because they are templates meant for code generation, not direct type checking.

Applied to files:

  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/core/fastify-redis/extractor.json
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Import components from 'baseplate-dev/ui-components' package for UI development (e.g., Button, Input, Card, Dialog, etc.)

Applied to files:

  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-11-24T19:45:27.654Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/ui-rules.mdc:0-0
Timestamp: 2025-11-24T19:45:27.654Z
Learning: Applies to +(*.tsx|packages/project-builder-web/**/*.tsx|packages/ui-components/**/*.tsx) : Use ShadCN-based components from `baseplate-dev/ui-components` instead of creating custom components

Applied to files:

  • examples/blog-with-auth/apps/backend/baseplate/file-id-map.json
  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/baseplate/file-id-map.json
📚 Learning: 2025-05-08T12:56:59.222Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 539
File: scripts/check-changesets.ts:10-13
Timestamp: 2025-05-08T12:56:59.222Z
Learning: Node.js 20.12.0 and above include `globSync` in the core `node:fs` module, so `import { promises as fs, globSync } from 'node:fs';` is valid syntax in projects using these Node.js versions.

Applied to files:

  • packages/project-builder-server/src/actions/sync/sync-project.action.ts
  • packages/project-builder-server/src/actions/sync/sync-all-projects.action.ts
📚 Learning: 2025-11-24T19:44:46.506Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: examples/todo-with-auth0/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:44:46.506Z
Learning: Applies to examples/todo-with-auth0/**/*.{ts,tsx} : Use `import type` for type-only imports

Applied to files:

  • examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Follow task-based architecture for generators, use provider scopes for explicit wiring, leverage TypeScript rendering system for code generation, organize complex generation with Task Phases, and use Dynamic Tasks for data-driven generation

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use TsCodeFragment for composable code pieces and TsCodeUtils for manipulating fragments when generating TypeScript code

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use SidebarLayout, Card, Breadcrumb, NavigationMenu, and NavigationTabs components for consistent layout structure from baseplate-dev/ui-components

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
📚 Learning: 2025-05-05T06:37:43.106Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 521
File: plugins/baseplate-plugin-storage/src/generators/react/upload-components/upload-components.generator.ts:108-112
Timestamp: 2025-05-05T06:37:43.106Z
Learning: The template extractor in the baseplate codebase can automatically infer and determine the necessary import map providers for certain templates, making explicit specification of importMapProviders unnecessary in those cases.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Tasks should have `run` (initialization) and `build` (code generation) phases, export and consume providers, and may be organized into phases for ordered execution

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-05-05T06:36:50.687Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 521
File: packages/react-generators/src/generators/admin/admin-crud-edit/admin-crud-edit.generator.ts:90-94
Timestamp: 2025-05-05T06:36:50.687Z
Learning: In this codebase, import paths can include `.ts` extensions, and the `resolveModuleSpecifier` function will handle them appropriately. There's no need to strip file extensions before passing paths to functions like `TsCodeUtils.importFragment`.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-07-12T19:56:08.559Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 606
File: plugins/plugin-auth/src/auth/core/generators/auth-apollo/auth-apollo.generator.ts:24-32
Timestamp: 2025-07-12T19:56:08.559Z
Learning: For generator functions and configuration object methods like those in createGeneratorTask, inferred return types are acceptable when the structure is clear from the implementation. ESLint rules handle enforcement of explicit return types where truly needed, so manual review for this is not necessary.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
📚 Learning: 2025-11-25T22:46:20.505Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:46:20.505Z
Learning: Applies to **/*.{ts,tsx} : Use provider scopes to control visibility and prevent collisions between tasks

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In the project-builder-server test suite, Vitest automocks for 'node:fs' and 'node:fs/promises' are already configured to use memfs without needing explicit implementation replacement in each test file.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: When testing file operations in this codebase, the pattern is to use Vitest automocks for 'node:fs' and 'node:fs/promises' (without explicit implementation replacement) while populating a virtual filesystem with vol.fromJSON() from memfs. File operations in tests are performed directly via vol.promises methods.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-06-30T11:52:28.745Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-06-30T11:52:28.745Z
Learning: Applies to **/*.test.{ts,tsx} : For file system operations in tests, use memfs and mock 'node:fs' and 'node:fs/promises' with vi.mock

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-04-23T06:44:30.952Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 510
File: packages/project-builder-server/src/sync/conflict-file-monitor.test.ts:19-24
Timestamp: 2025-04-23T06:44:30.952Z
Learning: In this codebase, when testing file operations, Vitest's automocks for 'node:fs' and 'node:fs/promises' are used in conjunction with memfs, but without replacing the mock implementation explicitly in each test file. The virtual filesystem is populated using vol.fromJSON or similar methods, which works seamlessly with the automocks.

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • .changeset/migrate-vitest-global-setup-to-individual-files.md
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : For file system operations in tests, use memfs and mock `node:fs` and `node:fs/promises`

Applied to files:

  • packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
📚 Learning: 2025-08-17T01:30:00.344Z
Learnt from: kingston
Repo: halfdomelabs/baseplate PR: 633
File: packages/core-generators/src/renderers/typescript/extractor/apply-simple-replacements.ts:47-48
Timestamp: 2025-08-17T01:30:00.344Z
Learning: In template extraction systems like apply-simple-replacements.ts, it's intentional to skip processing import declarations to allow unused imports to be removed properly after template variable replacements are applied.

Applied to files:

  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Always mock external API calls and file system operations

Applied to files:

  • packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts
  • packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts
  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Extract repeated logic into helper functions to reduce duplication

Applied to files:

  • packages/core-generators/src/generators/node/vitest/extractor.json
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:19.136Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-24T19:45:19.136Z
Learning: Applies to **/*.{unit,int}.test.{ts,tsx} : Test broad behavior and common edge cases intelligently to avoid slowing down CI with excessive tests

Applied to files:

  • examples/blog-with-auth/apps/backend/vitest.config.ts
  • examples/todo-with-auth0/apps/backend/vitest.config.ts
  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
📚 Learning: 2025-11-24T19:45:08.523Z
Learnt from: CR
Repo: halfdomelabs/baseplate PR: 0
File: .cursor/rules/dev-commands.mdc:0-0
Timestamp: 2025-11-24T19:45:08.523Z
Learning: Run tests using `pnpm test:affected` from repository root or `pnpm test` from package, with ability to run specific test files via `pnpm vitest <path/to/file.unit.test.ts>` or specific test patterns via `pnpm test "test name pattern"`

Applied to files:

  • packages/core-generators/src/generators/node/vitest/vitest.generator.ts
🧬 Code graph analysis (4)
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-env.ts (2)
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-env.ts (1)
  • setup (5-7)
packages/core-generators/src/generators/node/vitest/templates/src/tests/scripts/global-setup-env.ts (1)
  • setup (7-9)
packages/fastify-generators/src/generators/core/fastify-redis/fastify-redis.generator.ts (1)
packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
  • vitestConfigProvider (39-39)
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts (3)
examples/blog-with-auth/apps/backend/src/tests/scripts/global-setup-prisma.ts (1)
  • setup (3-21)
examples/todo-with-auth0/apps/backend/src/tests/scripts/global-setup-prisma.ts (1)
  • setup (3-21)
packages/fastify-generators/src/generators/vitest/prisma-vitest/templates/src/tests/helpers/db.test-helper.ts (1)
  • createTestDatabase (29-54)
packages/fastify-generators/src/generators/vitest/prisma-vitest/prisma-vitest.generator.ts (1)
packages/core-generators/src/generators/node/vitest/vitest.generator.ts (1)
  • vitestConfigProvider (39-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Verify Sync (todo-with-auth0)
  • GitHub Check: Verify Sync (blog-with-auth)
  • GitHub Check: Lint
  • GitHub Check: test
  • GitHub Check: Test E2E

Comment on lines +224 to +228
const metadata = await syncMetadataController?.getMetadata();

const packageSyncResults = Object.fromEntries(
apps.map((app) => [app.id, metadata?.packages[app.id].result]),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Potential null pointer exception when accessing package results.

Line 227 uses incomplete optional chaining: metadata?.packages[app.id].result. If metadata is undefined, the expression metadata?.packages returns undefined, then undefined[app.id] returns undefined, but accessing .result on undefined will throw a TypeError.

🔎 Proposed fix with full optional chaining
-    const packageSyncResults = Object.fromEntries(
-      apps.map((app) => [app.id, metadata?.packages[app.id].result]),
-    );
+    const packageSyncResults = Object.fromEntries(
+      apps.map((app) => [app.id, metadata?.packages[app.id]?.result]),
+    );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const metadata = await syncMetadataController?.getMetadata();
const packageSyncResults = Object.fromEntries(
apps.map((app) => [app.id, metadata?.packages[app.id].result]),
);
const metadata = await syncMetadataController?.getMetadata();
const packageSyncResults = Object.fromEntries(
apps.map((app) => [app.id, metadata?.packages[app.id]?.result]),
);
🤖 Prompt for AI Agents
In packages/project-builder-server/src/sync/sync-project.ts around lines 224 to
228, the code accesses metadata?.packages[app.id].result which can throw when
metadata or packages is undefined; change the access to use full optional
chaining (e.g. metadata?.packages?.[app.id]?.result) or provide a safe fallback
(like null or a default object) so you never call .result on undefined, and
update the packageSyncResults creation accordingly.

@kingston kingston merged commit 74529e7 into main Dec 23, 2025
17 checks passed
@kingston kingston deleted the kingston/eng-942-split-test-global-setup-scripts-into-separate-files branch December 23, 2025 11:49
@github-actions github-actions Bot mentioned this pull request Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant