docs(openapi): add fork endpoints, forkId params, and spec-currency enforcement#97
Conversation
…rency
Three fork endpoints were fully implemented in internal/httpapi/server.go
but absent from the spec: POST /forks, DELETE /forks/{forkId},
POST /forks/{forkId}/commit. Also adds the forkId query parameter to all
six fork-aware filesystem endpoints (tree, file GET/PUT/DELETE, bulk,
export, query), fixes the depth default (spec said 2, server uses 10 with
max 100), adds ForkHandle / ForkCommitResponse / ForkCommitConflictResponse
schemas, the Gone (410) response component, and a ForkId component parameter.
Adds .claude/rules/openapi-spec.md so agents are reminded to keep the spec
in sync whenever they touch server.go or the openapi directory. Updates
AGENTS.md with the same guidance for non-Claude agents.
https://claude.ai/code/session_019EWJdxPwPwifR9ZUWaB1B6
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR introduces fork support to the RelayFile API by adding OpenAPI spec definitions for three new fork endpoints (create, discard, commit) and extending existing filesystem endpoints with an optional ChangesFork API Specification and Contract Maintenance
Sequence Diagram(s)The conditions for generating sequence diagrams are not met for this PR. The changes are primarily OpenAPI specification and documentation updates defining new API contracts, not implementing new control flow or multi-component interactions at the code level. Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76a90f2fa3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| parameters: | ||
| - $ref: '#/components/parameters/WorkspaceId' | ||
| - $ref: '#/components/parameters/CorrelationId' | ||
| - $ref: '#/components/parameters/ForkId' |
There was a problem hiding this comment.
Remove unsupported forkId from export spec
When a caller supplies forkId to GET /fs/export, the server does not read that query parameter; handleExport always calls s.store.ExportWorkspace(workspaceID) and filters the main workspace. Documenting this parameter here will lead clients to believe staged fork writes are included, but exports taken before commit silently return the parent workspace instead.
Useful? React with 👍 / 👎.
| requestBody: | ||
| required: false |
There was a problem hiding this comment.
Mark createFork body and proposalId as required
The server cannot create a fork without a JSON body containing a non-empty proposalId: handleCreateFork always calls decodeJSONBody, and Store.CreateFork returns ErrInvalidInput when proposalID is empty. With requestBody.required: false and no schema required list, generated clients may omit the body or proposalId and get a 400 from an operation the spec advertises as valid.
Useful? React with 👍 / 👎.
| '409': | ||
| description: A fork for this proposalId already exists | ||
| content: | ||
| application/json: |
There was a problem hiding this comment.
Document same-proposal replay as 200
The documented 409 for reusing the same proposalId does not match the implementation: Store.CreateFork returns the existing fork handle with nil error when the same workspace/proposal pair already exists, and only raises ErrForkProposalConflict when that proposal is associated with a different workspace. Clients following this response map will handle idempotent retries incorrectly because same-workspace replay returns 200, not 409.
Useful? React with 👍 / 👎.
Summary
POST /forks,DELETE /forks/{forkId},POST /forks/{forkId}/commit) were fully implemented ininternal/httpapi/server.gobut entirely absent from the specforkIdquery param documented on all six fork-aware filesystem endpoints:fs/tree,fs/file(GET/PUT/DELETE),fs/bulk,fs/export,fs/querydepthdefault corrected: spec said2, server uses10(with max100, not10)ForkHandle,ForkCommitResponse,ForkCommitConflictResponse,Gone(410) response,ForkIdcomponent parameter.claude/rules/openapi-spec.mdandAGENTS.mdsection instruct agents to keep the spec in sync wheneverserver.goor theopenapi/directory is touchedChanges
openapi/relayfile-v1.openapi.yaml.claude/rules/openapi-spec.mdopenapi/**andinternal/httpapi/**AGENTS.mdTest plan
scripts/check-contract-surface.shpasses on this branchinternal/httpapi/server.goforkIdparam flows correctly throughfs/tree,fs/file,fs/bulk,fs/export,fs/query10matchesparseBoundedInt(r.URL.Query().Get("depth"), 10, 1, 100)in server.gohttps://claude.ai/code/session_019EWJdxPwPwifR9ZUWaB1B6
Generated by Claude Code