Skip to content

Conversation

@mcalhoun
Copy link

@mcalhoun mcalhoun commented Nov 20, 2025

Description

The organizations client is using the wrong casing for the url in the DeleteOrganization method. It has /Organizations instead of /organizations.

Also added missing tests for the DeleteOrganization method.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[x] No

@mcalhoun mcalhoun requested a review from a team as a code owner November 20, 2025 21:54
@mcalhoun mcalhoun requested a review from mthadley November 20, 2025 21:54
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 20, 2025

Greptile Overview

Greptile Summary

Fixed a critical bug in the DeleteOrganization method where the URL path used incorrect casing (/Organizations/ instead of /organizations/), which would have caused 404 errors when attempting to delete organizations.

  • Corrected URL path from /Organizations/{id} to /organizations/{id} in client.go:464
  • Added comprehensive test coverage for the DeleteOrganization method that was previously missing
  • Enhanced test handlers with proper path validation to catch similar casing issues in the future
  • All other endpoints in the codebase already use the correct lowercase /organizations/ pattern

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it fixes a clear bug with proper test coverage
  • The fix is a simple one-character change that corrects an obvious typo, makes the code consistent with all other endpoints in the file, and includes comprehensive test coverage that validates the fix
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
pkg/organizations/client.go 5/5 Fixed URL casing from /Organizations/ to /organizations/ in DeleteOrganization method
pkg/organizations/client_test.go 5/5 Added comprehensive test coverage for DeleteOrganization and improved path validation in test handlers
pkg/organizations/organizations_test.go 5/5 Added integration test for DeleteOrganization using the default client

Sequence Diagram

sequenceDiagram
    participant Client as Go Client
    participant API as WorkOS API
    
    Client->>Client: DeleteOrganization(ctx, opts)
    Client->>Client: Build DELETE request
    Note over Client: URL: /organizations/{id}<br/>(fixed from /Organizations/{id})
    Client->>API: DELETE /organizations/{organization_id}
    Note over API: Validates path casing<br/>and organization ID
    API-->>Client: 204 No Content
    Client-->>Client: Return nil (success)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant