Skip to content

GCS needs someone with a real bucket to run its test #214

Closed

Description

@WaylandYang

The GCS source ships with construction tests only. Nobody has pointed it at a real bucket.

That gap is not theoretical. S3 passed the same construction tests and still had a bug that
broke every bucket anyone had clicked a "new folder" button in: object_store normalises the
trailing slash off a directory marker, so the filter never fired, the GET asked for a key that
does not exist, and the 404 took the whole sync down. Only a live endpoint found it. GCS shares
that fetch path and adds its own builder configuration on top.

fsouza/fake-gcs-server cannot close this. It implements the JSON API
(/storage/v1/b/...) while object_store lists over the XML API
(/bucket?list-type=2), and returns 404 there. The usual emulator does not exercise the path
we use.

What would help: run the existing test against a real bucket and report what happens.

UTOPIA_GCS_TEST_ENDPOINT=https://storage.googleapis.com \
  UTOPIA_GCS_TEST_BUCKET=your-bucket \
  UTOPIA_GCS_TEST_KEY="$(cat service-account.json)" \
  cargo test -p utopia-server object_storage

A bucket with a few files under a docs/ prefix is enough, and read-only credentials are all
it needs. The test only lists and reads.

Worth checking beyond a pass: that a folder created through the Cloud Console is skipped rather
than fetched, and that last_modified comes back — it is the only source of doc_time here.

See crates/utopia-server/src/object_storage.rs.

Activity

  1. FabianIMV commented on Oct 5, 2026

    @FabianIMV
    Contributor

    Ran it_reads_from_gcs against a real bucket: us-central1, flat namespace, uniform access, service account with only Storage Object Viewer on the bucket. It passes.

    Bucket contents under docs/: a.txt ("hello"), b.md, data.csv, notes.txt, readme.md, plus two folders created with the Cloud Console (docs/ and docs/carpeta-consola/).

    Results:

    • Listing over the XML API works with a pasted service account key, and every object is read back.
    • Console folders are real zero-byte placeholders and come back normalised without the trailing slash. fetch drops them by size before any GET, so the S3 failure mode does not reproduce on GCS.
    • last_modified is populated on every object.
    • external_key is gs://<bucket>/docs/a.txt as expected.
    • Control run against a nonexistent bucket fails with NoSuchBucket on GET /<bucket>?list-type=2&prefix=docs%2F, so the green run really reached GCS.
    Raw listing before the size filter
    ("docs", 0)
    ("docs/a.txt", 5)
    ("docs/b.md", 7)
    ("docs/carpeta-consola", 0)
    ("docs/data.csv", 19)
    ("docs/notes.txt", 15)
    ("docs/readme.md", 11)
    

    One snag: the test requires docs/a.txt to exist (.expect("a.txt")), which neither the issue nor the doc comment mentions. My first run panicked with just a.txt until I uploaded it.

    I can open a small PR against dev that documents the expected fixture in the doc comment, checks the content of a.txt like the S3 test does, and asserts the raw listing contains a zero-byte placeholder, so a green run can't come from a bucket without one.

  2. WaylandYang commented on Oct 6, 2026

    @WaylandYang
    ContributorAuthor

    Thank you, this is exactly the run the issue asked for. The control against a missing bucket is what makes the green one count, and it is good to know the S3 failure does not carry over to GCS.

    Yes, please open the PR against dev. All three changes are welcome:

    • Name the fixture in the doc comment: docs/a.txt containing hello, plus one folder made in the Cloud Console.
    • Check the content of a.txt, as the S3 test does.
    • Assert that the raw listing has a zero-byte placeholder and that fetch returns none.

    One addition: the comment above the test still says GCS is covered by construction tests only. Please replace that with what you ran (date, region, uniform access, Storage Object Viewer).

    I will close this issue when the PR lands.

    Thanks again for taking the time to set up a real bucket and report it this carefully.

  3. WaylandYang commented on Oct 6, 2026

    @WaylandYang
    ContributorAuthor

    Closed by #1091 (4b0d39b on dev): the GCS path has been run against a real bucket, and the test now names its fixture and fails when the bucket has no Console folder to filter. Thanks, @FabianIMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions