Skip to content

feat: added smithy for workspace lock#1006

Open
sauraww wants to merge 1 commit into
mainfrom
workspacelock-smithy
Open

feat: added smithy for workspace lock#1006
sauraww wants to merge 1 commit into
mainfrom
workspacelock-smithy

Conversation

@sauraww
Copy link
Copy Markdown
Collaborator

@sauraww sauraww commented May 15, 2026

Problem

Describe the problem you are trying to solve here

Solution

Provide a brief summary of your solution so that reviewers can understand your code

Environment variable changes

What ENVs need to be added or changed

Pre-deployment activity

Things needed to be done before deploying this change (if any)

Post-deployment activity

Things needed to be done after deploying this change (if any)

API changes

Endpoint Method Request body Response Body
API GET/POST, etc request response

Possible Issues in the future

Describe any possible issues that could occur because of this change

Summary by CodeRabbit

  • New Features

    • Added workspace write-lock detection and reporting. API now returns a new WorkspaceLockConflict error (HTTP 409) when workspace write operations conflict with existing locks from concurrent requests. Workspace responses include lock metadata (lock_id, operation, locked_by, acquired_at, expires_at) when an active lock is present.
  • Documentation

    • Updated API documentation for workspace and default-config operations to reflect new lock conflict error responses across all client SDKs.

Review Change Stack

Copilot AI review requested due to automatic review settings May 15, 2026 14:16
@sauraww sauraww requested a review from a team as a code owner May 15, 2026 14:16
@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented May 15, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  docs/docs/api/list-workspace.StatusCodes.json  84% smaller
  docs/docs/api/migrate-workspace-schema.StatusCodes.json  83% smaller
  docs/docs/api/update-workspace.StatusCodes.json  83% smaller
  docs/docs/api/get-workspace.StatusCodes.json  83% smaller
  docs/docs/api/create-workspace.StatusCodes.json  83% smaller
  docs/docs/api/update-default-config.StatusCodes.json  81% smaller
  docs/docs/api/create-default-config.StatusCodes.json  81% smaller
  docs/docs/api/delete-default-config.StatusCodes.json  74% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/Workspace.java  73% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java  19% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java  19% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateWorkspaceOutput.java  9% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/GetWorkspaceOutput.java  9% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/MigrateWorkspaceSchemaOutput.java  9% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateWorkspaceOutput.java  9% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceResponse.java  9% smaller
  clients/haskell/sdk/Io/Superposition/Command/CreateDefaultConfig.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Command/DeleteDefaultConfig.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Command/UpdateDefaultConfig.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/CreateWorkspaceOutput.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/GetWorkspaceOutput.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/MigrateWorkspaceSchemaOutput.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/UpdateWorkspaceOutput.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/WorkspaceLock.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/WorkspaceResponse.hs Unsupported file format
  clients/haskell/sdk/SuperpositionSDK.cabal Unsupported file format
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateDefaultConfig.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/DeleteDefaultConfig.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateDefaultConfig.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLock.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLockConflict.java  0% smaller
  clients/javascript/sdk/src/commands/CreateDefaultConfigCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/CreateWorkspaceCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/DeleteDefaultConfigCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/GetWorkspaceCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/ListWorkspaceCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/MigrateWorkspaceSchemaCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/UpdateDefaultConfigCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/UpdateWorkspaceCommand.ts  0% smaller
  clients/javascript/sdk/src/models/models_0.ts  0% smaller
  clients/javascript/sdk/src/protocols/Aws_restJson1.ts  0% smaller
  clients/python/sdk/superposition_sdk/_private/schemas.py  0% smaller
  clients/python/sdk/superposition_sdk/deserialize.py  0% smaller
  clients/python/sdk/superposition_sdk/models.py  0% smaller
  crates/superposition_sdk/src/client/create_workspace.rs  0% smaller
  crates/superposition_sdk/src/client/get_workspace.rs  0% smaller
  crates/superposition_sdk/src/client/migrate_workspace_schema.rs  0% smaller
  crates/superposition_sdk/src/client/update_workspace.rs  0% smaller
  crates/superposition_sdk/src/error_meta.rs  0% smaller
  crates/superposition_sdk/src/operation/create_default_config.rs  0% smaller
  crates/superposition_sdk/src/operation/create_workspace/_create_workspace_output.rs Unsupported file format
  crates/superposition_sdk/src/operation/delete_default_config.rs  0% smaller
  crates/superposition_sdk/src/operation/get_workspace/_get_workspace_output.rs Unsupported file format
  crates/superposition_sdk/src/operation/migrate_workspace_schema/_migrate_workspace_schema_output.rs Unsupported file format
  crates/superposition_sdk/src/operation/update_default_config.rs  0% smaller
  crates/superposition_sdk/src/operation/update_workspace/_update_workspace_output.rs Unsupported file format
  crates/superposition_sdk/src/protocol_serde.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_create_default_config.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_create_workspace.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_delete_default_config.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_get_workspace.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_migrate_workspace_schema.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_update_default_config.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_update_workspace.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_workspace_lock.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_workspace_lock_conflict.rs  0% smaller
  crates/superposition_sdk/src/protocol_serde/shape_workspace_response.rs  0% smaller
  crates/superposition_sdk/src/serde_util.rs  0% smaller
  crates/superposition_sdk/src/types.rs  0% smaller
  crates/superposition_sdk/src/types/_workspace_lock.rs  0% smaller
  crates/superposition_sdk/src/types/_workspace_response.rs Unsupported file format
  crates/superposition_sdk/src/types/builders.rs  0% smaller
  crates/superposition_sdk/src/types/error.rs  0% smaller
  crates/superposition_sdk/src/types/error/_workspace_lock_conflict.rs  0% smaller
  crates/superposition_sdk/src/types/error/builders.rs  0% smaller
  docs/docs/api/Superposition.openapi.json  0% smaller
  docs/docs/api/create-default-config.api.mdx Unsupported file format
  docs/docs/api/create-workspace.api.mdx Unsupported file format
  docs/docs/api/delete-default-config.api.mdx Unsupported file format
  docs/docs/api/get-workspace.api.mdx Unsupported file format
  docs/docs/api/list-workspace.api.mdx Unsupported file format
  docs/docs/api/migrate-workspace-schema.api.mdx Unsupported file format
  docs/docs/api/update-default-config.api.mdx Unsupported file format
  docs/docs/api/update-workspace.api.mdx Unsupported file format
  smithy/models/default-config.smithy Unsupported file format
  smithy/models/main.smithy Unsupported file format
  smithy/models/workspace.smithy Unsupported file format
  smithy/patches/java.patch Unsupported file format

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Walkthrough

Introduces workspace lock modeling and a 409 WorkspaceLockConflict error in Smithy, propagates to all SDKs (Rust, Java, Python, TypeScript, Haskell), updates serializers/deserializers and error registries, exposes optional workspace_lock in responses, and documents via OpenAPI and MDX/StatusCodes.

Changes

Workspace lock + conflict error surfaced across stack

Layer / File(s) Summary
Smithy models and API/docs schemas
smithy/models/*.smithy, docs/docs/api/*
Adds WorkspaceLock, WorkspaceLockConflict (409), wires WorkspaceWriteOperation; updates OpenAPI/StatusCodes/MDX; adds workspace_lock in responses and 409 error docs.
Rust SDK types, serde, operations, and error meta
crates/superposition_sdk/...
Adds WorkspaceLock type and builder; introduces WorkspaceLockConflict error; updates serde, protocol deserializers, operation outputs, and top-level Error mappings.
Java SDK models and client Javadoc
clients/java/sdk/...
Adds WorkspaceLock and WorkspaceLockConflict models; includes workspace_lock in outputs; registers new error in operations; updates client Javadoc throws.
Python SDK schemas, models, deserializers
clients/python/sdk/...
Defines WORKSPACE_LOCK and WORKSPACE_LOCK_CONFLICT; extends output models with workspace_lock; routes 409 error during deserialization.
TypeScript SDK models, protocols, and command docs
clients/javascript/sdk/...
Adds WorkspaceLock interface and WorkspaceLockConflict error; updates RestJson protocol; extends command JSDoc with workspace_lock and 409 throws.
Haskell SDK models, outputs, and command errors
clients/haskell/sdk/...
Adds WorkspaceLock and WorkspaceLockConflict models; exposes workspace_lock in outputs and FromResponseParser; adds conflict variant to Create/Delete/Update default-config errors; cabal exposes modules.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

P0

Suggested reviewers

  • ayushjain17
  • Datron

Poem

A rabbit taps the lock with care,
“Who holds the key? Please, do declare!”
The schema blooms, the SDKs sing,
A 409—conflicts spring.
Yet through the fields, we safely flock:
We read the sign—respect the lock. 🐇🔒

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workspacelock-smithy

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Smithy API model to represent a workspace write-lock (workspace_lock) and introduces a modeled 409 error (WorkspaceLockConflict) for write operations blocked by an active lock, then propagates the updated model through generated OpenAPI/docs and multi-language SDKs.

Changes:

  • Added WorkspaceLock shape and workspace_lock property on the Workspace resource / responses.
  • Added WorkspaceLockConflict (409) error and a WorkspaceWriteOperation mixin, applying it to default-config write operations.
  • Regenerated OpenAPI/docs and SDKs (Rust, Python, JavaScript, Java, Haskell) to include the new shapes and error types.

Reviewed changes

Copilot reviewed 91 out of 91 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
smithy/patches/java.patch Updates Java-generation patch to include workspace_lock and adds RotateWorkspaceEncryptionKey to workspace operations.
smithy/models/workspace.smithy Adds workspace_lock property and defines the WorkspaceLock structure; exposes workspace_lock on WorkspaceResponse.
smithy/models/main.smithy Adds WorkspaceLockConflict (409) error and WorkspaceWriteOperation mixin.
smithy/models/default-config.smithy Applies WorkspaceWriteOperation (and thus 409) to Create/Update/Delete default-config operations.
docs/docs/api/update-workspace.StatusCodes.json Updates UpdateWorkspace response schema to include workspace_lock.
docs/docs/api/update-workspace.api.mdx Regenerated UpdateWorkspace API doc payload.
docs/docs/api/update-default-config.StatusCodes.json Adds documented 409 (WorkspaceLockConflict) to UpdateDefaultConfig.
docs/docs/api/update-default-config.api.mdx Regenerated UpdateDefaultConfig API doc payload.
docs/docs/api/Superposition.openapi.json Adds WorkspaceLock, WorkspaceLockConflictResponseContent, and 409 responses for default-config write operations; adds workspace_lock in workspace schemas.
docs/docs/api/migrate-workspace-schema.StatusCodes.json Updates MigrateWorkspaceSchema response schema to include workspace_lock.
docs/docs/api/migrate-workspace-schema.api.mdx Regenerated MigrateWorkspaceSchema API doc payload.
docs/docs/api/list-workspace.StatusCodes.json Updates ListWorkspace response schema to include workspace_lock.
docs/docs/api/list-workspace.api.mdx Regenerated ListWorkspace API doc payload.
docs/docs/api/get-workspace.StatusCodes.json Updates GetWorkspace response schema to include workspace_lock.
docs/docs/api/get-workspace.api.mdx Regenerated GetWorkspace API doc payload.
docs/docs/api/delete-default-config.StatusCodes.json Adds documented 409 (WorkspaceLockConflict) to DeleteDefaultConfig.
docs/docs/api/delete-default-config.api.mdx Regenerated DeleteDefaultConfig API doc payload.
docs/docs/api/create-workspace.StatusCodes.json Updates CreateWorkspace response schema to include workspace_lock.
docs/docs/api/create-workspace.api.mdx Regenerated CreateWorkspace API doc payload.
docs/docs/api/create-default-config.StatusCodes.json Adds documented 409 (WorkspaceLockConflict) to CreateDefaultConfig.
docs/docs/api/create-default-config.api.mdx Regenerated CreateDefaultConfig API doc payload.
crates/superposition_sdk/src/types/error/builders.rs Re-exports Rust builder for WorkspaceLockConflict.
crates/superposition_sdk/src/types/error/_workspace_lock_conflict.rs Adds Rust modeled error type WorkspaceLockConflict.
crates/superposition_sdk/src/types/error.rs Registers Rust error module/type for WorkspaceLockConflict.
crates/superposition_sdk/src/types/builders.rs Re-exports Rust builder for WorkspaceLock.
crates/superposition_sdk/src/types/_workspace_response.rs Adds optional workspace_lock to Rust WorkspaceResponse.
crates/superposition_sdk/src/types/_workspace_lock.rs Adds Rust WorkspaceLock type + builder.
crates/superposition_sdk/src/types.rs Exports WorkspaceLock from Rust types module.
crates/superposition_sdk/src/serde_util.rs Adds Rust error-correction helpers for new lock/error shapes.
crates/superposition_sdk/src/protocol_serde/shape_workspace_response.rs Deserializes workspace_lock into Rust WorkspaceResponse.
crates/superposition_sdk/src/protocol_serde/shape_workspace_lock.rs Adds Rust JSON deserializer for WorkspaceLock.
crates/superposition_sdk/src/protocol_serde/shape_workspace_lock_conflict.rs Adds Rust JSON error-body deserializer for WorkspaceLockConflict.
crates/superposition_sdk/src/protocol_serde/shape_update_workspace.rs Deserializes workspace_lock into Rust UpdateWorkspace output.
crates/superposition_sdk/src/protocol_serde/shape_update_default_config.rs Adds Rust HTTP error mapping for WorkspaceLockConflict on UpdateDefaultConfig.
crates/superposition_sdk/src/protocol_serde/shape_migrate_workspace_schema.rs Deserializes workspace_lock into Rust MigrateWorkspaceSchema output.
crates/superposition_sdk/src/protocol_serde/shape_get_workspace.rs Deserializes workspace_lock into Rust GetWorkspace output.
crates/superposition_sdk/src/protocol_serde/shape_delete_default_config.rs Adds Rust HTTP error mapping for WorkspaceLockConflict on DeleteDefaultConfig.
crates/superposition_sdk/src/protocol_serde/shape_create_workspace.rs Deserializes workspace_lock into Rust CreateWorkspace output.
crates/superposition_sdk/src/protocol_serde/shape_create_default_config.rs Adds Rust HTTP error mapping for WorkspaceLockConflict on CreateDefaultConfig.
crates/superposition_sdk/src/protocol_serde.rs Registers new Rust protocol serde modules for lock/conflict.
crates/superposition_sdk/src/operation/update_workspace/_update_workspace_output.rs Adds optional workspace_lock to Rust UpdateWorkspace output.
crates/superposition_sdk/src/operation/update_default_config.rs Adds WorkspaceLockConflict variant to Rust UpdateDefaultConfigError.
crates/superposition_sdk/src/operation/migrate_workspace_schema/_migrate_workspace_schema_output.rs Adds optional workspace_lock to Rust MigrateWorkspaceSchema output.
crates/superposition_sdk/src/operation/get_workspace/_get_workspace_output.rs Adds optional workspace_lock to Rust GetWorkspace output.
crates/superposition_sdk/src/operation/delete_default_config.rs Adds WorkspaceLockConflict variant to Rust DeleteDefaultConfigError.
crates/superposition_sdk/src/operation/create_workspace/_create_workspace_output.rs Adds optional workspace_lock to Rust CreateWorkspace output.
crates/superposition_sdk/src/operation/create_default_config.rs Adds WorkspaceLockConflict variant to Rust CreateDefaultConfigError.
crates/superposition_sdk/src/error_meta.rs Promotes WorkspaceLockConflict into Rust top-level error enum conversions/metadata.
crates/superposition_sdk/src/client/update_workspace.rs Documents workspace_lock field in UpdateWorkspace client docs.
crates/superposition_sdk/src/client/migrate_workspace_schema.rs Documents workspace_lock field in MigrateWorkspaceSchema client docs.
crates/superposition_sdk/src/client/get_workspace.rs Documents workspace_lock field in GetWorkspace client docs.
crates/superposition_sdk/src/client/create_workspace.rs Documents workspace_lock field in CreateWorkspace client docs.
clients/python/sdk/superposition_sdk/models.py Adds Python WorkspaceLock and WorkspaceLockConflict; wires into relevant operations and outputs.
clients/python/sdk/superposition_sdk/deserialize.py Adds Python deserialization for WorkspaceLockConflict error.
clients/python/sdk/superposition_sdk/_private/schemas.py Adds Python schema definitions for WorkspaceLock + WorkspaceLockConflict and references from workspace outputs.
clients/javascript/sdk/src/protocols/Aws_restJson1.ts Adds JS protocol deserialization for WorkspaceLock and WorkspaceLockConflict.
clients/javascript/sdk/src/models/models_0.ts Adds JS model types for WorkspaceLock and WorkspaceLockConflict; adds workspace_lock to WorkspaceResponse.
clients/javascript/sdk/src/commands/UpdateWorkspaceCommand.ts Updates command output docs to include workspace_lock.
clients/javascript/sdk/src/commands/UpdateDefaultConfigCommand.ts Documents WorkspaceLockConflict throw type.
clients/javascript/sdk/src/commands/MigrateWorkspaceSchemaCommand.ts Updates command output docs to include workspace_lock.
clients/javascript/sdk/src/commands/ListWorkspaceCommand.ts Updates command output docs to include workspace_lock.
clients/javascript/sdk/src/commands/GetWorkspaceCommand.ts Updates command output docs to include workspace_lock.
clients/javascript/sdk/src/commands/DeleteDefaultConfigCommand.ts Documents WorkspaceLockConflict throw type.
clients/javascript/sdk/src/commands/CreateWorkspaceCommand.ts Updates command output docs to include workspace_lock.
clients/javascript/sdk/src/commands/CreateDefaultConfigCommand.ts Documents WorkspaceLockConflict throw type.
clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceResponse.java Adds workspace_lock to Java WorkspaceResponse.
clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLockConflict.java Adds Java modeled exception WorkspaceLockConflict.
clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLock.java Adds Java WorkspaceLock model.
clients/java/sdk/src/main/java/io/juspay/superposition/model/Workspace.java Adds workspace_lock to Java Workspace resource properties.
clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateWorkspaceOutput.java Adds workspace_lock to Java UpdateWorkspace output.
clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateDefaultConfig.java Registers WorkspaceLockConflict in Java UpdateDefaultConfig type registry.
clients/java/sdk/src/main/java/io/juspay/superposition/model/MigrateWorkspaceSchemaOutput.java Adds workspace_lock to Java MigrateWorkspaceSchema output.
clients/java/sdk/src/main/java/io/juspay/superposition/model/GetWorkspaceOutput.java Adds workspace_lock to Java GetWorkspace output.
clients/java/sdk/src/main/java/io/juspay/superposition/model/DeleteDefaultConfig.java Registers WorkspaceLockConflict in Java DeleteDefaultConfig type registry.
clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateWorkspaceOutput.java Adds workspace_lock to Java CreateWorkspace output.
clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateDefaultConfig.java Registers WorkspaceLockConflict in Java CreateDefaultConfig type registry.
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java Regenerated ordering in Java client type registry initialization.
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java Adds WorkspaceLockConflict import/throws docs and regens auth scheme declaration order.
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java Regenerated ordering in Java async client type registry initialization.
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java Adds WorkspaceLockConflict import/throws docs and regens auth scheme declaration order.
clients/haskell/sdk/SuperpositionSDK.cabal Adds new Haskell modules to cabal export list.
clients/haskell/sdk/Io/Superposition/Model/WorkspaceResponse.hs Adds optional workspace_lock to Haskell WorkspaceResponse.
clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs Adds Haskell WorkspaceLockConflict model + 409 response parser.
clients/haskell/sdk/Io/Superposition/Model/WorkspaceLock.hs Adds Haskell WorkspaceLock model.
clients/haskell/sdk/Io/Superposition/Model/UpdateWorkspaceOutput.hs Adds optional workspace_lock to Haskell UpdateWorkspaceOutput.
clients/haskell/sdk/Io/Superposition/Model/MigrateWorkspaceSchemaOutput.hs Adds optional workspace_lock to Haskell MigrateWorkspaceSchemaOutput.
clients/haskell/sdk/Io/Superposition/Model/GetWorkspaceOutput.hs Adds optional workspace_lock to Haskell GetWorkspaceOutput.
clients/haskell/sdk/Io/Superposition/Model/CreateWorkspaceOutput.hs Adds optional workspace_lock to Haskell CreateWorkspaceOutput.
clients/haskell/sdk/Io/Superposition/Command/UpdateDefaultConfig.hs Adds WorkspaceLockConflict handling to Haskell UpdateDefaultConfig command error parsing.
clients/haskell/sdk/Io/Superposition/Command/DeleteDefaultConfig.hs Adds WorkspaceLockConflict handling to Haskell DeleteDefaultConfig command error parsing.
clients/haskell/sdk/Io/Superposition/Command/CreateDefaultConfig.hs Adds WorkspaceLockConflict handling to Haskell CreateDefaultConfig command error parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread smithy/models/main.smithy
Comment on lines +125 to +130
@mixin
operation WorkspaceWriteOperation {
errors: [
WorkspaceLockConflict
]
}
Comment on lines 23 to 28
allow_experiment_self_approval: Boolean
auto_populate_control: Boolean
enable_context_validation: Boolean
enable_change_reason_validation: Boolean
workspace_lock: WorkspaceLock
}
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
docs/docs/api/create-workspace.StatusCodes.json (1)

1-1: 💤 Low value

Consider terminology consistency: "workspace lease" vs "workspace lock".

The workspace_lock description uses "workspace lease" while the WorkspaceLockConflict error description uses "workspace lock". These terms should be consistent across the API documentation.

This is likely defined in the Smithy source models, so if adjusted, it should be corrected there to propagate to all generated SDKs and documentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/docs/api/create-workspace.StatusCodes.json` at line 1, Summary:
Inconsistent terminology: "workspace lease" vs "workspace lock" across API docs;
unify to "workspace lock". Fix: update the Smithy model(s) that define the
CreateWorkspaceResponseContent property workspace_lock and the
WorkspaceLockConflict error description so both use the same term ("workspace
lock"); specifically edit the description text for the symbol workspace_lock in
the CreateWorkspaceResponseContent and the WorkspaceLockConflict error model to
replace "workspace lease" with "workspace lock" (or vice versa if your standard
is the other term) so generated docs and SDKs are consistent.
clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs (1)

85-85: ⚡ Quick win

Use idiomatic status409 instead of mkStatus 409 "".

The Network.HTTP.Types library provides predefined status constants like status409 that are cleaner and more idiomatic than constructing with mkStatus. While the reason phrase is ignored in equality comparisons, using the library's constants improves code clarity and consistency with standard Haskell practices.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs` at line
85, Replace the manual construction of a 409 status in the expectedStatus
binding with the library constant: change the expression in expectedStatus from
Network.HTTP.Types.mkStatus 409 "" to status409 (or Network.HTTP.Types.status409
if you keep the qualified name), and ensure status409 is imported from
Network.HTTP.Types (or referenced qualified) so the module compiles and uses the
idiomatic constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLockConflict.java`:
- Around line 169-174: The build logic in WorkspaceLockConflict marks the
required member $SCHEMA_LOCK as present via tracker.setMember($SCHEMA_LOCK)
without ensuring the field lock is non-null, so build() may produce an instance
with lock == null; update the build() method (the WorkspaceLockConflict builder)
to either assign a safe fallback to the lock field before calling
tracker.setMember($SCHEMA_LOCK) or throw an
IllegalStateException/NullPointerException if lock is missing—ensure the code
path that calls tracker.setMember($SCHEMA_LOCK) also guarantees lock is set
(check the builder's lock variable and the tracker.checkMember($SCHEMA_LOCK)
branch) so required invariants hold.

In `@crates/superposition_sdk/src/protocol_serde/shape_create_default_config.rs`:
- Around line 30-42: The new WorkspaceLockConflict match arm for
CreateDefaultConfigError builds the error payload but doesn't backfill
tmp.message from the fallback _error_message when the parsed payload lacks a
message, causing inconsistent diagnostics; update the WorkspaceLockConflict arm
(the block that uses
crate::protocol_serde::shape_workspace_lock_conflict::de_workspace_lock_conflict_json_err
and crate::serde_util::workspace_lock_conflict_correct_errors) to follow the
same pattern as adjacent arms: after output.meta(generic) and before build(),
check if tmp.message (or the builder's message field) is empty/None and if so
set it to _error_message, then call
.build().map_err(CreateDefaultConfigError::unhandled) so 409 responses get the
generic message fallback.

---

Nitpick comments:
In `@clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs`:
- Line 85: Replace the manual construction of a 409 status in the expectedStatus
binding with the library constant: change the expression in expectedStatus from
Network.HTTP.Types.mkStatus 409 "" to status409 (or Network.HTTP.Types.status409
if you keep the qualified name), and ensure status409 is imported from
Network.HTTP.Types (or referenced qualified) so the module compiles and uses the
idiomatic constant.

In `@docs/docs/api/create-workspace.StatusCodes.json`:
- Line 1: Summary: Inconsistent terminology: "workspace lease" vs "workspace
lock" across API docs; unify to "workspace lock". Fix: update the Smithy
model(s) that define the CreateWorkspaceResponseContent property workspace_lock
and the WorkspaceLockConflict error description so both use the same term
("workspace lock"); specifically edit the description text for the symbol
workspace_lock in the CreateWorkspaceResponseContent and the
WorkspaceLockConflict error model to replace "workspace lease" with "workspace
lock" (or vice versa if your standard is the other term) so generated docs and
SDKs are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4cacaa70-6ebc-4129-83a2-6152f48ce1a1

📥 Commits

Reviewing files that changed from the base of the PR and between ff59a77 and e47a853.

📒 Files selected for processing (91)
  • clients/haskell/sdk/Io/Superposition/Command/CreateDefaultConfig.hs
  • clients/haskell/sdk/Io/Superposition/Command/DeleteDefaultConfig.hs
  • clients/haskell/sdk/Io/Superposition/Command/UpdateDefaultConfig.hs
  • clients/haskell/sdk/Io/Superposition/Model/CreateWorkspaceOutput.hs
  • clients/haskell/sdk/Io/Superposition/Model/GetWorkspaceOutput.hs
  • clients/haskell/sdk/Io/Superposition/Model/MigrateWorkspaceSchemaOutput.hs
  • clients/haskell/sdk/Io/Superposition/Model/UpdateWorkspaceOutput.hs
  • clients/haskell/sdk/Io/Superposition/Model/WorkspaceLock.hs
  • clients/haskell/sdk/Io/Superposition/Model/WorkspaceLockConflict.hs
  • clients/haskell/sdk/Io/Superposition/Model/WorkspaceResponse.hs
  • clients/haskell/sdk/SuperpositionSDK.cabal
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateDefaultConfig.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/CreateWorkspaceOutput.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/DeleteDefaultConfig.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/GetWorkspaceOutput.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/MigrateWorkspaceSchemaOutput.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateDefaultConfig.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/UpdateWorkspaceOutput.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/Workspace.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLock.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLockConflict.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceResponse.java
  • clients/javascript/sdk/src/commands/CreateDefaultConfigCommand.ts
  • clients/javascript/sdk/src/commands/CreateWorkspaceCommand.ts
  • clients/javascript/sdk/src/commands/DeleteDefaultConfigCommand.ts
  • clients/javascript/sdk/src/commands/GetWorkspaceCommand.ts
  • clients/javascript/sdk/src/commands/ListWorkspaceCommand.ts
  • clients/javascript/sdk/src/commands/MigrateWorkspaceSchemaCommand.ts
  • clients/javascript/sdk/src/commands/UpdateDefaultConfigCommand.ts
  • clients/javascript/sdk/src/commands/UpdateWorkspaceCommand.ts
  • clients/javascript/sdk/src/models/models_0.ts
  • clients/javascript/sdk/src/protocols/Aws_restJson1.ts
  • clients/python/sdk/superposition_sdk/_private/schemas.py
  • clients/python/sdk/superposition_sdk/deserialize.py
  • clients/python/sdk/superposition_sdk/models.py
  • crates/superposition_sdk/src/client/create_workspace.rs
  • crates/superposition_sdk/src/client/get_workspace.rs
  • crates/superposition_sdk/src/client/migrate_workspace_schema.rs
  • crates/superposition_sdk/src/client/update_workspace.rs
  • crates/superposition_sdk/src/error_meta.rs
  • crates/superposition_sdk/src/operation/create_default_config.rs
  • crates/superposition_sdk/src/operation/create_workspace/_create_workspace_output.rs
  • crates/superposition_sdk/src/operation/delete_default_config.rs
  • crates/superposition_sdk/src/operation/get_workspace/_get_workspace_output.rs
  • crates/superposition_sdk/src/operation/migrate_workspace_schema/_migrate_workspace_schema_output.rs
  • crates/superposition_sdk/src/operation/update_default_config.rs
  • crates/superposition_sdk/src/operation/update_workspace/_update_workspace_output.rs
  • crates/superposition_sdk/src/protocol_serde.rs
  • crates/superposition_sdk/src/protocol_serde/shape_create_default_config.rs
  • crates/superposition_sdk/src/protocol_serde/shape_create_workspace.rs
  • crates/superposition_sdk/src/protocol_serde/shape_delete_default_config.rs
  • crates/superposition_sdk/src/protocol_serde/shape_get_workspace.rs
  • crates/superposition_sdk/src/protocol_serde/shape_migrate_workspace_schema.rs
  • crates/superposition_sdk/src/protocol_serde/shape_update_default_config.rs
  • crates/superposition_sdk/src/protocol_serde/shape_update_workspace.rs
  • crates/superposition_sdk/src/protocol_serde/shape_workspace_lock.rs
  • crates/superposition_sdk/src/protocol_serde/shape_workspace_lock_conflict.rs
  • crates/superposition_sdk/src/protocol_serde/shape_workspace_response.rs
  • crates/superposition_sdk/src/serde_util.rs
  • crates/superposition_sdk/src/types.rs
  • crates/superposition_sdk/src/types/_workspace_lock.rs
  • crates/superposition_sdk/src/types/_workspace_response.rs
  • crates/superposition_sdk/src/types/builders.rs
  • crates/superposition_sdk/src/types/error.rs
  • crates/superposition_sdk/src/types/error/_workspace_lock_conflict.rs
  • crates/superposition_sdk/src/types/error/builders.rs
  • docs/docs/api/Superposition.openapi.json
  • docs/docs/api/create-default-config.StatusCodes.json
  • docs/docs/api/create-default-config.api.mdx
  • docs/docs/api/create-workspace.StatusCodes.json
  • docs/docs/api/create-workspace.api.mdx
  • docs/docs/api/delete-default-config.StatusCodes.json
  • docs/docs/api/delete-default-config.api.mdx
  • docs/docs/api/get-workspace.StatusCodes.json
  • docs/docs/api/get-workspace.api.mdx
  • docs/docs/api/list-workspace.StatusCodes.json
  • docs/docs/api/list-workspace.api.mdx
  • docs/docs/api/migrate-workspace-schema.StatusCodes.json
  • docs/docs/api/migrate-workspace-schema.api.mdx
  • docs/docs/api/update-default-config.StatusCodes.json
  • docs/docs/api/update-default-config.api.mdx
  • docs/docs/api/update-workspace.StatusCodes.json
  • docs/docs/api/update-workspace.api.mdx
  • smithy/models/default-config.smithy
  • smithy/models/main.smithy
  • smithy/models/workspace.smithy
  • smithy/patches/java.patch

Comment on lines +169 to +174
if (!tracker.checkMember($SCHEMA_MESSAGE)) {
message("");
}
if (!tracker.checkMember($SCHEMA_LOCK)) {
tracker.setMember($SCHEMA_LOCK);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Required lock can become null after error correction

Line 173 marks lock as present without setting a fallback value, so build() can create a WorkspaceLockConflict with lock == null despite lock being required.

Suggested fix
         if (!tracker.checkMember($SCHEMA_LOCK)) {
-            tracker.setMember($SCHEMA_LOCK);
+            lock(WorkspaceLock.builder().errorCorrection().build());
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@clients/java/sdk/src/main/java/io/juspay/superposition/model/WorkspaceLockConflict.java`
around lines 169 - 174, The build logic in WorkspaceLockConflict marks the
required member $SCHEMA_LOCK as present via tracker.setMember($SCHEMA_LOCK)
without ensuring the field lock is non-null, so build() may produce an instance
with lock == null; update the build() method (the WorkspaceLockConflict builder)
to either assign a safe fallback to the lock field before calling
tracker.setMember($SCHEMA_LOCK) or throw an
IllegalStateException/NullPointerException if lock is missing—ensure the code
path that calls tracker.setMember($SCHEMA_LOCK) also guarantees lock is set
(check the builder's lock variable and the tracker.checkMember($SCHEMA_LOCK)
branch) so required invariants hold.

Comment on lines +30 to +42
"WorkspaceLockConflict" => crate::operation::create_default_config::CreateDefaultConfigError::WorkspaceLockConflict({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::WorkspaceLockConflictBuilder::default();
output = crate::protocol_serde::shape_workspace_lock_conflict::de_workspace_lock_conflict_json_err(_response_body, output).map_err(crate::operation::create_default_config::CreateDefaultConfigError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::workspace_lock_conflict_correct_errors(output).build().map_err(crate::operation::create_default_config::CreateDefaultConfigError::unhandled)?
}
;
tmp
}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Preserve generic message fallback for WorkspaceLockConflict

Line 30 adds the new error mapping, but unlike adjacent arms it never backfills tmp.message from _error_message when the payload has no message. This creates inconsistent error diagnostics for 409s.

Suggested patch
         "WorkspaceLockConflict" => crate::operation::create_default_config::CreateDefaultConfigError::WorkspaceLockConflict({
             #[allow(unused_mut)]
             let mut tmp =
                  {
                     #[allow(unused_mut)]
                     let mut output = crate::types::error::builders::WorkspaceLockConflictBuilder::default();
                     output = crate::protocol_serde::shape_workspace_lock_conflict::de_workspace_lock_conflict_json_err(_response_body, output).map_err(crate::operation::create_default_config::CreateDefaultConfigError::unhandled)?;
                     let output = output.meta(generic);
                     crate::serde_util::workspace_lock_conflict_correct_errors(output).build().map_err(crate::operation::create_default_config::CreateDefaultConfigError::unhandled)?
                 }
             ;
+            if tmp.message.is_none() {
+                tmp.message = _error_message;
+            }
             tmp
         }),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/superposition_sdk/src/protocol_serde/shape_create_default_config.rs`
around lines 30 - 42, The new WorkspaceLockConflict match arm for
CreateDefaultConfigError builds the error payload but doesn't backfill
tmp.message from the fallback _error_message when the parsed payload lacks a
message, causing inconsistent diagnostics; update the WorkspaceLockConflict arm
(the block that uses
crate::protocol_serde::shape_workspace_lock_conflict::de_workspace_lock_conflict_json_err
and crate::serde_util::workspace_lock_conflict_correct_errors) to follow the
same pattern as adjacent arms: after output.meta(generic) and before build(),
check if tmp.message (or the builder's message field) is empty/None and if so
set it to _error_message, then call
.build().map_err(CreateDefaultConfigError::unhandled) so 409 responses get the
generic message fallback.

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