Migrate planner roster and task commands to Zod#7422
Open
waldekmastykarz wants to merge 5 commits into
Open
Conversation
Migrates all 19 planner roster and task commands from the legacy #initOptions/#initValidators/#initTelemetry pattern to Zod schema validation: - planner roster add/get/remove - planner roster member add/get/list/remove - planner roster plan list - planner task add/get/list/remove/set - planner task checklistitem add/list/remove - planner task reference add/list/remove Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use superRefine for dynamic error messages (Zod API compat) - Fix getRefinedSchema in task-get/task-remove to skip planId/planTitle/rosterId check when bucketId provided - Add tests for bucketId bypass and percentComplete conversion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Microsoft Planner roster and task command implementations from the legacy initOptions/initValidators/initTelemetry patterns to Zod schema-based option definition and cross-option validation, aligning these commands with the CLI’s newer schema-driven validation/telemetry pipeline.
Changes:
- Replaced legacy option/validator/telemetry setup in Planner roster/task commands with exported
optionsZod schemas,schemagetters, andgetRefinedSchema()refinements (option-sets and conditional requirements). - Updated command specs to validate via
command.getSchemaToParse().safeParse()/parse()and added unknown-option validation tests. - Minor behavior alignment in a few commands (e.g., trimming applied category tokens; coercing
percentCompleteto a number before sending to Graph).
Reviewed changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/m365/planner/commands/task/task-set.ts | Migrates planner task set options/validation to Zod; adds refined schema rules and minor appliedCategories/percentComplete handling updates. |
| src/m365/planner/commands/task/task-set.spec.ts | Updates tests to validate with schema parsing and adds unknown-option validation coverage. |
| src/m365/planner/commands/task/task-remove.ts | Migrates planner task remove options/validation to Zod with refined cross-field rules. |
| src/m365/planner/commands/task/task-remove.spec.ts | Updates tests to use schema parsing and expands coverage for Zod validation paths. |
| src/m365/planner/commands/task/task-reference-remove.ts | Migrates planner task reference remove to Zod schema + option-set refinement (url vs alias). |
| src/m365/planner/commands/task/task-reference-remove.spec.ts | Updates validation and action tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-reference-list.ts | Migrates planner task reference list to Zod schema-based options. |
| src/m365/planner/commands/task/task-reference-list.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-reference-add.ts | Migrates planner task reference add to Zod schema-based options and value validation. |
| src/m365/planner/commands/task/task-reference-add.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-list.ts | Migrates planner task list options/validation to Zod with refined option-set rules. |
| src/m365/planner/commands/task/task-list.spec.ts | Updates tests to validate via schema parsing (including empty args + unknown options). |
| src/m365/planner/commands/task/task-get.ts | Migrates planner task get options/validation to Zod with refined option-set rules. |
| src/m365/planner/commands/task/task-get.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-checklistitem-remove.ts | Migrates planner task checklistitem remove to Zod schema-based options. |
| src/m365/planner/commands/task/task-checklistitem-remove.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-checklistitem-list.ts | Migrates planner task checklistitem list to Zod schema-based options; keeps default output behavior. |
| src/m365/planner/commands/task/task-checklistitem-list.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-checklistitem-add.ts | Migrates planner task checklistitem add to Zod schema-based options. |
| src/m365/planner/commands/task/task-checklistitem-add.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/task/task-add.ts | Migrates planner task add options/validation to Zod with refined schema rules; trims appliedCategories and coerces percentComplete. |
| src/m365/planner/commands/task/task-add.spec.ts | Updates tests to use schema parsing, adds unknown-option coverage, and expands percentComplete behavior coverage. |
| src/m365/planner/commands/roster/roster-remove.ts | Migrates planner roster remove to Zod schema-based options. |
| src/m365/planner/commands/roster/roster-remove.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/roster/roster-plan-list.ts | Migrates planner roster plan list to Zod schema + refined option-set rule for userId vs userName. |
| src/m365/planner/commands/roster/roster-plan-list.spec.ts | Updates tests to use schema parsing and adds validation coverage for option combinations and unknown options. |
| src/m365/planner/commands/roster/roster-member-remove.ts | Migrates planner roster member remove to Zod schema + refined option-set rule for user identification. |
| src/m365/planner/commands/roster/roster-member-remove.spec.ts | Updates tests to use schema parsing and adds validation/unknown-option coverage. |
| src/m365/planner/commands/roster/roster-member-list.ts | Migrates planner roster member list to Zod schema-based options. |
| src/m365/planner/commands/roster/roster-member-list.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/roster/roster-member-get.ts | Migrates planner roster member get to Zod schema + refined option-set rule for userId vs userName. |
| src/m365/planner/commands/roster/roster-member-get.spec.ts | Updates tests to use schema parsing and adds validation/unknown-option coverage. |
| src/m365/planner/commands/roster/roster-member-add.ts | Migrates planner roster member add to Zod schema + refined option-set rule for userId vs userName. |
| src/m365/planner/commands/roster/roster-member-add.spec.ts | Updates tests to use schema parsing and adds validation/unknown-option coverage. |
| src/m365/planner/commands/roster/roster-get.ts | Migrates planner roster get to Zod schema-based options. |
| src/m365/planner/commands/roster/roster-get.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| src/m365/planner/commands/roster/roster-add.ts | Migrates planner roster add to schema-driven global options validation. |
| src/m365/planner/commands/roster/roster-add.spec.ts | Updates tests to use schema parsing and adds unknown-option validation. |
| .impeccable/hook.cache.json | Adds a local tooling cache file (should not be committed). |
Files not reviewed (1)
- .impeccable/hook.cache.json: Generated file
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MartinM85
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7312
Summary
Migrates all 19
planner rosterandplanner taskcommands from the legacy#initOptions()/#initValidators()/#initTelemetry()pattern to Zod schema-based validation.Commands migrated
planner roster addplanner roster getplanner roster member addplanner roster member getplanner roster member listplanner roster member removeplanner roster plan listplanner roster removeplanner task addplanner task checklistitem addplanner task checklistitem listplanner task checklistitem removeplanner task getplanner task listplanner task reference addplanner task reference listplanner task reference removeplanner task removeplanner task setChanges per command
optionsschema withz.strictObject()schemagettergetRefinedSchema()for cross-field validation (option sets, conditional requirements)constructor(),#initOptions(),#initValidators(),#initTelemetry(),#initTypes(),#initOptionSets()commandOptionsSchema.safeParse()/.parse()Testing
All 496 planner tests passing.