Skip to content

fix(microsoft-planner): align with live Graph API docs, add plan CRUD + categories#5486

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/microsoft-planner-validation
Jul 7, 2026
Merged

fix(microsoft-planner): align with live Graph API docs, add plan CRUD + categories#5486
waleedlatif1 merged 4 commits into
stagingfrom
fix/microsoft-planner-validation

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fixed update_task never returning the updated task (missing Prefer: return=representation)
  • Fixed wrong @odata.type on task assignments (missing leading #)
  • Fixed update_plan/update_plan_details/update_bucket/update_task_details crashing on 204 No Content responses to PATCH (Graph sometimes ignores the Prefer header)
  • Added .trim() on path-interpolated IDs across tools that can be invoked directly
  • Added create_plan, update_plan, delete_plan, get_plan_details, update_plan_details tools, with correct If-Match/etag handling
  • Added appliedCategories support on create_task/update_task
  • Fixed 7 tools using the wrong (generic) error extractor instead of the Graph-specific one used by sibling Microsoft integrations (Excel, OneDrive, SharePoint)
  • Regenerated integration docs

All new tools verified against Microsoft Graph's per-endpoint Permissions tables to require only the scopes we already request (Group.ReadWrite.All, Group.Read.All, Tasks.ReadWrite) — no new scopes added.

Type of Change

  • Bug fix
  • New feature (non-breaking)

Testing

Tested manually. Ran three independent full-integration validation passes against live Microsoft Graph API docs (all 18 tools, backwards-compatibility audit, block/tool wiring + cross-integration consistency) before opening this PR.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

… + categories

- fix update_task never returning updated task (missing Prefer: return=representation)
- fix wrong @odata.type on task assignments (missing leading #)
- fix update_plan/update_plan_details/update_bucket/update_task_details crashing
  on 204 No Content responses to PATCH (Graph sometimes ignores Prefer header)
- add .trim() on path IDs across tools invoked outside the block
- add create_plan, update_plan, delete_plan, get_plan_details, update_plan_details
  tools (If-Match/etag handled correctly on update/delete)
- add appliedCategories support on create_task/update_task
- all new tools verified against Graph API Permissions tables to require only
  scopes we already request (Group.ReadWrite.All, Group.Read.All, Tasks.ReadWrite)
- regenerate integration docs
7 tools were pinned to the generic 'nested-error-object' extractor
instead of MICROSOFT_GRAPH_ERRORS, losing Graph's inner-error detail
(e.g. ETag mismatch specifics) that sibling Microsoft integrations
(Excel, OneDrive, SharePoint) already surface correctly.
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 7, 2026 6:51pm

Request Review

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches many live Graph write paths including plan delete and broad PATCH behavior changes; regressions could affect existing Planner workflows despite no new OAuth scopes.

Overview
Expands Microsoft Planner with full plan lifecycle (create, update, delete, get/update plan details) wired through new Graph tools, the workflow block, and the tool registry, plus regenerated integration docs.

Task and Graph fixes: create_task drops the invalid task-level description param and adds startDateTime, priority, percentComplete, and comma-separated appliedCategories (with - prefix to clear on update). Assignments use #microsoft.graph.plannerAssignment. PATCH handlers send Prefer: return=representation and tolerate 204 No Content without crashing; chained update_task no longer returns a stale etag on empty responses. Path IDs are trimmed in URLs; checklist/references JSON is parsed in task-details updates.

Block UX: New plan operations and fields (groupId, planTitle, categories, plan details JSON); description is limited to update task details; several fields move to advanced mode on create.

Several tools switch from the generic error extractor to MICROSOFT_GRAPH_ERRORS.

Reviewed by Cursor Bugbot for commit b10667f. Configure here.

Comment thread apps/sim/tools/microsoft_planner/create_task.ts
Comment thread apps/sim/tools/microsoft_planner/update_task.ts
Comment thread apps/sim/tools/microsoft_planner/delete_plan.ts
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes several bugs in the Microsoft Planner integration (missing Prefer: return=representation header, wrong @odata.type prefix on assignments, 204-crash on PATCH responses, wrong error extractor on 7 tools) and adds five new plan-management tools (create_plan, update_plan, delete_plan, get_plan_details, update_plan_details) along with appliedCategories support on task create/update.

  • Bug fixes: Prefer: return=representation added to all PATCH tools; @odata.type on plannerAssignment corrected from microsoft.graph to #microsoft.graph; 204 No Content responses handled gracefully in transformResponse; 7 tools switched from the generic nested-error-object extractor to ErrorExtractorId.MICROSOFT_GRAPH_ERRORS.
  • New tools: Five plan CRUD tools added with correct ETag/If-Match handling, proper error extractors, and 204-safe response handling; all wired into the block, index, and registry.
  • Task enhancements: appliedCategories field (comma-separated, with - prefix to clear) added to create_task and update_task; startDateTime, priority, and percentComplete added to create_task; the block now maps planTitle separately from title to avoid ambiguity.

Confidence Score: 5/5

Safe to merge — all PATCH tools now correctly handle 204 responses, the @odata.type fix and Prefer header addition are straightforward corrections, and the five new plan tools follow the established tool pattern consistently.

The bug fixes are targeted and verified: the Prefer header is now in every PATCH tool, the @odata.type prefix correction matches the Graph API spec, and the 204 guard prevents JSON-parse crashes. The new plan tools are additive with no regressions to existing tools and use the same request/response structure as the bucket and task tools.

No files require special attention. The five new tool files and the updated block routing are straightforward, and the previously flagged missing errorExtractor and appliedCategories issues have been addressed in the HEAD commit.

Important Files Changed

Filename Overview
apps/sim/tools/microsoft_planner/create_plan.ts New tool; uses container.url to create a plan owned by a group, extracts container.containerId from the response for metadata. POST always returns a body so no 204 guard needed.
apps/sim/tools/microsoft_planner/delete_plan.ts New DELETE tool; requires etag for If-Match, handles ETag stripping, returns a static success object. errorExtractor correctly set.
apps/sim/tools/microsoft_planner/get_plan_details.ts New GET tool; returns planDetails and etag for use in update_plan_details. errorExtractor correctly set.
apps/sim/tools/microsoft_planner/update_plan.ts New PATCH tool for renaming a plan; includes Prefer: return=representation, correct ETag cleaning, and 204 fallback that returns empty plan with planId from params.
apps/sim/tools/microsoft_planner/update_plan_details.ts New PATCH tool for updating category descriptions and sharedWith; parses JSON strings from block params at runtime with try/catch, handles 204 gracefully.
apps/sim/tools/microsoft_planner/update_task.ts Added Prefer: return=representation, fixed @odata.type prefix, added appliedCategories support with negative-prefix removal, fixed priority null-check.
apps/sim/tools/microsoft_planner/create_task.ts Added startDateTime, priority, percentComplete, appliedCategories params; fixed @odata.type on assignment; removed description from this tool.
apps/sim/tools/microsoft_planner/update_task_details.ts Added errorExtractor, Prefer header, defensive JSON.parse for checklist/references, and 204-safe transformResponse.
apps/sim/tools/microsoft_planner/update_bucket.ts Switched to MICROSOFT_GRAPH_ERRORS extractor, added Prefer: return=representation, added 204-safe response, added .trim() on bucketId.
apps/sim/tools/microsoft_planner/types.ts Added PlannerAppliedCategories, PlannerPlanDetails interfaces; exported additional types; added response types for 5 new tools; extended MicrosoftPlannerToolParams.
apps/sim/blocks/blocks/microsoft_planner.ts Added 5 new plan operations to the dropdown, UI fields, and getToolParams routing for each new operation. Removed description from create_task.
apps/sim/tools/registry.ts Imports and registers the 5 new plan tools under their correct IDs; no issues.
apps/sim/tools/microsoft_planner/index.ts Re-exports the 5 new plan tools; all names consistent with the registry and block.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[MicrosoftPlannerBlock getToolParams] --> B{operation}
    B --> C[create_plan new]
    B --> D[update_plan new]
    B --> E[get_plan_details new]
    B --> F[update_plan_details new]
    B --> G[delete_plan new]
    B --> H[create_task / update_task updated]
    B --> I[update_bucket / update_task_details updated]
    C --> C1[POST /planner/plans - 201 + plan body]
    D --> D1[PATCH /planner/plans/id - Prefer return=representation - 200 or 204]
    E --> E1[GET /planner/plans/id/details - 200 + planDetails + etag]
    F --> F1[PATCH /planner/plans/id/details - Prefer return=representation - 200 or 204]
    G --> G1[DELETE /planner/plans/id - If-Match etag - 204]
    H --> H1[Fixed @odata.type prefix - Added Prefer header - New appliedCategories]
    I --> I1[Fixed MICROSOFT_GRAPH_ERRORS extractor - Fixed 204 handling]
    D1 --> D2{body empty?}
    D2 -->|Yes 204| D3[return planId from params]
    D2 -->|No 200| D4[parse and return plan]
    F1 --> F2{body empty?}
    F2 -->|Yes 204| F3[return planId from params]
    F2 -->|No 200| F4[parse and return planDetails]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[MicrosoftPlannerBlock getToolParams] --> B{operation}
    B --> C[create_plan new]
    B --> D[update_plan new]
    B --> E[get_plan_details new]
    B --> F[update_plan_details new]
    B --> G[delete_plan new]
    B --> H[create_task / update_task updated]
    B --> I[update_bucket / update_task_details updated]
    C --> C1[POST /planner/plans - 201 + plan body]
    D --> D1[PATCH /planner/plans/id - Prefer return=representation - 200 or 204]
    E --> E1[GET /planner/plans/id/details - 200 + planDetails + etag]
    F --> F1[PATCH /planner/plans/id/details - Prefer return=representation - 200 or 204]
    G --> G1[DELETE /planner/plans/id - If-Match etag - 204]
    H --> H1[Fixed @odata.type prefix - Added Prefer header - New appliedCategories]
    I --> I1[Fixed MICROSOFT_GRAPH_ERRORS extractor - Fixed 204 handling]
    D1 --> D2{body empty?}
    D2 -->|Yes 204| D3[return planId from params]
    D2 -->|No 200| D4[parse and return plan]
    F1 --> F2{body empty?}
    F2 -->|Yes 204| F3[return planId from params]
    F2 -->|No 200| F4[parse and return planDetails]
Loading

Reviews (5): Last reviewed commit: "fix(microsoft-planner): don't return a s..." | Re-trigger Greptile

Comment thread apps/sim/tools/microsoft_planner/delete_plan.ts
Comment thread apps/sim/tools/microsoft_planner/create_task.ts
- fix empty priority/percentComplete string coercing to 0 (Number('')) at
  the block layer, which Planner treats as urgent/0% instead of leaving unset
- support removing applied categories on update via a "-category3" prefix,
  since Graph only clears a label when its key is explicitly set to false
- add missing MICROSOFT_GRAPH_ERRORS extractor to delete_plan/get_plan_details
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/microsoft_planner/update_task.ts
…response

Graph's If-Match update changes the resource's etag even when it returns
204 No Content instead of the updated representation. Returning the
request's (now-stale) etag as if it were current would let a chained
update silently send a wrong If-Match and fail with 412. Return an empty
etag instead so update_task's own etag-required guard forces a re-fetch.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b10667f. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1 waleedlatif1 merged commit 1a87f1a into staging Jul 7, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/microsoft-planner-validation branch July 7, 2026 19:14
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

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