Skip to content

improve workspace api documentation and comments - #861

Merged
gschoeni merged 5 commits into
mainfrom
gs/document-workspace-apis
Aug 13, 2026
Merged

improve workspace api documentation and comments#861
gschoeni merged 5 commits into
mainfrom
gs/document-workspace-apis

Conversation

@gschoeni

Copy link
Copy Markdown
Collaborator

Realized there were some gaps in our workspace api docs when working on the text editor project

@gschoeni
gschoeni requested a review from jcelliott August 12, 2026 19:49
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 739152da-d74e-4edf-9f1f-380ca4a38eb9

📥 Commits

Reviewing files that changed from the base of the PR and between ce095a8 and 10c2ffb.

📒 Files selected for processing (1)
  • crates/oxen-server/src/controllers/workspaces/changes.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added Workspace.unstage(path) to remove files from workspace changes without deleting them from the base repository.
    • Added API support for listing staged workspace changes, including directory filtering and pagination.
  • Bug Fixes

    • Invalid zero page sizes now return 400 Bad Request.
    • Workspace-behind errors return 409 Conflict.
    • Staged-file merge conflicts return 409 Conflict; other commit failures return 422.
  • Documentation

    • Improved API response schemas and endpoint documentation for workspace status and staged changes.

Walkthrough

The PR adds Python workspace unstage methods, documents staged-change endpoints in OpenAPI, registers those endpoints, generates schemas for staged-status models, and updates workspace conflict response codes.

Changes

Workspace staging API and OpenAPI

Layer / File(s) Summary
Staged status schema contracts
crates/liboxen/src/model/..., crates/liboxen/src/view/remote_staged_status.rs
Staged directory statistics and remote staged status types now derive ToSchema. Path fields use explicit OpenAPI types.
Workspace endpoint documentation
crates/oxen-server/src/controllers/workspaces/..., crates/oxen-server/src/errors.rs, crates/oxen-server/src/main.rs
Staged-change listing endpoints now include OpenAPI metadata and reject page_size=0. The endpoints are registered in OpenAPI. Workspace-behind errors use HTTP 409, while other commit failures use HTTP 422.
Python unstage API
crates/oxen-py/src/py_workspace.rs, oxen-python/python/oxen/workspace.py
Rust and Python workspace APIs expose unstage(path). Workspace.rm documentation describes unstaging without deleting base-repository files.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 10c2f

This documentation-focused change has no actionable merge-blocking risk remaining and is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Workspace
  participant PyWorkspace
  participant WorkspaceChangesAPI
  Workspace->>PyWorkspace: unstage(path)
  PyWorkspace->>WorkspaceChangesAPI: remove path from workspace changes
  WorkspaceChangesAPI-->>PyWorkspace: return success or API error
  PyWorkspace-->>Workspace: return None or PyOxenError
Loading

Possibly related PRs

  • Oxen-AI/Oxen#801: Updates backend unstage handling related to the unstage APIs added here.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description explains that the pull request addresses gaps in workspace API documentation, which matches the documented changes.
Title check ✅ Passed The title clearly summarizes the main change: improving workspace API documentation and comments.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gs/document-workspace-apis

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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 `@crates/oxen-server/src/controllers/workspaces/changes.rs`:
- Around line 31-32: Validate the page_size query parameter in both workspace
changes operations so zero is rejected before pagination calculations, while
preserving the existing safe handling for page=0. Update both parameter
descriptions to document that page_size must be at least 1, and ensure invalid
values return the established request-validation error.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f8d69410-e5c8-4d95-9be3-f8acf189e9a2

📥 Commits

Reviewing files that changed from the base of the PR and between c21119f and fb3922a.

📒 Files selected for processing (9)
  • crates/liboxen/src/model/staged_dir_stats.rs
  • crates/liboxen/src/model/summarized_staged_dir_stats.rs
  • crates/liboxen/src/view/remote_staged_status.rs
  • crates/oxen-py/src/py_workspace.rs
  • crates/oxen-server/src/controllers/workspaces.rs
  • crates/oxen-server/src/controllers/workspaces/changes.rs
  • crates/oxen-server/src/errors.rs
  • crates/oxen-server/src/main.rs
  • oxen-python/python/oxen/workspace.py

Comment thread crates/oxen-server/src/controllers/workspaces/changes.rs Outdated
@gschoeni
gschoeni marked this pull request as ready for review August 12, 2026 21:30

@Eric-Laurence Eric-Laurence left a comment

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.

Looks good!

#[utoipa::path(
get,
path = "/api/repos/{namespace}/{repo_name}/workspaces/{workspace_id}/changes",
description = "List the staged changes (added, modified, and removed files) in a workspace, paginated.",

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.

I believe this endpoint paginates each of the three file lists independently, I think the description could be made a little more helpful

#[utoipa::path(
get,
path = "/api/repos/{namespace}/{repo_name}/workspaces/{workspace_id}/changes/{path}",
description = "List the staged changes (added, modified, and removed files) under a directory in a workspace, paginated.",

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.

same here: I believe this endpoint paginates each one independently, I think the description could be made a little more helpful

gschoeni and others added 2 commits August 12, 2026 22:46
…es docs

The added, modified, and removed lists are each paginated independently,
so say so in both endpoint descriptions. Also reject page_size=0 with a
400 instead of returning total_pages = usize::MAX.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gschoeni
gschoeni merged commit 6e05ebc into main Aug 13, 2026
1 check was pending
@gschoeni
gschoeni deleted the gs/document-workspace-apis branch August 13, 2026 05:48
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