Skip to content

fix: transfer PUT files over http in server mode - #422

Open
arnaldojvg wants to merge 1 commit into
tekumara:mainfrom
arnaldojvg:narr-5-gcs-presigned-url
Open

arnaldojvg wants to merge 1 commit into
tekumara:mainfrom
arnaldojvg:narr-5-gcs-presigned-url

Conversation

@arnaldojvg

@arnaldojvg arnaldojvg commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

In server mode the PUT response told the connector to write the file to a LOCAL_FS path, which only works when the client shares the server's filesystem and breaks when fakesnow runs in a container. The server now returns a GCS-style stageInfo with a presigned url pointing at a new PUT /fs_bucket/{path} route, so the connector uploads the file over http and the server stores it in the stage's backing directory. GCS is the only location type the connector uploads to via a plain http url, and it re-requests the url with the destination file name (file://data.csv.gz), so put_stage now includes the url netloc in the source path. A PUT with a bound ? target keeps LOCAL_FS, because the connector re-runs that command without bindings.

Tests: test_server_put_presigned_url, test_server_put_qmark_target_stays_local, test_server_bucket_upload_rejects_path_outside_bucket in tests/test_server.py. The existing server-mode test tests/test_copy_into.py::test_copy_internal_stage_server also goes through the http upload.

Part of #409, umbrella #403. Supersedes part of #413.

🤖 Generated with Claude Code

@arnaldojvg
arnaldojvg force-pushed the narr-5-gcs-presigned-url branch from 195f6c4 to 407c3cd Compare September 12, 2026 11:32
tekumara added a commit that referenced this pull request Sep 19, 2026
Alternative to #420, trimmed as discussed there: same unquoted-PUT fix,
but only `AUTO_COMPRESS` is honoured — `parallel`, `sourceCompression`
and `overwrite` keep their hardcoded defaults (with the existing TODO).

We only need `AUTO_COMPRESS=FALSE`: our job PUTs an already gzipped csv,
and with `autoCompress: True` it was gzipped a second time so the staged
file no longer matched what `COPY INTO` expected. `put_options` stays
generic so other options can be wired later.

If this one is preferred, #420 can be closed and #422 / #424 rebased
onto this branch instead.

Part of #409, umbrella #403.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: arnaldo-cai <arnaldo.varela@clarity.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Oliver Mannion <125105+tekumara@users.noreply.github.com>
@tekumara

Copy link
Copy Markdown
Owner

@arnaldojvg FYI this now has merge conflicts

In server mode the PUT response told the connector to write the file to
a local path, which only works when the client shares the server's
filesystem. Return a GCS-style stage info with a presigned url instead,
so the connector uploads the file over http to a new /fs_bucket route
that stores it in the stage's backing directory. GCS is the only
location type the connector uploads to via a plain http url, and it
re-requests the url with the destination file name, so PUT now accepts
a bare file://name.gz source. A PUT with a bound ? target keeps
LOCAL_FS because that re-request runs without bindings.

Part of tekumara#409, umbrella tekumara#403. Supersedes part of tekumara#413.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@arnaldojvg
arnaldojvg force-pushed the narr-5-gcs-presigned-url branch from 407c3cd to cc57b24 Compare September 21, 2026 12:24
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.

3 participants