fix: make metadata field optional in parse-prd schema#1362
fix: make metadata field optional in parse-prd schema#1362Crunchyman-ralph merged 3 commits intonextfrom
Conversation
🦋 Changeset detectedLatest commit: 1fe7149 The changes in this PR will be included in the next version bump. 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 |
WalkthroughMade the PRD parser schema accept nullable metadata and updated the parse prompt to allow an optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (2).changeset/*.md📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
Files:
.changeset/*📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Files:
🧠 Learnings (20)📓 Common learnings📚 Learning: 2025-07-20T01:35:05.831ZApplied to files:
📚 Learning: 2025-07-18T17:14:29.399ZApplied to files:
📚 Learning: 2025-10-01T19:53:34.261ZApplied to files:
📚 Learning: 2025-07-18T17:14:29.399ZApplied to files:
📚 Learning: 2025-07-18T17:14:54.131ZApplied to files:
📚 Learning: 2025-09-24T15:12:12.658ZApplied to files:
📚 Learning: 2025-07-18T17:10:12.881ZApplied to files:
📚 Learning: 2025-07-31T22:08:16.039ZApplied to files:
📚 Learning: 2025-07-18T17:10:31.810ZApplied to files:
📚 Learning: 2025-07-18T17:07:53.100ZApplied to files:
📚 Learning: 2025-07-18T17:12:57.903ZApplied to files:
📚 Learning: 2025-07-18T17:07:53.100ZApplied to files:
📚 Learning: 2025-08-06T21:14:23.071ZApplied to files:
📚 Learning: 2025-10-27T17:16:25.440ZApplied to files:
📚 Learning: 2025-09-24T15:12:58.855ZApplied to files:
📚 Learning: 2025-07-18T17:07:53.100ZApplied to files:
📚 Learning: 2025-10-08T12:21:14.455ZApplied to files:
📚 Learning: 2025-07-18T17:10:12.881ZApplied to files:
📚 Learning: 2025-07-21T14:14:48.694ZApplied to files:
🪛 LanguageTool.changeset/fix-metadata-nullable.md[grammar] ~5-~5: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) 🔇 Additional comments (1)
Comment |
|
@claude run npm run format, and watch out for this |
|
Claude finished @Crunchyman-ralph's task —— View job I've successfully applied your recommendation and addressed the formatting request: Todo List
Changes Made
The changes have been committed and pushed to the branch. The Note: I wasn't able to run |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/modules/task-manager/parse-prd/parse-prd-config.js (1)
28-37: Fix formatting issue.The pipeline indicates Biome format check failed for these lines. Run
npm run formatto fix the code style issues.
🧹 Nitpick comments (1)
.changeset/fix-metadata-nullable.md (1)
5-7: Consider a more user-facing summary.The changeset summary currently describes an implementation detail (.nullable() vs .optional()) rather than the user-facing benefit. Per the coding guidelines, changeset summaries should communicate what changed in the released version that's relevant to users.
Consider rephrasing the summary to highlight the end-user benefit:
-fix: improve parse-prd schema by using .nullable() instead of .optional() +fix: restore PRD parsing compatibility with structured AI model responsesThe description provides helpful context around the why; a more direct summary ensures package consumers immediately understand the fix's impact.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/fix-metadata-nullable.md(1 hunks)scripts/modules/task-manager/parse-prd/parse-prd-config.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
scripts/modules/**
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.Do not call AI-specific getters (like
getMainModelId,getMainMaxTokens) from core logic functions inscripts/modules/task-manager/*; instead, pass theroleto the unified AI service.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
.changeset/*.md
📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
.changeset/*.md: When runningnpm run changesetornpx changeset add, provide a concise summary of the changes for theCHANGELOG.mdin imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.Changesets should describe user-facing impact rather than internal implementation details
Files:
.changeset/fix-metadata-nullable.md
.changeset/*
📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Files:
.changeset/fix-metadata-nullable.md
🧠 Learnings (16)
📓 Common learnings
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/build-config/package.json:14-15
Timestamp: 2025-09-22T19:45:13.323Z
Learning: In the eyaltoledano/claude-task-master repository, Crunchyman-ralph intentionally omits version fields from internal packages (like tm/build-config) to prevent changesets from releasing new versions for these packages. This is the desired behavior for internal tooling packages that should not be published or versioned independently.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#943
File: scripts/modules/task-manager/move-task.js:24-24
Timestamp: 2025-07-18T05:38:17.352Z
Learning: In the Claude Task Master system, core task-manager functions are designed with fallback mechanisms for missing projectRoot parameters using the pattern `const projectRoot = providedProjectRoot || findProjectRoot();`. The readJSON and writeJSON functions have default parameters (projectRoot = null, tag = null) and handle missing parameters gracefully. Adding strict validation to these core functions would break the established flexible architecture pattern.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
PR: eyaltoledano/claude-task-master#933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:09:45.690Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Ensure new features work with existing projects seamlessly, supporting both legacy and tagged task data formats, and support silent migration during feature usage.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:08:48.695Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-18T17:08:48.695Z
Learning: Applies to scripts/modules/commands.js : Follow the provided structure for adding subtasks, including required options and detailed error handling.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Verify modifications on the in-memory task objects passed to writeJSON.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:13:30.188Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tags.mdc:0-0
Timestamp: 2025-07-18T17:13:30.188Z
Learning: Applies to scripts/modules/* : Every command that reads or writes tasks.json must be tag-aware
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-31T22:07:49.716Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-31T22:07:49.716Z
Learning: Applies to scripts/modules/commands.js : Follow the provided structure for adding subtasks, including required and optional options, parameter validation, and detailed error handling.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to .changeset/* : Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-09-24T15:12:58.855Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.taskmaster/docs/*.{txt,md} : Keep PRDs as .txt or .md under .taskmaster/docs and parse them with task-master parse-prd (use --append for incremental updates)
Applied to files:
.changeset/fix-metadata-nullable.md
🪛 GitHub Actions: CI
scripts/modules/task-manager/parse-prd/parse-prd-config.js
[error] 28-37: Biome format check failed. The formatter would reformat the file parse-prd-config.js. Run 'biome format .' to fix code style issues.
🔇 Additional comments (1)
scripts/modules/task-manager/parse-prd/parse-prd-config.js (1)
28-36: I need to verify how the schema is used by the AI service and whether.nullable()alone is sufficient. Let me check thegenerateObjectServiceimplementation and how it handles structured output.Now I need to look at the actual Zod schema to determine if metadata is required:
Based on my verification, I can now provide the rewritten review comment. The key findings are:
- By default, all properties are required in Zod
- Nullable schemas explicitly accept null values, while optional schemas accept undefined values
- Both Anthropic (via tool calling) and OpenAI (via Structured Outputs) require fields marked as required in the schema to be present in the response
- The metadata field in the schema is required (not optional), so using
.nullable()means the AI must returnmetadata: nullrather than omitting itHowever, the core concern remains: the implementation may be incomplete if the AI SDK's structured output behavior hasn't been verified to actually return
metadata: nullwhen metadata isn't available.
Verify that
.nullable()resolves the structured output validation error and test with both providers.Nullable schemas explicitly accept null values, so this change makes the metadata field accept
metadata: nullwhile keeping the field required. This differs from.optional(), which would allow the field to be omitted.The approach assumes that when Structured Outputs are enabled, model outputs will match the supplied tool definition, meaning the AI will return
{ tasks: [...], metadata: null }rather than omitting the field.However, verify this assumption holds by:
- Testing with actual Anthropic Claude and OpenAI API responses
- Confirming the AI returns
metadata: null(not omitting the field) when metadata isn't available- Ensuring validation passes in both streaming and non-streaming modes (both files use the schema)
If the AI still omits the field despite the required schema, the fix should use
.nullable().optional()to handle both cases.Note: The PR title says "make metadata optional" but the implementation uses
.nullable(), which are distinct Zod concepts that may cause confusion during code review.
The parse-prd functionality was failing after AI SDK v5 upgrade due to a mismatch between prompt instructions and schema validation. The prompt correctly instructs AI to return only tasks array, but schema required both tasks and metadata fields. This change makes metadata optional while maintaining backward compatibility, allowing both current and future response formats. Fixes #1353 Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
…tibility Changed metadata field in parse-prd schema from .optional() to .nullable() to allow explicit null returns which align better with AI SDK v5 expectations and structured output integrations. Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
6a53435 to
a958b70
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/fix-metadata-nullable.md (1)
5-5: Refocus summary on user-facing impact rather than implementation details.The summary describes the technical implementation (
.nullable()vs.optional()) rather than the user-visible benefit. According to the coding guidelines, changesets should describe what changed in the released version that is relevant to users or consumers of the package.The user-facing impact is that PRD parsing now works correctly with AI responses that omit or return null for metadata, resolving the validation errors reported in issue #1353.
Consider revising the summary to something like:
-fix: improve parse-prd schema by using .nullable() instead of .optional() +fix: restore parse-prd compatibility with metadata-less AI responsesOr:
-fix: improve parse-prd schema by using .nullable() instead of .optional() +fix: resolve parse-prd validation errors when metadata is omittedThe description (lines 7–8) provides good context about model compatibility, so you may keep that as-is.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/fix-metadata-nullable.md(1 hunks)scripts/modules/task-manager/parse-prd/parse-prd-config.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/modules/task-manager/parse-prd/parse-prd-config.js
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
.changeset/*.md: When runningnpm run changesetornpx changeset add, provide a concise summary of the changes for theCHANGELOG.mdin imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.Changesets should describe user-facing impact rather than internal implementation details
Files:
.changeset/fix-metadata-nullable.md
.changeset/*
📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Files:
.changeset/fix-metadata-nullable.md
🧠 Learnings (8)
📓 Common learnings
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to .changeset/* : Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Every pull request containing new features, bug fixes, breaking changes, performance improvements, significant refactoring, user-facing documentation updates, dependency updates, or impactful build/tooling changes should include a changeset file.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Applies to .changeset/*.md : The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Always stage and commit the generated `.changeset/*.md` file along with your relevant code changes.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Applies to .changeset/*.md : When running `npm run changeset` or `npx changeset add`, provide a concise summary of the changes for the `CHANGELOG.md` in imperative mood, typically a single line, and not a detailed Git commit message.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-10-27T17:16:25.440Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-27T17:16:25.440Z
Learning: Applies to .changeset/*.md : Changesets should describe user-facing impact rather than internal implementation details
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-09-24T15:12:58.855Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.taskmaster/docs/*.{txt,md} : Keep PRDs as .txt or .md under .taskmaster/docs and parse them with task-master parse-prd (use --append for incremental updates)
Applied to files:
.changeset/fix-metadata-nullable.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). (1)
- GitHub Check: Test
a958b70 to
55df741
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/fix-metadata-nullable.md(1 hunks)scripts/modules/task-manager/parse-prd/parse-prd-config.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
scripts/modules/**
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.Do not call AI-specific getters (like
getMainModelId,getMainMaxTokens) from core logic functions inscripts/modules/task-manager/*; instead, pass theroleto the unified AI service.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
.changeset/*.md
📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)
.changeset/*.md: When runningnpm run changesetornpx changeset add, provide a concise summary of the changes for theCHANGELOG.mdin imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.Changesets should describe user-facing impact rather than internal implementation details
Files:
.changeset/fix-metadata-nullable.md
.changeset/*
📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)
Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Files:
.changeset/fix-metadata-nullable.md
🧠 Learnings (18)
📓 Common learnings
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1232
File: packages/build-config/package.json:14-15
Timestamp: 2025-09-22T19:45:13.323Z
Learning: In the eyaltoledano/claude-task-master repository, Crunchyman-ralph intentionally omits version fields from internal packages (like tm/build-config) to prevent changesets from releasing new versions for these packages. This is the desired behavior for internal tooling packages that should not be published or versioned independently.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
PR: eyaltoledano/claude-task-master#933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Ensure new features work with existing projects seamlessly, supporting both legacy and tagged task data formats, and support silent migration during feature usage.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-10-01T19:53:34.261Z
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1262
File: scripts/modules/task-manager/update-tasks.js:216-233
Timestamp: 2025-10-01T19:53:34.261Z
Learning: For scripts/modules/task-manager/*.js: Use generateObjectService with Zod schemas for structured AI responses rather than generateTextService + manual JSON parsing, as modern AI providers increasingly support the tool use and generateObject paradigm with improved reliability.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:09:45.690Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dependencies.mdc:0-0
Timestamp: 2025-07-18T17:09:45.690Z
Learning: Applies to scripts/modules/dependency-manager.js : Remove references to non-existent tasks during validation
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Implement silent migration from legacy to tagged format in the readJSON() function, detect legacy format, convert automatically, and preserve all existing task data during migration.
Applied to files:
scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to .changeset/* : Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Every pull request containing new features, bug fixes, breaking changes, performance improvements, significant refactoring, user-facing documentation updates, dependency updates, or impactful build/tooling changes should include a changeset file.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-10-27T17:16:25.440Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-27T17:16:25.440Z
Learning: Applies to .changeset/*.md : Changesets should describe user-facing impact rather than internal implementation details
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Applies to .changeset/*.md : When running `npm run changeset` or `npx changeset add`, provide a concise summary of the changes for the `CHANGELOG.md` in imperative mood, typically a single line, and not a detailed Git commit message.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-09-24T15:12:58.855Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/AGENTS.md:0-0
Timestamp: 2025-09-24T15:12:58.855Z
Learning: Applies to assets/.taskmaster/docs/*.{txt,md} : Keep PRDs as .txt or .md under .taskmaster/docs and parse them with task-master parse-prd (use --append for incremental updates)
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
PR: eyaltoledano/claude-task-master#933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-09-24T15:12:12.658Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-09-24T15:12:12.658Z
Learning: Start new projects with task-master init or parse a PRD via task-master parse-prd --input=<file> to generate an initial tasks.json
Applied to files:
.changeset/fix-metadata-nullable.md
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: For PRD-driven feature development, create a dedicated tag, draft a PRD in `.taskmaster/docs/`, parse it into tasks, and add a high-level reference in the master tag.
Applied to files:
.changeset/fix-metadata-nullable.md
🪛 LanguageTool
.changeset/fix-metadata-nullable.md
[grammar] ~5-~5: Ensure spelling is correct
Context: ...e parse PRD schema for better llm model compatiblity - Fixes #1353
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
⏰ 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). (1)
- GitHub Check: Test
| metadata: z | ||
| .object({ | ||
| projectName: z.string(), | ||
| totalTasks: z.number(), | ||
| sourceFile: z.string(), | ||
| generatedAt: z.string() | ||
| }) | ||
| .nullable() |
There was a problem hiding this comment.
🧩 Analysis chain
Verify that .nullable() alone solves the issue.
The PR title and objectives indicate making the metadata field "optional" to accept AI responses that omit the metadata field entirely (e.g., { tasks: [...] }). However, in standard Zod semantics, .nullable() only allows the field to be null but still requires it to be present in the object.
To accept responses where the metadata field is completely absent, you typically need .optional() or .nullable().optional().
If the AI is returning { tasks: [...] } without a metadata key, the current schema will still fail validation.
Run the following script to verify how the schema behaves with different response formats:
🏁 Script executed:
#!/bin/bash
# Description: Test schema validation with different metadata scenarios
cat > /tmp/test-schema.mjs << 'EOF'
import { z } from 'zod';
const prdSingleTaskSchema = z.object({
id: z.number(),
title: z.string().min(1),
description: z.string().min(1),
details: z.string(),
testStrategy: z.string(),
priority: z.enum(['low', 'medium', 'high', 'critical']),
dependencies: z.array(z.number()),
status: z.string()
});
// Current schema with .nullable()
const currentSchema = z.object({
tasks: z.array(prdSingleTaskSchema),
metadata: z.object({
projectName: z.string(),
totalTasks: z.number(),
sourceFile: z.string(),
generatedAt: z.string()
}).nullable()
});
// Test cases
const testCases = [
{ name: 'Tasks only (no metadata key)', data: { tasks: [] } },
{ name: 'Tasks with null metadata', data: { tasks: [], metadata: null } },
{ name: 'Tasks with metadata object', data: { tasks: [], metadata: { projectName: 'test', totalTasks: 0, sourceFile: 'test.md', generatedAt: '2025-10-30' } } }
];
console.log('Testing current schema (.nullable() only):\n');
testCases.forEach(({ name, data }) => {
try {
currentSchema.parse(data);
console.log(`✓ ${name}: PASS`);
} catch (error) {
console.log(`✗ ${name}: FAIL - ${error.errors[0].message}`);
}
});
EOF
node /tmp/test-schema.mjsLength of output: 910
I'll verify the Zod semantics and examine the actual codebase usage to determine if the schema change is sufficient.
Now let me examine the codebase to see how this schema is actually used and what format the AI responses have:
Based on the web search results, nullable fields must be explicitly set to null when present, while optional fields can be completely omitted from the object or set to undefined. I can see that Zod treats nullable fields as requiring the field to be present, and fields should be treated as nullish (optional + nullable) to allow them to be omitted entirely.
Now let me check the actual codebase to see how this schema is used:
🏁 Script executed:
#!/bin/bash
# Search for parse-prd-config usage and AI response patterns
# Find the schema file and its usage
fd -e js -e ts "parse-prd-config|prd.*config" --type f
# Find where prdResponseSchema is used
rg -n "prdResponseSchema|parse.*prd" --type=js --type=ts -A 3 -B 3
# Look for AI prompt and actual response examples
rg -n "tasks.*only|metadata|generateObjectService" --type=js --type=ts -A 3 -B 3 | head -100
# Check for tests
fd -e test.js -e spec.js -e .test.js "prd" --type fLength of output: 72904
Let me examine the actual schema file and test data:
Now let me check the actual schema code and test data:
🏁 Script executed:
#!/bin/bash
# View the parse-prd-config.js file to see exact schema
cat scripts/modules/task-manager/parse-prd/parse-prd-config.js
# Also look for any test mocks showing expected AI response format
rg -n "tasks.*metadata|metadata.*tasks" tests/unit/scripts/modules/task-manager/parse-prd.test.js -A 5 -B 2 | head -80
# Check the AI prompt
cat src/prompts/parse-prd.json 2>/dev/null | head -100Length of output: 10948
Fix metadata field schema to accept responses without metadata key.
The AI prompt explicitly instructs: "Your response must be a JSON object with a single property named "tasks" containing an array of task objects. Do NOT include metadata or any other properties."
However, the schema at lines 30-37 uses .nullable() which requires the metadata field to be present in the object (it only allows the value to be null). This will cause validation to fail for the exact response format the AI is instructed to generate.
Change .nullable() to .nullish() (which is shorthand for .nullable().optional()) to allow the field to be completely absent, matching the AI prompt's instructions:
metadata: z
.object({
projectName: z.string(),
totalTasks: z.number(),
sourceFile: z.string(),
generatedAt: z.string()
})
.nullish()🤖 Prompt for AI Agents
In scripts/modules/task-manager/parse-prd/parse-prd-config.js around lines 30 to
37, the metadata schema uses .nullable(), which still requires the metadata key
to be present (even if null); update it to .nullish() so the metadata property
may be omitted entirely (and still accept null), matching the AI prompt that
returns only the "tasks" array; replace the .nullable() call with .nullish() on
the metadata schema.
55df741 to
f88c7a2
Compare
f88c7a2 to
1fe7149
Compare
) Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Fixes eyaltoledano#1353
The parse-prd functionality was failing after AI SDK v5 upgrade due to a mismatch between prompt instructions and schema validation. The prompt correctly instructs AI to return only tasks array, but schema required both tasks and metadata fields.
This change makes metadata optional while maintaining backward compatibility, allowing both current and future response formats.
What type of PR is this?
Description
Related Issues
How to Test This
# Example commands or stepsExpected result:
Contributor Checklist
npm run changesetnpm testnpm run format-check(ornpm run formatto fix)Changelog Entry
For Maintainers
Summary by CodeRabbit