Skip to content

Commit 5dd5be7

Browse files
filer: rewrite /workspace/import error-shape comment with concrete examples
Drop the abstract "Sources for the third bullet" footer and inline a concrete example message for each of the three error shapes. Each bullet now shows exactly what the server returns and the scenario that triggers it, so a future reader doesn't have to re-derive which path/state combination produces each shape. Co-authored-by: Isaac
1 parent 1054c19 commit 5dd5be7

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

libs/filer/workspace_files_client.go

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,34 @@ func (w *WorkspaceFilesClient) Write(ctx context.Context, name string, reader io
213213
// verified against a real workspace:
214214
//
215215
// - 400 RESOURCE_ALREADY_EXISTS — sequential conflict, no overwrite flag.
216-
// - 409 ALREADY_EXISTS — concurrent contention (observed in TestLock).
217-
// - 400 INVALID_PARAMETER_VALUE with a "type mismatch" / "node type" message
218-
// — overwrite=true on a path where the existing object's node type differs
219-
// from the upload (e.g. NOTEBOOK at /a/foo, regular-content upload to
220-
// /a/foo with overwrite). The server refuses the overwrite even though the
221-
// caller asked for it; from the caller's perspective the path is occupied,
222-
// so we surface this as already-exists.
216+
// Example: "/Users/me/foo.txt already exists. Please pass overwrite=true
217+
// to overwrite it."
223218
//
224-
// Sources for the third bullet (`bundle deploy` issues with overwrite=true):
225-
// "Cannot overwrite the asset at X due to type mismatch (asked: ..., actual: ...)"
226-
// "Requested node type [...] is different from the existing node type [...]"
219+
// - 409 ALREADY_EXISTS — concurrent contention (observed in TestLock when
220+
// five lockers race to write deploy.lock).
221+
// Example: "Node with name /Users/me/.bundle/.../deploy.lock already
222+
// exists. Please pass overwrite=true to update it."
223+
//
224+
// - 400 INVALID_PARAMETER_VALUE — overwrite=true on a path where the
225+
// existing object's node type differs from the upload. Two distinct
226+
// messages, both observed against aws-prod-ucws:
227+
//
228+
// (a) "Cannot overwrite the asset at /Users/me/foo due to type mismatch
229+
// (asked: FILE, actual: NOTEBOOK)" — fires when the upload path is
230+
// the same as an existing NOTEBOOK and the new content has no
231+
// notebook header (so AUTO would store it as FILE), or the mirror
232+
// case with FILE/NOTEBOOK swapped.
233+
//
234+
// (b) "Requested node type [FILE] is different from the existing node
235+
// type [NOTEBOOK]" — fires when /foo is already a NOTEBOOK (from a
236+
// prior /foo.py upload) and an overwrite-upload of regular content
237+
// targets /foo.py: AUTO would store the new content as FILE at
238+
// /foo.py, but the workspace treats /foo.py as the source view of
239+
// the existing /foo NOTEBOOK and rejects the type change.
240+
//
241+
// The server refuses the overwrite even though the caller asked for
242+
// it; from the caller's perspective the path is occupied, so we
243+
// surface this as already-exists.
227244
if errors.Is(err, apierr.ErrResourceAlreadyExists) || errors.Is(err, apierr.ErrAlreadyExists) {
228245
return fileAlreadyExistsError{absPath}
229246
}

0 commit comments

Comments
 (0)