Skip to content

Conversation

@kingston
Copy link
Collaborator

@kingston kingston commented Dec 23, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed data operation handling to properly support falsy update values (0, false, empty strings), which were previously being incorrectly skipped during data operations.

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

@vercel
Copy link

vercel bot commented Dec 23, 2025

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 10:06pm

@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

🦋 Changeset detected

Latest commit: 7899e74

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/fastify-generators Patch
@baseplate-dev/project-builder-server 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/core-generators Patch
@baseplate-dev/project-builder-lib Patch
@baseplate-dev/react-generators 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
Copy link

coderabbitai bot commented Dec 23, 2025

📝 Walkthrough

Walkthrough

PR adds a changeset and fixes falsy value handling in data operations by replacing truthiness checks with explicit undefined comparisons across the generator template and example applications, ensuring null, false, 0, and empty strings are treated as provided rather than absent.

Changes

Cohort / File(s) Summary
Changeset metadata
.changeset/smart-mice-doubt.md
New changeset entry documenting a patch to fastify-generators addressing falsy update value handling
Example applications
examples/blog-with-auth/apps/backend/src/utils/data-operations/define-operations.ts, examples/todo-with-auth0/apps/backend/src/utils/data-operations/define-operations.ts
Updated guard conditions in transformFields and splitCreateUpdateData from truthiness checks (result.data, value.update) to explicit undefined checks (!== undefined) to properly handle falsy values
Generator template
packages/fastify-generators/src/generators/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts
Updated guard conditions in transformFields and field update logic from truthiness checks to explicit undefined checks, enabling falsy values (0, false, empty string) to be treated as provided

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 describes the main change: fixing handling of falsy update values in data operations by replacing truthy checks with explicit undefined checks.
✨ 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-943-cannot-set-field-to-false-when-updating

📜 Recent 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 74529e7 and 7899e74.

⛔ Files ignored due to path filters (12)
  • examples/blog-with-auth/apps/backend/baseplate/generated/src/utils/data-operations/define-operations.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/src/utils/data-operations/define-operations.ts is excluded by !**/generated/**, !**/generated/**
  • tests/simple/apps/backend/baseplate/file-id-map.json is excluded by !tests/**
  • tests/simple/apps/backend/baseplate/generated/src/tests/scripts/global-setup-env.ts is excluded by !**/generated/**, !tests/**, !**/generated/**
  • tests/simple/apps/backend/baseplate/generated/src/tests/scripts/global-setup-prisma.ts is excluded by !**/generated/**, !tests/**, !**/generated/**
  • tests/simple/apps/backend/baseplate/generated/src/utils/data-operations/define-operations.ts is excluded by !**/generated/**, !tests/**, !**/generated/**
  • tests/simple/apps/backend/baseplate/generated/vitest.config.ts is excluded by !**/generated/**, !tests/**, !**/generated/**
  • tests/simple/apps/backend/src/tests/scripts/global-setup-env.ts is excluded by !tests/**
  • tests/simple/apps/backend/src/tests/scripts/global-setup-prisma.ts is excluded by !tests/**
  • tests/simple/apps/backend/src/utils/data-operations/define-operations.ts is excluded by !tests/**
  • tests/simple/apps/backend/vitest.config.ts is excluded by !tests/**
📒 Files selected for processing (4)
  • .changeset/smart-mice-doubt.md
  • examples/blog-with-auth/apps/backend/src/utils/data-operations/define-operations.ts
  • examples/todo-with-auth0/apps/backend/src/utils/data-operations/define-operations.ts
  • packages/fastify-generators/src/generators/prisma/data-utils/templates/src/utils/data-operations/define-operations.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/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts
  • examples/todo-with-auth0/apps/backend/src/utils/data-operations/define-operations.ts
  • examples/blog-with-auth/apps/backend/src/utils/data-operations/define-operations.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/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts
  • examples/todo-with-auth0/apps/backend/src/utils/data-operations/define-operations.ts
  • examples/blog-with-auth/apps/backend/src/utils/data-operations/define-operations.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/utils/data-operations/define-operations.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/utils/data-operations/define-operations.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/utils/data-operations/define-operations.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/utils/data-operations/define-operations.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/smart-mice-doubt.md
🧠 Learnings (1)
📚 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 .changeset/*.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

Applied to files:

  • .changeset/smart-mice-doubt.md
⏰ 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
🔇 Additional comments (7)
.changeset/smart-mice-doubt.md (1)

1-5: LGTM! Changeset follows the correct format.

The changeset correctly documents this bug fix as a patch-level change to @baseplate-dev/fastify-generators with an accurate description.

examples/blog-with-auth/apps/backend/src/utils/data-operations/define-operations.ts (2)

148-152: Critical fix for handling falsy values in field transformations.

This change correctly distinguishes between undefined (field not provided) and falsy values like false, 0, null, or "" (explicitly provided). Previously, falsy values would be incorrectly excluded from the data object, preventing users from setting fields to these values.


176-179: Critical fix for handling falsy update values.

This change ensures that falsy values like false, 0, null, or "" are correctly included in update operations. The explicit !== undefined check aligns with the check for value.create at Line 172 and ensures consistent behavior.

examples/todo-with-auth0/apps/backend/src/utils/data-operations/define-operations.ts (2)

148-152: Critical fix for handling falsy values in field transformations.

This change correctly distinguishes between undefined (field not provided) and falsy values like false, 0, null, or "" (explicitly provided), consistent with the fix in the blog-with-auth example.


176-179: Critical fix for handling falsy update values.

This change ensures falsy values are correctly included in update operations, maintaining consistency with the fix at Line 172 for value.create and across all implementation files.

packages/fastify-generators/src/generators/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts (2)

146-150: Critical fix applied to the generator template.

This change in the template ensures that all future generated code will correctly handle falsy values in field transformations. The explicit !== undefined check distinguishes between "not provided" and "provided with a falsy value."


174-177: Critical fix applied to the generator template.

This change ensures future generated code will correctly include falsy values in update operations, consistent with the check for value.create at Line 170.


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.

@kingston kingston merged commit 2395821 into main Dec 23, 2025
17 checks passed
@kingston kingston deleted the kingston/eng-943-cannot-set-field-to-false-when-updating branch December 23, 2025 22:09
@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.

2 participants